2009-12-30 18:50:52

by Hartley Sweeten

[permalink] [raw]
Subject: [PATCH] drivers/atm/lanai.c: use %pM to show MAC address

Use the %pM kernel extension to display the MAC address.

Signed-off-by: H Hartley Sweeten <[email protected]>
Cc: David S. Miller <[email protected]>

---

diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index cf97c34..7fe7c32 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -998,9 +998,7 @@ static int __devinit eeprom_validate(struct lanai_dev *lanai)
(unsigned int) e[EEPROM_MAC_REV + i]);
return -EIO;
}
- DPRINTK("eeprom: MAC address = %02X:%02X:%02X:%02X:%02X:%02X\n",
- e[EEPROM_MAC + 0], e[EEPROM_MAC + 1], e[EEPROM_MAC + 2],
- e[EEPROM_MAC + 3], e[EEPROM_MAC + 4], e[EEPROM_MAC + 5]);
+ DPRINTK("eeprom: MAC address = %pM\n", &e[EEPROM_MAC]);
/* Verify serial number */
lanai->serialno = eeprom_be4(lanai, EEPROM_SERIAL);
v = eeprom_be4(lanai, EEPROM_SERIAL_REV);
@@ -2483,14 +2481,8 @@ static int lanai_proc_read(struct atm_dev *atmdev, loff_t *pos, char *page)
return sprintf(page, "revision: board=%d, pci_if=%d\n",
lanai->board_rev, (int) lanai->pci->revision);
if (left-- == 0)
- return sprintf(page, "EEPROM ESI: "
- "%02X:%02X:%02X:%02X:%02X:%02X\n",
- lanai->eeprom[EEPROM_MAC + 0],
- lanai->eeprom[EEPROM_MAC + 1],
- lanai->eeprom[EEPROM_MAC + 2],
- lanai->eeprom[EEPROM_MAC + 3],
- lanai->eeprom[EEPROM_MAC + 4],
- lanai->eeprom[EEPROM_MAC + 5]);
+ return sprintf(page, "EEPROM ESI: %pM\n",
+ &lanai->eeprom[EEPROM_MAC]);
if (left-- == 0)
return sprintf(page, "status: SOOL=%d, LOCD=%d, LED=%d, "
"GPIN=%d\n", (lanai->status & STATUS_SOOL) ? 1 : 0,


2009-12-30 18:59:49

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH] drivers/atm/lanai.c: use %pM to show MAC address

On Wed, 2009-12-30 at 13:50 -0500, H Hartley Sweeten wrote:
> Use the %pM kernel extension to display the MAC address.
> diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
> index cf97c34..7fe7c32 100644
> --- a/drivers/atm/lanai.c
> +++ b/drivers/atm/lanai.c
[]
> @@ -2483,14 +2481,8 @@ static int lanai_proc_read(struct atm_dev *atmdev, loff_t *pos, char *page)
> return sprintf(page, "revision: board=%d, pci_if=%d\n",
> lanai->board_rev, (int) lanai->pci->revision);
> if (left-- == 0)
> - return sprintf(page, "EEPROM ESI: "
> - "%02X:%02X:%02X:%02X:%02X:%02X\n",
> - lanai->eeprom[EEPROM_MAC + 0],
> - lanai->eeprom[EEPROM_MAC + 1],
> - lanai->eeprom[EEPROM_MAC + 2],
> - lanai->eeprom[EEPROM_MAC + 3],
> - lanai->eeprom[EEPROM_MAC + 4],
> - lanai->eeprom[EEPROM_MAC + 5]);
> + return sprintf(page, "EEPROM ESI: %pM\n",
> + &lanai->eeprom[EEPROM_MAC]);

This is a user-visible change from upper case to lower case.
Probably doesn't matter, but maybe...

Subject: Re: [PATCH] drivers/atm/lanai.c: use %pM to show MAC address

On Wed, 30 Dec 2009, Joe Perches wrote:
> > + return sprintf(page, "EEPROM ESI: %pM\n",
> > + &lanai->eeprom[EEPROM_MAC]);
>
> This is a user-visible change from upper case to lower case.
> Probably doesn't matter, but maybe...

Something would need to be _really_ broken to:

1. Parse the kernel log after MACs in the first place
2. Be case-sensitive about it

If it breaks anything, it is a breakage well deserved...

--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh