[U-Boot] [PATCH v4 2/5] Add Ethernet hardware MAC address framework to usbnet

Wolfgang Denk wd at denx.de
Fri Apr 22 01:38:06 CEST 2011


Dear Simon Glass,

In message <BANLkTikGucjpun2RhS2T2Nyq4_KB9gK8zw at mail.gmail.com> you wrote:
>
> >> +             eth = &usb_eth[usb_max_eth_dev].eth_dev;
> >
> > Index for eth is usb_max_eth_dev.
> >
> >> @@ -100,7 +102,10 @@ static void probe_valid_drivers(struct usb_device *> dev)
> >>                        * call since eth_current_> changed (internally called)
> >>                        * relies on it
> >>                        */
> >> -                     eth_register(&usb_eth[usb_max_eth_dev - 1].eth_dev);
> >> +                     eth_register(eth);
> >
> > You change the behaviour here.  Please confirmt his is really
> > intentional.
>
> Yes. Since I am using an 'eth' pointer I don't need to index the array
> again. The behaviour is the same as before.

No, it is not.  Before, we were accessing entry N-1 here. Now we use
entry N.  usb_max_eth_dev != usb_max_eth_dev - 1

> >> + *   base_name - base name for device (NULL for "eth")
> >
> > This is an atitifical decision for the API which is difficult to
> > understand.  It just makes the code and understanding it more
> > difficult.  Just pass "eth" when you mean it.
>
> The intention was to avoid everyone having to pass the correct value -
> potential for error, etc. I could have created a #define, but decided
> on this.

Ummm... but having everyone to pass the correct value is actually a
really good thing to have!


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
When a child is taught ... its programmed with simple instructions --
and at some point, if its mind develops properly, it exceeds the  sum
of what it was taught, thinks independently.
	-- Dr. Richard Daystrom, "The Ultimate Computer",
	   stardate 4731.3.


More information about the U-Boot mailing list