net: dsa: Encapsulate legacy switch drivers into dsa_switch_driver

In preparation for making struct dsa_switch_ops const, encapsulate it
within a dsa_switch_driver which has a list pointer and a pointer to
dsa_switch_ops. This allows us to take the list_head pointer out of
dsa_switch_ops, which is written to by {un,}register_switch_driver.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Florian Fainelli
2017-01-08 14:52:07 -08:00
committed by David S. Miller
parent 73095cb188
commit ab3d408d3f
4 changed files with 26 additions and 13 deletions

View File

@@ -240,8 +240,6 @@ struct switchdev_obj_port_mdb;
struct switchdev_obj_port_vlan;
struct dsa_switch_ops {
struct list_head list;
/*
* Probing and setup.
*/
@@ -390,8 +388,13 @@ struct dsa_switch_ops {
int (*cb)(struct switchdev_obj *obj));
};
void register_switch_driver(struct dsa_switch_ops *type);
void unregister_switch_driver(struct dsa_switch_ops *type);
struct dsa_switch_driver {
struct list_head list;
struct dsa_switch_ops *ops;
};
void register_switch_driver(struct dsa_switch_driver *type);
void unregister_switch_driver(struct dsa_switch_driver *type);
struct mii_bus *dsa_host_dev_to_mii_bus(struct device *dev);
static inline bool dsa_uses_tagged_protocol(struct dsa_switch_tree *dst)