From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Warren Date: Mon, 27 Jul 2009 15:17:34 -0700 Subject: [U-Boot] [PATCH][Net] Convert SMC91111 Ethernet driver toCONFIG_NET_MULTI API In-Reply-To: <200907271816.27170.rgetz@blackfin.uclinux.org> References: <1248731002-6054-1-git-send-email-biggerbadderben@gmail.com> <200907271816.27170.rgetz@blackfin.uclinux.org> Message-ID: <4A6E277E.4020405@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Robin, Robin Getz wrote: > On Mon 27 Jul 2009 17:43, Ben Warren pondered: > >> All in-tree boards that use this controller have CONFIG_NET_MULTI >> added >> > > First - thanks. > > Second - It's a style thing, but... > > >> --- >> board/bf533-ezkit/bf533-ezkit.c | 12 + >> include/netdev.h | 1 + >> 71 files changed, 888 insertions(+), 490 deletions(-) >> > [snip] > >> diff --git a/board/bf533-ezkit/bf533-ezkit.c >> b/board/bf533-ezkit/bf533-ezkit.c >> index d5f0b7c..ff0e15e 100644 >> --- a/board/bf533-ezkit/bf533-ezkit.c >> +++ b/board/bf533-ezkit/bf533-ezkit.c >> @@ -26,6 +26,7 @@ >> */ >> >> #include >> +#include >> #include "psd4256.h" >> #include "flash-defines.h" >> >> @@ -57,3 +58,14 @@ int misc_init_r(void) >> >> return 0; >> } >> + >> +#ifdef CONFIG_CMD_NET >> +int board_eth_init(bd_t *bis) >> +{ >> + int rc = 0; >> +#ifdef CONFIG_SMC91111 >> + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); >> +#endif >> + return rc; >> +} >> +#endif >> > [snip] > >> diff --git a/include/netdev.h b/include/netdev.h >> index 3e66586..4636b57 100644 >> --- a/include/netdev.h >> +++ b/include/netdev.h >> @@ -73,6 +73,7 @@ int rtl8169_initialize(bd_t *bis); >> int scc_initialize(bd_t *bis); >> int skge_initialize(bd_t *bis); >> int smc911x_initialize(u8 dev_num, int base_addr); >> +int smc91111_initialize(u8 dev_num, int base_addr); >> int tsi108_eth_initialize(bd_t *bis); >> int uec_initialize(int index); >> int uec_standard_init(bd_t *bis); >> > > would be alot less ifdefs if you put it in the header file... > > #ifdef CONFIG_SMC91111 > int smc91111_initialize(u8 dev_num, int base_addr); > #else > #define smc91111_initialize(dev_num, base_addr) 0 > #endif > > that would remove all the "ifdef CONFIG_SMC91111" in all the board files... > > also would not be required to set the initial value anymore either... > > -Robin > I actually like to have them in the board C code. To the casual observer, it is obvious that certain ethernet controllers are optional, whereas if all they see is a string of initialization functions for different chips they might say, "WTF?". regards, Ben