aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2019-04-28 13:37:19 -0400
committerDavid S. Miller <davem@davemloft.net>2019-04-28 19:41:01 -0400
commit4dad81ee14479c74973ee669612a367b3a675743 (patch)
treedeb8e24e0569d3e3d5e320f8fc159a5ca019235a
parentc39e2a1d71ade2e59c92280fb2b4daf06b0e240f (diff)
dsa: Add stub tag driver put method
When a DSA switch driver is unloaded, the lock on the tag driver should be released so the module can be unloaded. Add the needed calls, but leave the actual release code as a stub. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> v2 Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/dsa/dsa.c4
-rw-r--r--net/dsa/dsa2.c2
-rw-r--r--net/dsa/dsa_priv.h1
-rw-r--r--net/dsa/legacy.c2
4 files changed, 9 insertions, 0 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 0a68d784ea18..54e89c97ce11 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -137,6 +137,10 @@ const struct dsa_device_ops *dsa_tag_driver_get(int tag_protocol)
137 return ops; 137 return ops;
138} 138}
139 139
140void dsa_tag_driver_put(const struct dsa_device_ops *ops)
141{
142}
143
140static int dev_is_class(struct device *dev, void *class) 144static int dev_is_class(struct device *dev, void *class)
141{ 145{
142 if (dev->class != NULL && !strcmp(dev->class->name, class)) 146 if (dev->class != NULL && !strcmp(dev->class->name, class))
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index ba91bda8bdd3..bbc9f56e89b9 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -335,6 +335,8 @@ static void dsa_port_teardown(struct dsa_port *dp)
335 case DSA_PORT_TYPE_UNUSED: 335 case DSA_PORT_TYPE_UNUSED:
336 break; 336 break;
337 case DSA_PORT_TYPE_CPU: 337 case DSA_PORT_TYPE_CPU:
338 dsa_tag_driver_put(dp->tag_ops);
339 /* fall-through */
338 case DSA_PORT_TYPE_DSA: 340 case DSA_PORT_TYPE_DSA:
339 dsa_port_link_unregister_of(dp); 341 dsa_port_link_unregister_of(dp);
340 break; 342 break;
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index abe3abeb0bb9..ea482e88f7b8 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -85,6 +85,7 @@ struct dsa_slave_priv {
85 85
86/* dsa.c */ 86/* dsa.c */
87const struct dsa_device_ops *dsa_tag_driver_get(int tag_protocol); 87const struct dsa_device_ops *dsa_tag_driver_get(int tag_protocol);
88void dsa_tag_driver_put(const struct dsa_device_ops *ops);
88 89
89bool dsa_schedule_work(struct work_struct *work); 90bool dsa_schedule_work(struct work_struct *work);
90const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops); 91const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops);
diff --git a/net/dsa/legacy.c b/net/dsa/legacy.c
index a8c076250237..219f4fa7ff4b 100644
--- a/net/dsa/legacy.c
+++ b/net/dsa/legacy.c
@@ -163,6 +163,8 @@ static int dsa_switch_setup_one(struct dsa_switch *ds,
163 dst->cpu_dp->dst = dst; 163 dst->cpu_dp->dst = dst;
164 } 164 }
165 165
166 dsa_tag_driver_put(dst->cpu_dp->tag_ops);
167
166 memcpy(ds->rtable, cd->rtable, sizeof(ds->rtable)); 168 memcpy(ds->rtable, cd->rtable, sizeof(ds->rtable));
167 169
168 /* 170 /*