diff options
author | David S. Miller <davem@davemloft.net> | 2016-04-13 18:15:24 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-04-13 18:15:24 -0400 |
commit | 99717bdfdbeaaf387ba6ecbf7eba7fbb7a47e50a (patch) | |
tree | 502d26a5f6e655a657f4280b98ac257d83adeaf4 /include | |
parent | 71bbe25d01fa4f35551ff7bffc3e03ddd3e960cd (diff) | |
parent | c156913b5d62cbaa0e3be29409de562b7d2e006e (diff) | |
download | talos-obmc-linux-99717bdfdbeaaf387ba6ecbf7eba7fbb7a47e50a.tar.gz talos-obmc-linux-99717bdfdbeaaf387ba6ecbf7eba7fbb7a47e50a.zip |
Merge branch 'dsa-refactoring-set-1'
Andrew Lunn says:
====================
DSA refactoring: set 1
There has been a long running effort to refractor DSA probing to make
the switches true linux devices. Here are a small collection of
patches moving in this direction. Most have been seen before.
We take a little step forward by passing the dsa device point to the
driver, thus allowing it to perform resource allocations using the
normal mechanisms. This device structure will later be replaced by the
devices own device structure.
Future patches will add a true driver probe function, so we rename the
current probe function, cleaning up the namespace.
phys_port_mask continually confuses me, thinking it is about PHYs. But
it is actually about ports enabled to the outside world. So rename it to
enabled_port_mask.
Lots more patches yet to follow, this is just doing some ground work.
v2:
enabled_port_mask instread of user_port_masks
Added Tested-by's and Reviewed-by.
====================
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/dsa.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h index 18d1be3ad62d..689ebd3542ba 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; @@ -161,7 +167,7 @@ struct dsa_switch { * Slave mii_bus and devices for the individual ports. */ u32 dsa_port_mask; - u32 phys_port_mask; + u32 enabled_port_mask; u32 phys_mii_mask; struct mii_bus *slave_mii_bus; struct net_device *ports[DSA_MAX_PORTS]; @@ -179,7 +185,7 @@ static inline bool dsa_is_dsa_port(struct dsa_switch *ds, int p) static inline bool dsa_is_port_initialized(struct dsa_switch *ds, int p) { - return ds->phys_port_mask & (1 << p) && ds->ports[p]; + return ds->enabled_port_mask & (1 << p) && ds->ports[p]; } static inline u8 dsa_upstream_port(struct dsa_switch *ds) @@ -207,12 +213,12 @@ struct dsa_switch_driver { struct list_head list; enum dsa_tag_protocol tag_protocol; - int priv_size; /* * 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, 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); @@ -341,7 +347,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) |