ar71xx: pass netdev and miidev pointer to ar71xx_add_device_dsa
authorGabor Juhos <juhosg@openwrt.org>
Sat, 12 Nov 2011 12:09:42 +0000 (12:09 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Sat, 12 Nov 2011 12:09:42 +0000 (12:09 +0000)
SVN-Revision: 28981

target/linux/ar71xx/files/arch/mips/ar71xx/dev-dsa.c
target/linux/ar71xx/files/arch/mips/ar71xx/dev-dsa.h
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr841n.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c

index c2877f2728b6a6a7eddf53d87f5e39a8a15ff454..8b8fcfac3eacc9c7fe9b87bb424d6c43b6fcd7ff 100644 (file)
@@ -22,27 +22,15 @@ static struct platform_device ar71xx_dsa_switch_device = {
        .id             = 0,
 };
 
-void __init ar71xx_add_device_dsa(unsigned int id,
+void __init ar71xx_add_device_dsa(struct device *netdev,
+                                 struct device *miidev,
                                  struct dsa_platform_data *d)
 {
        int i;
 
-       switch (id) {
-       case 0:
-               d->netdev = &ar71xx_eth0_device.dev;
-               break;
-       case 1:
-               d->netdev = &ar71xx_eth1_device.dev;
-               break;
-       default:
-               printk(KERN_ERR
-                       "ar71xx: invalid ethernet id %d for DSA switch\n",
-                       id);
-               return;
-       }
-
+       d->netdev = netdev;
        for (i = 0; i < d->nr_chips; i++)
-               d->chip[i].mii_bus = &ar71xx_mdio_device.dev;
+               d->chip[i].mii_bus = miidev;
 
        ar71xx_dsa_switch_device.dev.platform_data = d;
 
index 2b11882e3270512c94b2842e78e6f2a396e5ebc5..25b988130d97a1452b570eb0e9dd0cb375875bee 100644 (file)
@@ -14,7 +14,8 @@
 
 #include <net/dsa.h>
 
-void ar71xx_add_device_dsa(unsigned int id,
+void ar71xx_add_device_dsa(struct device *netdev,
+                          struct device *miidev,
                           struct dsa_platform_data *d) __init;
 
 #endif /* _AR71XX_DEV_DSA_H */
index e34a8fcc6c16211c86803df0a8ebd96e978a2ffd..4646ada1a319689474d425e52afb0db19cf8133e 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+#include <linux/platform_device.h>
 
 #include <asm/mach-ar71xx/ar71xx.h>
 
@@ -125,8 +126,8 @@ static void __init tl_wr841n_v1_setup(void)
        ar71xx_eth0_data.duplex = DUPLEX_FULL;
 
        ar71xx_add_device_eth(0);
-
-       ar71xx_add_device_dsa(0, &tl_wr841n_v1_dsa_data);
+       ar71xx_add_device_dsa(&ar71xx_eth0_device.dev, &ar71xx_mdio_device.dev,
+                             &tl_wr841n_v1_dsa_data);
 
        ar71xx_add_device_m25p80(&tl_wr841n_v1_flash_data);
 
index 8ca611de6384e18499c70365bc17e9934e2cff2d..2a4b4539aa92416f5ba90434a043cf03bf0eea0a 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+#include <linux/platform_device.h>
 
 #include <asm/mach-ar71xx/ar71xx.h>
 
@@ -130,7 +131,8 @@ static void __init tl_wr941nd_setup(void)
        ar71xx_eth0_data.duplex = DUPLEX_FULL;
 
        ar71xx_add_device_eth(0);
-       ar71xx_add_device_dsa(0, &tl_wr941nd_dsa_data);
+       ar71xx_add_device_dsa(&ar71xx_eth0_device.dev, &ar71xx_mdio_device.dev,
+                             &tl_wr941nd_dsa_data);
 
        ar71xx_add_device_m25p80(&tl_wr941nd_flash_data);