]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
net: dsa: Pass the dsa device to the switch drivers
authorAndrew Lunn <andrew@lunn.ch>
Wed, 13 Apr 2016 00:40:39 +0000 (02:40 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 13 Apr 2016 22:15:22 +0000 (18:15 -0400)
By passing a device structure to the switch devices, it allows them
to use devm_* methods for resource management.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/bcm_sf2.c
drivers/net/dsa/mv88e6060.c
drivers/net/dsa/mv88e6123.c
drivers/net/dsa/mv88e6131.c
drivers/net/dsa/mv88e6171.c
drivers/net/dsa/mv88e6352.c
include/net/dsa.h
net/dsa/dsa.c

index 780f228765388c196398fd5f7aef6bb2ca5cd754..18a79579141f433408826f7edf05504c8c02005b 100644 (file)
@@ -135,7 +135,8 @@ static int bcm_sf2_sw_get_sset_count(struct dsa_switch *ds)
        return BCM_SF2_STATS_SIZE;
 }
 
-static char *bcm_sf2_sw_probe(struct device *host_dev, int sw_addr)
+static char *bcm_sf2_sw_probe(struct device *dsa_dev, struct device *host_dev,
+                             int sw_addr)
 {
        return "Broadcom Starfighter 2";
 }
index 0527f485c3dc7c4d1cc689a7707820af993bc68f..34d0f9fe19db5530bed57d83a236042a31b1fbd6 100644 (file)
@@ -57,7 +57,8 @@ static int reg_write(struct dsa_switch *ds, int addr, int reg, u16 val)
                        return __ret;                           \
        })
 
-static char *mv88e6060_probe(struct device *host_dev, int sw_addr)
+static char *mv88e6060_probe(struct device *dsa_dev, struct device *host_dev,
+                            int sw_addr)
 {
        struct mii_bus *bus = dsa_host_dev_to_mii_bus(host_dev);
        int ret;
index 69a6f79dcb10c40950ae99fba09d853ba951199c..ede4c6f0b31ad63252f3ea803b8b7d5ec643d2d9 100644 (file)
@@ -29,7 +29,8 @@ static const struct mv88e6xxx_switch_id mv88e6123_table[] = {
        { PORT_SWITCH_ID_6165_A2, "Marvell 88e6165 (A2)" },
 };
 
-static char *mv88e6123_probe(struct device *host_dev, int sw_addr)
+static char *mv88e6123_probe(struct device *dsa_dev, struct device *host_dev,
+                            int sw_addr)
 {
        return mv88e6xxx_lookup_name(host_dev, sw_addr, mv88e6123_table,
                                     ARRAY_SIZE(mv88e6123_table));
index 24070287c2bcf67e05d027fbb5c1a11a610e25ac..bfadfd2cbb8d53ebe22d10ecc1da54b85c206261 100644 (file)
@@ -25,7 +25,8 @@ static const struct mv88e6xxx_switch_id mv88e6131_table[] = {
        { PORT_SWITCH_ID_6185, "Marvell 88E6185" },
 };
 
-static char *mv88e6131_probe(struct device *host_dev, int sw_addr)
+static char *mv88e6131_probe(struct device *dsa_dev, struct device *host_dev,
+                            int sw_addr)
 {
        return mv88e6xxx_lookup_name(host_dev, sw_addr, mv88e6131_table,
                                     ARRAY_SIZE(mv88e6131_table));
index 0e62f3b5bc81f424610e6287547b8bc541de2826..fb35d3ac1644c6313dd9b64d3b551212feb70f8c 100644 (file)
@@ -24,7 +24,8 @@ static const struct mv88e6xxx_switch_id mv88e6171_table[] = {
        { PORT_SWITCH_ID_6351, "Marvell 88E6351" },
 };
 
-static char *mv88e6171_probe(struct device *host_dev, int sw_addr)
+static char *mv88e6171_probe(struct device *dsa_dev, struct device *host_dev,
+                            int sw_addr)
 {
        return mv88e6xxx_lookup_name(host_dev, sw_addr, mv88e6171_table,
                                     ARRAY_SIZE(mv88e6171_table));
index 7f452e4a04a5aef24a5c41314fbfa5d09e39206b..577ab2cfa944df336f251d18d555a4b7b2632d61 100644 (file)
@@ -37,7 +37,8 @@ static const struct mv88e6xxx_switch_id mv88e6352_table[] = {
        { PORT_SWITCH_ID_6352_A1, "Marvell 88E6352 (A1)" },
 };
 
-static char *mv88e6352_probe(struct device *host_dev, int sw_addr)
+static char *mv88e6352_probe(struct device *dsa_dev, struct device *host_dev,
+                            int sw_addr)
 {
        return mv88e6xxx_lookup_name(host_dev, sw_addr, mv88e6352_table,
                                     ARRAY_SIZE(mv88e6352_table));
index 18d1be3ad62d702f36f3b1238bbfa8622f788762..0f9f6f38f2554800525d3d0616c09dac3ab871c2 100644 (file)
@@ -212,7 +212,8 @@ struct dsa_switch_driver {
        /*
         * Probing and setup.
         */
-       char    *(*probe)(struct device *host_dev, int sw_addr);
+       char    *(*probe)(struct device *dsa_dev, struct device *host_dev,
+                         int sw_addr);
        int     (*setup)(struct dsa_switch *ds);
        int     (*set_addr)(struct dsa_switch *ds, u8 *addr);
        u32     (*get_phy_flags)(struct dsa_switch *ds, int port);
index c28c47463b7edfc58b08e2d059e0e69b66a3fff7..c06275311cb23e0b3a3435210253608ca137cce5 100644 (file)
@@ -51,7 +51,8 @@ void unregister_switch_driver(struct dsa_switch_driver *drv)
 EXPORT_SYMBOL_GPL(unregister_switch_driver);
 
 static struct dsa_switch_driver *
-dsa_switch_probe(struct device *host_dev, int sw_addr, char **_name)
+dsa_switch_probe(struct device *parent, struct device *host_dev, int sw_addr,
+                char **_name)
 {
        struct dsa_switch_driver *ret;
        struct list_head *list;
@@ -66,7 +67,7 @@ dsa_switch_probe(struct device *host_dev, int sw_addr, char **_name)
 
                drv = list_entry(list, struct dsa_switch_driver, list);
 
-               name = drv->probe(host_dev, sw_addr);
+               name = drv->probe(parent, host_dev, sw_addr);
                if (name != NULL) {
                        ret = drv;
                        break;
@@ -387,7 +388,7 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
        /*
         * Probe for switch model.
         */
-       drv = dsa_switch_probe(host_dev, pd->sw_addr, &name);
+       drv = dsa_switch_probe(parent, host_dev, pd->sw_addr, &name);
        if (drv == NULL) {
                netdev_err(dst->master_netdev, "[%d]: could not detect attached switch\n",
                           index);