Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Preethi Banala <preethi.banala@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH 3/3] ethtool/ixgbe: Reduce format string storage
Date: Thu, 21 Apr 2016 11:28:57 -0700	[thread overview]
Message-ID: <20160421182856.13330.56812.stgit@ixgbe-dev.jf.intel.com> (raw)
In-Reply-To: <20160421182545.13330.59497.stgit@ixgbe-dev.jf.intel.com>

Reduce format string storage using for loop.

Signed-off-by: Preethi Banala <preethi.banala@intel.com>
---
 ixgbe.c |   57 ++++++++++++---------------------------------------------
 1 file changed, 12 insertions(+), 45 deletions(-)

diff --git a/ixgbe.c b/ixgbe.c
index 4f5af779f763..ff0e769cb7a8 100644
--- a/ixgbe.c
+++ b/ixgbe.c
@@ -1193,21 +1193,10 @@ ixgbe_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
 		"0x07F08: TDHMPN      (Tx Desc Handler Mem Page Num)   0x%08X\n",
 		regs_buff[1095]);
 
-	fprintf(stdout,
-		"0x07F10: TIC_DW0     (Tx Desc Hand. Mem Read Data 0)  0x%08X\n",
-		regs_buff[1096]);
-
-	fprintf(stdout,
-		"0x07F14: TIC_DW1     (Tx Desc Hand. Mem Read Data 1)  0x%08X\n",
-		regs_buff[1097]);
-
-	fprintf(stdout,
-		"0x07F18: TIC_DW2     (Tx Desc Hand. Mem Read Data 2)  0x%08X\n",
-		regs_buff[1098]);
-
-	fprintf(stdout,
-		"0x07F1C: TIC_DW3     (Tx Desc Hand. Mem Read Data 3)  0x%08X\n",
-		regs_buff[1099]);
+	for (i = 0; i < 4; i++)
+		fprintf(stdout,
+			"0x%05X: TIC_DW%d     (Tx Desc Hand. Mem Read Data %d)  0x%08X\n",
+			0x07F10 + (4 * i), i, i, regs_buff[1096 + i]);
 
 	fprintf(stdout,
 		"0x07F20: TDPROBE     (Tx Probe Mode Status)           0x%08X\n",
@@ -1217,41 +1206,19 @@ ixgbe_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
 		"0x0C600: TXBUFCTRL   (TX Buffer Access Control)       0x%08X\n",
 		regs_buff[1101]);
 
-	fprintf(stdout,
-		"0x0C610: TXBUFDATA0  (TX Buffer DATA 0)               0x%08X\n",
-		regs_buff[1102]);
-
-	fprintf(stdout,
-		"0x0C614: TXBUFDATA1  (TX Buffer DATA 1)               0x%08X\n",
-		regs_buff[1103]);
-
-	fprintf(stdout,
-		"0x0C618: TXBUFDATA2  (TX Buffer DATA 2)               0x%08X\n",
-		regs_buff[1104]);
-
-	fprintf(stdout,
-		"0x0C61C: TXBUFDATA3  (TX Buffer DATA 3)               0x%08X\n",
-		regs_buff[1105]);
+	for (i = 0; i < 4; i++)
+		fprintf(stdout,
+			"0x%05X: TXBUFDATA%d  (TX Buffer DATA %d)               0x%08X\n",
+			0x0C610 + (4 * i), i, i, regs_buff[1102 + i]);
 
 	fprintf(stdout,
 		"0x03600: RXBUFCTRL   (RX Buffer Access Control)       0x%08X\n",
 		regs_buff[1106]);
 
-	fprintf(stdout,
-		"0x03610: RXBUFDATA0  (RX Buffer DATA 0)               0x%08X\n",
-		regs_buff[1107]);
-
-	fprintf(stdout,
-		"0x03614: RXBUFDATA1  (RX Buffer DATA 1)               0x%08X\n",
-		regs_buff[1108]);
-
-	fprintf(stdout,
-		"0x03618: RXBUFDATA2  (RX Buffer DATA 2)               0x%08X\n",
-		regs_buff[1109]);
-
-	fprintf(stdout,
-		"0x0361C: RXBUFDATA3  (RX Buffer DATA 3)               0x%08X\n",
-		regs_buff[1110]);
+	for (i = 0; i < 4; i++)
+		fprintf(stdout,
+			"0x%05X: RXBUFDATA%d  (RX Buffer DATA %d)               0x%08X\n",
+			0x03610 + (4 * i), i, i, regs_buff[1107 + i]);
 
 	for (i = 0; i < 8; i++)
 		fprintf(stdout,


  parent reply	other threads:[~2016-04-21 18:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-21 18:28 [Intel-wired-lan] [PATCH 0/3] Update ethtool utility Preethi Banala
2016-04-21 18:28 ` [Intel-wired-lan] [PATCH 1/3] ethtool/ixgbe: Add device ID and mac_type definitions Preethi Banala
2016-04-22 20:21   ` Bowers, AndrewX
2016-04-21 18:28 ` [Intel-wired-lan] [PATCH 2/3] ethtool/ixgbe: Correct offsets and support x550, x550em_x, x550em_a Preethi Banala
2016-04-22 20:56   ` Bowers, AndrewX
2016-04-21 18:28 ` Preethi Banala [this message]
2016-04-22 20:57   ` [Intel-wired-lan] [PATCH 3/3] ethtool/ixgbe: Reduce format string storage 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=20160421182856.13330.56812.stgit@ixgbe-dev.jf.intel.com \
    --to=preethi.banala@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