diff options
| author | Andrew Lunn <andrew@lunn.ch> | 2016-04-12 20:40:40 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2016-04-13 18:15:23 -0400 |
| commit | 7543a6d5359e371ce9434955dbe6a79f548ea321 (patch) | |
| tree | 84401371308e64ff4ca525e410619e5e223e5112 /net/dsa | |
| parent | bbb8d793994c894eef2a48a35fac6de3c6b4fa93 (diff) | |
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 'net/dsa')
| -rw-r--r-- | net/dsa/dsa.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index c06275311cb2..7ef8a92a9e39 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
| @@ -52,7 +52,7 @@ 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 *parent, struct device *host_dev, int sw_addr, | 54 | dsa_switch_probe(struct device *parent, struct device *host_dev, int sw_addr, |
| 55 | char **_name) | 55 | char **_name, void **priv) |
| 56 | { | 56 | { |
| 57 | struct dsa_switch_driver *ret; | 57 | struct dsa_switch_driver *ret; |
| 58 | struct list_head *list; | 58 | struct list_head *list; |
| @@ -67,7 +67,7 @@ dsa_switch_probe(struct device *parent, struct device *host_dev, int sw_addr, | |||
| 67 | 67 | ||
| 68 | drv = list_entry(list, struct dsa_switch_driver, list); | 68 | drv = list_entry(list, struct dsa_switch_driver, list); |
| 69 | 69 | ||
| 70 | name = drv->probe(parent, host_dev, sw_addr); | 70 | name = drv->probe(parent, host_dev, sw_addr, priv); |
| 71 | if (name != NULL) { | 71 | if (name != NULL) { |
| 72 | ret = drv; | 72 | ret = drv; |
| 73 | break; | 73 | break; |
| @@ -384,11 +384,12 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, | |||
| 384 | struct dsa_switch *ds; | 384 | struct dsa_switch *ds; |
| 385 | int ret; | 385 | int ret; |
| 386 | char *name; | 386 | char *name; |
| 387 | void *priv; | ||
| 387 | 388 | ||
| 388 | /* | 389 | /* |
| 389 | * Probe for switch model. | 390 | * Probe for switch model. |
| 390 | */ | 391 | */ |
| 391 | drv = dsa_switch_probe(parent, host_dev, pd->sw_addr, &name); | 392 | drv = dsa_switch_probe(parent, host_dev, pd->sw_addr, &name, &priv); |
| 392 | if (drv == NULL) { | 393 | if (drv == NULL) { |
| 393 | netdev_err(dst->master_netdev, "[%d]: could not detect attached switch\n", | 394 | netdev_err(dst->master_netdev, "[%d]: could not detect attached switch\n", |
| 394 | index); | 395 | index); |
| @@ -409,6 +410,7 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, | |||
| 409 | ds->index = index; | 410 | ds->index = index; |
| 410 | ds->pd = pd; | 411 | ds->pd = pd; |
| 411 | ds->drv = drv; | 412 | ds->drv = drv; |
| 413 | ds->priv = priv; | ||
| 412 | ds->tag_protocol = drv->tag_protocol; | 414 | ds->tag_protocol = drv->tag_protocol; |
| 413 | ds->master_dev = host_dev; | 415 | ds->master_dev = host_dev; |
| 414 | 416 | ||
