netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] sis190: read the mac address from the eeprom first
@ 2008-02-18 20:20 Francois Romieu
  2008-02-20 16:52 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: Francois Romieu @ 2008-02-18 20:20 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev, Andrew Morton, dsd, Gabriel A. Devenyi

Reading a serie of zero from the cmos sram area do not work
well with is_valid_ether_addr(). Let's read the mac address
from the eeprom first as it seems more reliable.

Fix for http://bugzilla.kernel.org/show_bug.cgi?id=9831

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
---
 drivers/net/sis190.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index 202fdf3..20745fd 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -1633,13 +1633,18 @@ static inline void sis190_init_rxfilter(struct net_device *dev)
 static int __devinit sis190_get_mac_addr(struct pci_dev *pdev, 
 					 struct net_device *dev)
 {
-	u8 from;
+	int rc;
+
+	rc = sis190_get_mac_addr_from_eeprom(pdev, dev);
+	if (rc < 0) {
+		u8 reg;
 
-	pci_read_config_byte(pdev, 0x73, &from);
+		pci_read_config_byte(pdev, 0x73, &reg);
 
-	return (from & 0x00000001) ?
-		sis190_get_mac_addr_from_apc(pdev, dev) :
-		sis190_get_mac_addr_from_eeprom(pdev, dev);
+		if (reg & 0x00000001)
+			rc = sis190_get_mac_addr_from_apc(pdev, dev);
+	}
+	return rc;
 }
 
 static void sis190_set_speed_auto(struct net_device *dev)
-- 
1.5.3.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] sis190: read the mac address from the eeprom first
  2008-02-18 20:20 [PATCH 1/1] sis190: read the mac address from the eeprom first Francois Romieu
@ 2008-02-20 16:52 ` Jeff Garzik
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2008-02-20 16:52 UTC (permalink / raw)
  To: Francois Romieu; +Cc: netdev, Andrew Morton, dsd, Gabriel A. Devenyi

Francois Romieu wrote:
> Reading a serie of zero from the cmos sram area do not work
> well with is_valid_ether_addr(). Let's read the mac address
> from the eeprom first as it seems more reliable.
> 
> Fix for http://bugzilla.kernel.org/show_bug.cgi?id=9831
> 
> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
> ---
>  drivers/net/sis190.c |   15 ++++++++++-----
>  1 files changed, 10 insertions(+), 5 deletions(-)

applied



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-20 16:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-18 20:20 [PATCH 1/1] sis190: read the mac address from the eeprom first Francois Romieu
2008-02-20 16:52 ` Jeff Garzik

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).