diff options
author | Andrew Lunn <andrew@lunn.ch> | 2016-04-13 02:40:40 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-04-13 18:15:23 -0400 |
commit | 7543a6d5359e371ce9434955dbe6a79f548ea321 (patch) | |
tree | 84401371308e64ff4ca525e410619e5e223e5112 /include | |
parent | bbb8d793994c894eef2a48a35fac6de3c6b4fa93 (diff) | |
download | linux-7543a6d5359e371ce9434955dbe6a79f548ea321.tar.bz2 |
net: dsa: Have the switch driver allocate there own private memory
Now the switch devices have a dev pointer, make use of it for allocating
the drivers private data structures using a devm_kzalloc().
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/dsa.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h index 0f9f6f38f255..7bc7bd9b5ded 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -130,6 +130,12 @@ struct dsa_switch { int index; /* + * Give the switch driver somewhere to hang its private data + * structure. + */ + void *priv; + + /* * Tagging protocol understood by this switch */ enum dsa_tag_protocol tag_protocol; @@ -213,7 +219,7 @@ struct dsa_switch_driver { * Probing and setup. */ char *(*probe)(struct device *dsa_dev, struct device *host_dev, - int sw_addr); + int sw_addr, void **priv); 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); @@ -342,7 +348,7 @@ struct mii_bus *dsa_host_dev_to_mii_bus(struct device *dev); static inline void *ds_to_priv(struct dsa_switch *ds) { - return (void *)(ds + 1); + return ds->priv; } static inline bool dsa_uses_tagged_protocol(struct dsa_switch_tree *dst) |