From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Wed, 11 Feb 2009 17:22:42 +0100 Subject: [U-Boot] [PATCH] ppc4xx: Fix problem with board_eth_init() vs cpu_eth_init() on AMCC boards In-Reply-To: <200902111436.38210.sr@denx.de> References: <1234342325-28950-1-git-send-email-sr@denx.de> <200902111352.04598.sr@denx.de> <20090211130259.5AFAD832E893@gemini.denx.de> <200902111436.38210.sr@denx.de> Message-ID: <20090211162242.3CD85832E893@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 Stefan Roese, In message <200902111436.38210.sr@denx.de> you wrote: > > pci_eth_init() is called to add additional *optional* network interfaces. > Since PCI boards may or may not exist, I think that a non existant PCI > ethernet device should not result in an error. > > What sort of error handling do you have in mind here? I don;t know. I just see that pci_eth_init() is declared to return "int". If the return value is not used, we should make the function void. > > > /* Try board-specific initialization first. If it fails or isn't > > > * present, try the cpu-specific initialization */ > > > if (board_eth_init(bis) < 0) > > > cpu_eth_init(bis); > > > > I think we must differentiate between board_eth_init() not existing > > and a failure in board_eth_init(); these are two very different > > situations. > > board_eth_init() not existing is the default. We have a weak implementation > for board_eth_init() in eth.c: > > /* > * CPU and board-specific Ethernet initializations. Aliased function > * signals caller to move on > */ > static int __def_eth_init(bd_t *bis) > { > return -1; > } > int cpu_eth_init(bd_t *bis) __attribute((weak, alias("__def_eth_init"))); > int board_eth_init(bd_t *bis) __attribute((weak, alias("__def_eth_init"))); > > > What change do you have in mind here? I don't understand the intended logic. As far as I can see, pci_eth_init() will return the number of initialized boards, i. e. a non-negative value. Then having board_eth_init() reuturn the same return code should be no problem - you get -1 (i. e. < 0) if board_eth_init() does not exist, and >= 0 else. 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 No journaling file system can recover your data if the disk dies. - Steve Rago in