<br><br><div class="gmail_quote">2011/4/11 Sascha Hauer <span dir="ltr"><<a href="mailto:s.hauer@pengutronix.de">s.hauer@pengutronix.de</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On Mon, Apr 11, 2011 at 09:23:56AM +0200, Franck JULLIEN wrote:<br>
> 2011/4/11 Jean-Christophe PLAGNIOL-VILLARD <<a href="mailto:plagnioj@jcrosoft.com">plagnioj@jcrosoft.com</a>><br>
><br>
> > On 20:21 Sun 10 Apr , Franck JULLIEN wrote:<br>
> > > 2011/4/10 Jean-Christophe PLAGNIOL-VILLARD <<a href="mailto:plagnioj@jcrosoft.com">plagnioj@jcrosoft.com</a>><br>
> > ><br>
> > > > > index 0000000..2687377<br>
> > > > > --- /dev/null<br>
> > > > > +<br>
> > > > > +static int tse_get_ethaddr(struct eth_device *edev,<br>
> > unsigned<br>
> > > char *m)<br>
> > > > > +{<br>
> > > > > + /* There is no eeprom */<br>
> > > > so return the content of the register no?<br>
> > > ><br>
> > > > Well, the register is reseted to 0 when the MAC starts so there<br>
> > is<br>
> > > no<br>
> > > > Ethernet address<br>
> > > > to get.<br>
> > > ><br>
> > > except this function is supposed to return the mac address of the<br>
> > device<br>
> > > at<br>
> > > any time so after a set of it it will not be true any more<br>
> > ><br>
> > > If I implement the function I get a "eth@eth0: got MAC address from<br>
> > > EEPROM: 00:00:00:00:00:00" at startup.<br>
> > > That why I returned -1 as what I could find int at91_ether.c......<br>
> > > Or, I could find something to return -1 as long as the MAC address<br>
> > hasn't<br>
> > > been set.<br>
> > ><br>
> > I known this issue I re-write recently the at91_ether and the same on macb<br>
> > will post the patch soon<br>
> ><br>
> > It's fine the uperlayer will see that it's not a valid mac so this will<br>
> > generate a random one<br>
> > cf net/net.c IIRC<br>
> ><br>
> ><br>
> For me, it's a bit annoying to get this message at startup.<br>
><br>
> Don't you really think I could have a flag in the private structure to check<br>
> if an address has been set and then return -1 or the address in the<br>
> tse_get_ethaddr function ?<br>
<br>
</div></div>How about the following:<br>
<br>
<br>
diff --git a/net/eth.c b/net/eth.c<br>
index 0251e59..c5b346c 100644<br>
--- a/net/eth.c<br>
+++ b/net/eth.c<br>
@@ -167,8 +167,10 @@ int eth_register(struct eth_device *edev)<br>
<br>
if (edev->get_ethaddr(edev, ethaddr) == 0) {<br>
ethaddr_to_string(ethaddr, ethaddr_str);<br>
- dev_info(dev, "got MAC address from EEPROM: %s\n", ethaddr_str);<br>
- dev_set_param(dev, "ethaddr", ethaddr_str);<br>
+ if (is_valid_ether_addr(ethaddr)) {<br>
+ dev_info(dev, "got MAC address from EEPROM: %s\n", ethaddr_str);<br>
+ dev_set_param(dev, "ethaddr", ethaddr_str);<br>
+ }<br>
}<br>
<br>
if (!eth_current) {<br>
<br>
Sascha<br>
<font color="#888888"><br></font></blockquote><div><br></div><div>Sounds good :)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><font color="#888888">
--<br>
Pengutronix e.K. | |<br>
Industrial Linux Solutions | <a href="http://www.pengutronix.de/" target="_blank">http://www.pengutronix.de/</a> |<br>
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |<br>
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |<br>
</font></blockquote></div><br>