From: Wolfgang Denk Date: Fri, 22 Apr 2011 01:38:06 +0200 Subject: [U-Boot] [PATCH v4 2/5] Add Ethernet hardware MAC address framework to usbnet In-Reply-To: References: <1302748176-4324-1-git-send-email-sjg@chromium.org> <1302748176-4324-2-git-send-email-sjg@chromium.org> <20110418190439.4D1A3D52700@gemini.denx.de> Message-ID: <20110421233806.2D968D52683@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Simon Glass, In message 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.