Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Catherine Sullivan <catherine.sullivan@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [next PATCH S15 13/15] i40e: remove unnecessary string copy operations
Date: Thu,  3 Sep 2015 17:19:00 -0400	[thread overview]
Message-ID: <1441315142-173025-14-git-send-email-catherine.sullivan@intel.com> (raw)
In-Reply-To: <1441315142-173025-1-git-send-email-catherine.sullivan@intel.com>

From: Shannon Nelson <shannon.nelson@intel.com>

Save a little stack space and remove unnecessary strncpy() with a little
string pointer.

Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Change-ID: Id2719d34710bfc273d3bb445fec085cd04276e88
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 4bcf4a1..848482b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -4896,8 +4896,8 @@ out:
  */
 void i40e_print_link_message(struct i40e_vsi *vsi, bool isup)
 {
-	char speed[SPEED_SIZE] = "Unknown";
-	char fc[FC_SIZE] = "RX/TX";
+	char *speed = "Unknown";
+	char *fc = "Unknown";
 
 	if (vsi->current_isup == isup)
 		return;
@@ -4918,19 +4918,19 @@ void i40e_print_link_message(struct i40e_vsi *vsi, bool isup)
 
 	switch (vsi->back->hw.phy.link_info.link_speed) {
 	case I40E_LINK_SPEED_40GB:
-		strlcpy(speed, "40 Gbps", SPEED_SIZE);
+		speed = "40 G";
 		break;
 	case I40E_LINK_SPEED_20GB:
-		strncpy(speed, "20 Gbps", SPEED_SIZE);
+		speed = "20 G";
 		break;
 	case I40E_LINK_SPEED_10GB:
-		strlcpy(speed, "10 Gbps", SPEED_SIZE);
+		speed = "10 G";
 		break;
 	case I40E_LINK_SPEED_1GB:
-		strlcpy(speed, "1000 Mbps", SPEED_SIZE);
+		speed = "1000 M";
 		break;
 	case I40E_LINK_SPEED_100MB:
-		strncpy(speed, "100 Mbps", SPEED_SIZE);
+		speed = "100 M";
 		break;
 	default:
 		break;
@@ -4938,20 +4938,20 @@ void i40e_print_link_message(struct i40e_vsi *vsi, bool isup)
 
 	switch (vsi->back->hw.fc.current_mode) {
 	case I40E_FC_FULL:
-		strlcpy(fc, "RX/TX", FC_SIZE);
+		fc = "RX/TX";
 		break;
 	case I40E_FC_TX_PAUSE:
-		strlcpy(fc, "TX", FC_SIZE);
+		fc = "TX";
 		break;
 	case I40E_FC_RX_PAUSE:
-		strlcpy(fc, "RX", FC_SIZE);
+		fc = "RX";
 		break;
 	default:
-		strlcpy(fc, "None", FC_SIZE);
+		fc = "None";
 		break;
 	}
 
-	netdev_info(vsi->netdev, "NIC Link is Up %s Full Duplex, Flow Control: %s\n",
+	netdev_info(vsi->netdev, "NIC Link is Up %sbps Full Duplex, Flow Control: %s\n",
 		    speed, fc);
 }
 
-- 
1.9.3


  parent reply	other threads:[~2015-09-03 21:19 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-03 21:18 [Intel-wired-lan] [next PATCH S15 00/15] i40e/i40evf updates Catherine Sullivan
2015-09-03 21:18 ` [Intel-wired-lan] [next PATCH S15 01/15] i40e: Add missing parameter comment to ndo_bridge_setlink Catherine Sullivan
2015-09-10 22:17   ` Bowers, AndrewX
2015-09-03 21:18 ` [Intel-wired-lan] [next PATCH S15 02/15] i40e: use priv flags to control flow director Catherine Sullivan
2015-09-10 22:26   ` Bowers, AndrewX
2015-09-03 21:18 ` [Intel-wired-lan] [next PATCH S15 03/15] i40e: Change some messages from info to debug only Catherine Sullivan
2015-09-10 22:38   ` Bowers, AndrewX
2015-09-03 21:18 ` [Intel-wired-lan] [next PATCH S15 04/15] i40e: Lock for VSI's MAC filter list Catherine Sullivan
2015-09-11 15:59   ` Bowers, AndrewX
2015-09-29 19:08   ` Jesse Brandeburg
2015-09-30 16:18     ` Sullivan, Catherine
2015-09-03 21:18 ` [Intel-wired-lan] [next PATCH S15 05/15] i40e: Remove 100M SGMII unless hw is X722 Catherine Sullivan
2015-09-11 16:03   ` Bowers, AndrewX
2015-09-03 21:18 ` [Intel-wired-lan] [next PATCH S15 06/15] i40e/i40evf: Add WB_ON_ITR offload support Catherine Sullivan
2015-09-11 16:08   ` Bowers, AndrewX
2015-09-03 21:18 ` [Intel-wired-lan] [next PATCH S15 07/15] i40e: remove obsolete version check Catherine Sullivan
2015-09-11 16:09   ` Bowers, AndrewX
2015-09-03 21:18 ` [Intel-wired-lan] [next PATCH S15 08/15] i40e: allow FD SB if MFP mode only has 1 partition Catherine Sullivan
2015-09-11 16:11   ` Bowers, AndrewX
2015-09-03 21:18 ` [Intel-wired-lan] [next PATCH S15 09/15] i40e: remove FD atr control from debugfs Catherine Sullivan
2015-09-11 16:14   ` Bowers, AndrewX
2015-09-03 21:18 ` [Intel-wired-lan] [next PATCH S15 10/15] i40e/i40evf: remove redundant declarations of a variable and a function Catherine Sullivan
2015-09-11 16:16   ` Bowers, AndrewX
2015-09-03 21:18 ` [Intel-wired-lan] [next PATCH S15 11/15] i40e: Store off PHY capabilities Catherine Sullivan
2015-09-11 16:20   ` Bowers, AndrewX
2015-09-03 21:18 ` [Intel-wired-lan] [next PATCH S15 12/15] i40e: X722 is on the IOSF bus and does not report the PCI bus info Catherine Sullivan
2015-09-22 21:17   ` Bowers, AndrewX
2015-09-03 21:19 ` Catherine Sullivan [this message]
2015-09-22 21:20   ` [Intel-wired-lan] [next PATCH S15 13/15] i40e: remove unnecessary string copy operations Bowers, AndrewX
2015-09-03 21:19 ` [Intel-wired-lan] [next PATCH S15 14/15] i40evf: speed up init Catherine Sullivan
2015-09-22 21:23   ` Bowers, AndrewX
2015-09-03 21:19 ` [Intel-wired-lan] [next PATCH S15 15/15] i40e/i40evf: Bump i40e version to 1.3.28 and i40evf to 1.3.19 Catherine Sullivan
2015-09-22 21:24   ` Bowers, AndrewX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441315142-173025-14-git-send-email-catherine.sullivan@intel.com \
    --to=catherine.sullivan@intel.com \
    --cc=intel-wired-lan@osuosl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox