diff options
author | Andrew Lunn <andrew@lunn.ch> | 2016-04-12 20:40:39 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-04-13 18:15:22 -0400 |
commit | bbb8d793994c894eef2a48a35fac6de3c6b4fa93 (patch) | |
tree | b77344abffc2f441f5a2a17f6a8852df63519e06 /net/dsa | |
parent | 71bbe25d01fa4f35551ff7bffc3e03ddd3e960cd (diff) |
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>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/dsa.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index c28c47463b7e..c06275311cb2 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
@@ -51,7 +51,8 @@ void unregister_switch_driver(struct dsa_switch_driver *drv) | |||
51 | EXPORT_SYMBOL_GPL(unregister_switch_driver); | 51 | EXPORT_SYMBOL_GPL(unregister_switch_driver); |
52 | 52 | ||
53 | static struct dsa_switch_driver * | 53 | static struct dsa_switch_driver * |
54 | dsa_switch_probe(struct device *host_dev, int sw_addr, char **_name) | 54 | dsa_switch_probe(struct device *parent, struct device *host_dev, int sw_addr, |
55 | char **_name) | ||
55 | { | 56 | { |
56 | struct dsa_switch_driver *ret; | 57 | struct dsa_switch_driver *ret; |
57 | struct list_head *list; | 58 | struct list_head *list; |
@@ -66,7 +67,7 @@ dsa_switch_probe(struct device *host_dev, int sw_addr, char **_name) | |||
66 | 67 | ||
67 | drv = list_entry(list, struct dsa_switch_driver, list); | 68 | drv = list_entry(list, struct dsa_switch_driver, list); |
68 | 69 | ||
69 | name = drv->probe(host_dev, sw_addr); | 70 | name = drv->probe(parent, host_dev, sw_addr); |
70 | if (name != NULL) { | 71 | if (name != NULL) { |
71 | ret = drv; | 72 | ret = drv; |
72 | break; | 73 | break; |
@@ -387,7 +388,7 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, | |||
387 | /* | 388 | /* |
388 | * Probe for switch model. | 389 | * Probe for switch model. |
389 | */ | 390 | */ |
390 | drv = dsa_switch_probe(host_dev, pd->sw_addr, &name); | 391 | drv = dsa_switch_probe(parent, host_dev, pd->sw_addr, &name); |
391 | if (drv == NULL) { | 392 | if (drv == NULL) { |
392 | netdev_err(dst->master_netdev, "[%d]: could not detect attached switch\n", | 393 | netdev_err(dst->master_netdev, "[%d]: could not detect attached switch\n", |
393 | index); | 394 | index); |