
Hi Ben,
On 22.06.2010 23:10, Ben Warren wrote:
+int board_eth_init(bd_t *bis) +{
- cpu_eth_init(bis); /* Initialize TSECs first */
I think it's wrong to ignore the return code here.
What makes you think so? What can we do with the return code here? Print warning? If we return error from board_eth_init() calling code will call cpu_eth_init() again which is useless as we have already called it.
Yes, print a warning if < 0. As you've noticed, returning -1 wouldn't be good. I'm not aware of a U-boot policy for handling hardware problems other than printf.
Actually I thought that controllers missing in the "NET: " line would be enough but I'll add a warning if you ask.
- return pci_eth_init(bis);
My understanding is that pci_eth_init() and board_eth_init() return the number of NIC's found - should that number not include the number of successfully initialized TSECs?
Yes, please. Something like:
int board_eth_init(bd_t *bis) { int rc, num_if = 0; if ((rc = cpu_eth_init(bis)) >= 0) { num_if += rc; } else { print error message } if ((rc = pci_eth_init(bis)) >= 0) { num_if += rc; } else { print error message } return num_if; }
I'm working on changing net/eth.c to be less kludgy, but am having a hard time setting up my test bed. Hopefully in the next few days.
I'll do like you proposed.
Regards, Ilya.