Skip to contentSkip to conversation

ethtool: Add version check for et131x regs

PATCH In review Mark Einon 2 participants 3 messages Jan 5, 2013 – Jan 22, 2013

Subsystems (2)
lore
Share & tools
lore

Mark Einon

author
#0 lore raw

PATCH 1/1 ethtool: Add version check for et131x regs

Added a version check for the et131x reg dump, in case the dump format needs to be changed later.

---
 et131x.c |    4 ++++
 1 file changed, 4 insertions(+)
et131x.c +4 -0
index b36c184..8cdbec0 100644
@@ -4,8 +4,12 @@
 
 int et131x_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
 {
+	u8 version = (u8)(regs->version >> 24);
 	u32 *reg = (u32 *)regs->data;
 
+	if(version != 1)
+		return -1;
+
 	fprintf(stdout, "PHY Registers\n");
 	fprintf(stdout, "0x0, Basic Control Reg          = 0x%04X\n", *reg++);
 	fprintf(stdout, "0x1, Basic Status Reg           = 0x%04X\n", *reg++);
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 13 lines · Mark Einon

Added a version check for the et131x reg dump, in case the dump format needs to be changed later.

---
 et131x.c |    4 ++++
 1 file changed, 4 insertions(+)
et131x.c +0 -0
index b36c184..8cdbec0 100644

et131x.c line 10

Quoted 7 lines
et131x.c +2 -0
@@ -4,8 +4,12 @@
 
 int et131x_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
 {
+	u8 version = (u8)(regs->version >> 24);
 	u32 *reg = (u32 *)regs->data;
 
+	if(version != 1)

Needs a space before the open-parentheis.

Ben.

Quoted 5 lines
et131x.c +2 -0
+		return -1;
+
 	fprintf(stdout, "PHY Registers\n");
 	fprintf(stdout, "0x0, Basic Control Reg          = 0x%04X\n", *reg++);
 	fprintf(stdout, "0x1, Basic Status Reg           = 0x%04X\n", *reg++);
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
author
#2 lore raw
Quoted 20 lines · Ben Hutchings
Quoted 19 lines · Mark Einon

Added a version check for the et131x reg dump, in case the dump format needs to be changed later.

---
 et131x.c |    4 ++++
 1 file changed, 4 insertions(+)
et131x.c +1 -0
index b36c184..8cdbec0 100644
@@ -4,8 +4,12 @@
 
 int et131x_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
 {
+     u8 version = (u8)(regs->version >> 24);
      u32 *reg = (u32 *)regs->data;
 
Quoted 5 lines

et131x.c line 10

Quoted 1 line
et131x.c +1 -0
+     if(version != 1)

Needs a space before the open-parentheis.

Ben.

You're right - I cut and pasted the code from another file without checking. I'll send a separate patch for fixing them, if you want this patch re-submitted as well, then just let me know.

cheers,

Mark

Quoted 12 lines

et131x.c line 15

Quoted 6 lines
et131x.c +2 -0
+             return -1;
+
      fprintf(stdout, "PHY Registers\n");
      fprintf(stdout, "0x0, Basic Control Reg          = 0x%04X\n", *reg++);
      fprintf(stdout, "0x1, Basic Status Reg           = 0x%04X\n", *reg++);

--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.