From: thor.thayer@linux.intel.com
To: linville@tuxdriver.com, peppe.cavallaro@st.com
Cc: netdev@vger.kernel.org, thor.thayer@linux.intel.com
Subject: [PATCHv3 1/2] ethtool: stmmac: Add macros for number of registers
Date: Fri, 7 Jul 2017 09:08:48 -0500 [thread overview]
Message-ID: <1499436529-4852-1-git-send-email-thor.thayer@linux.intel.com> (raw)
From: Thor Thayer <thor.thayer@linux.intel.com>
This patch adds macros for the number of registers to
loop through to make the code easier to read.
Signed-off-by: Thor Thayer <thor.thayer@linux.intel.com>
---
v2 New commit. Add macros for number of registers.
v3 Only add macros - remove DMA indexing.
---
stmmac.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/stmmac.c b/stmmac.c
index fb69bfe..23ed31a 100644
--- a/stmmac.c
+++ b/stmmac.c
@@ -14,6 +14,10 @@
#include <string.h>
#include "internal.h"
+#define MAC100_DMA_REG_NUM 9
+#define GMAC_REG_NUM 55
+#define GMAC_DMA_REG_NUM 22
+
int st_mac100_dump_regs(struct ethtool_drvinfo *info,
struct ethtool_regs *regs)
{
@@ -36,7 +40,7 @@ int st_mac100_dump_regs(struct ethtool_drvinfo *info,
fprintf(stdout, "\n");
fprintf(stdout, "DMA Registers\n");
- for (i = 0; i < 9; i++)
+ for (i = 0; i < MAC100_DMA_REG_NUM; i++)
fprintf(stdout, "CSR%d 0x%08X\n", i, *stmmac_reg++);
fprintf(stdout, "DMA cur tx buf addr 0x%08X\n", *stmmac_reg++);
@@ -54,12 +58,12 @@ int st_gmac_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
fprintf(stdout, "ST GMAC Registers\n");
fprintf(stdout, "GMAC Registers\n");
- for (i = 0; i < 55; i++)
+ for (i = 0; i < GMAC_REG_NUM; i++)
fprintf(stdout, "Reg%d 0x%08X\n", i, *stmmac_reg++);
fprintf(stdout, "\n");
fprintf(stdout, "DMA Registers\n");
- for (i = 0; i < 22; i++)
+ for (i = 0; i < GMAC_DMA_REG_NUM; i++)
fprintf(stdout, "Reg%d 0x%08X\n", i, *stmmac_reg++);
return 0;
--
2.7.4
next reply other threads:[~2017-07-07 14:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-07 14:08 thor.thayer [this message]
2017-07-07 14:08 ` [PATCHv3 2/2] ethtool: stmmac: Add DMA HW Feature Register thor.thayer
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=1499436529-4852-1-git-send-email-thor.thayer@linux.intel.com \
--to=thor.thayer@linux.intel.com \
--cc=linville@tuxdriver.com \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
/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;
as well as URLs for NNTP newsgroup(s).