[U-Boot] [PATCH 01/17] Introduce netdev.h header file and remove externs

Haavard Skinnemoen haavard.skinnemoen at atmel.com
Sun Aug 31 16:49:04 CEST 2008


Ben Warren <biggerbadderben at gmail.com> wrote:
> This addresses all drivers whose initializers have already
> been moved to board_eth_init()/cpu_eth_init().
> 
> Signed-off-by: Ben Warren <biggerbadderben at gmail.com>

Nice. There are a few things though...

> ---
>  board/atmel/atngw100/atngw100.c           |    3 +-
>  board/atmel/atstk1000/atstk1000.c         |    3 +-

Three new avr32-based boards are missing: hammerhead, favr-32-ezkit and
mimc200.

I see a new warning:

/home/hskinnemoen/work/u-boot/upstream/include/netdev.h:58: warning: 'pci_eth_init' defined but not used

Also, the drivers should include netdev.h as well, to catch mismatches
when the prototype is changed.

The following patch fixes these three things, as far as avr32 is
concerned at least. Might be a good idea to include netdev.h in the
other drivers too.

diff --git a/board/earthlcd/favr-32-ezkit/favr-32-ezkit.c b/board/earthlcd/favr-32-ezkit/favr-32-ezkit.c
index da69e75..da05589 100644
--- a/board/earthlcd/favr-32-ezkit/favr-32-ezkit.c
+++ b/board/earthlcd/favr-32-ezkit/favr-32-ezkit.c
@@ -18,6 +18,7 @@
  * Place, Suite 330, Boston, MA 02111-1307 USA
  */
 #include <common.h>
+#include <netdev.h>
 
 #include <asm/io.h>
 #include <asm/sdram.h>
@@ -87,8 +88,6 @@ void board_init_info(void)
 }
 
 #if defined(CONFIG_MACB) && defined(CONFIG_CMD_NET)
-extern int macb_eth_initialize(int id, void *regs, unsigned int phy_addr);
-
 int board_eth_init(bd_t *bi)
 {
 	return macb_eth_initialize(0, (void *)MACB0_BASE, bi->bi_phy_id[0]);
diff --git a/board/mimc/mimc200/mimc200.c b/board/mimc/mimc200/mimc200.c
index 4ece11a..8516dcb 100644
--- a/board/mimc/mimc200/mimc200.c
+++ b/board/mimc/mimc200/mimc200.c
@@ -20,6 +20,7 @@
  * MA 02111-1307 USA
  */
 #include <common.h>
+#include <netdev.h>
 
 #include <asm/io.h>
 #include <asm/sdram.h>
@@ -195,8 +196,6 @@ void spi_cs_deactivate(struct spi_slave *slave)
 #endif /* CONFIG_ATMEL_SPI */
 
 #ifdef CONFIG_CMD_NET
-extern int macb_eth_initialize(int id, void *regs, unsigned int phy_addr);
-
 int board_eth_init(bd_t *bi)
 {
 	macb_eth_initialize(0, (void *)MACB0_BASE, bi->bi_phy_id[0]);
diff --git a/board/miromico/hammerhead/hammerhead.c b/board/miromico/hammerhead/hammerhead.c
index 738ece2..d3875f4 100644
--- a/board/miromico/hammerhead/hammerhead.c
+++ b/board/miromico/hammerhead/hammerhead.c
@@ -25,6 +25,7 @@
 #include "../cpu/at32ap/at32ap700x/sm.h"
 
 #include <common.h>
+#include <netdev.h>
 
 #include <asm/io.h>
 #include <asm/sdram.h>
@@ -51,8 +52,6 @@ static const struct sdram_config sdram_config = {
 	.refresh_period	= (781 * (SDRAMC_BUS_HZ / 1000)) / 100000,
 };
 
-extern int macb_eth_initialize(int id, void *regs, unsigned int phy_addr);
-
 #ifdef CONFIG_CMD_NET
 int board_eth_init(bd_t *bis)
 {
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index aa39284..08bebf7 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -40,6 +40,7 @@
  */
 
 #include <net.h>
+#include <netdev.h>
 #include <malloc.h>
 
 #include <linux/mii.h>
diff --git a/include/netdev.h b/include/netdev.h
index a3a717c..610a2db 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -54,7 +54,7 @@ int uli526x_initialize(bd_t *bis);
  * function to initialize whatever's on board.
  * Return value is total # of devices found */
 
-static int pci_eth_init(bd_t *bis)
+static inline int pci_eth_init(bd_t *bis)
 {
 	int num = 0;
 #if defined(CONFIG_ULI526)


More information about the U-Boot mailing list