net: dsa: Pass the dsa device to the switch drivers

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>
This commit is contained in:
Andrew Lunn 2016-04-13 02:40:39 +02:00 committed by David S. Miller
parent 71bbe25d01
commit bbb8d79399
8 changed files with 18 additions and 10 deletions

View 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);