Commit 4dad81ee authored by Andrew Lunn's avatar Andrew Lunn Committed by David S. Miller

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: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>

v2
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c39e2a1d
...@@ -137,6 +137,10 @@ const struct dsa_device_ops *dsa_tag_driver_get(int tag_protocol) ...@@ -137,6 +137,10 @@ const struct dsa_device_ops *dsa_tag_driver_get(int tag_protocol)
return ops; return ops;
} }
void dsa_tag_driver_put(const struct dsa_device_ops *ops)
{
}
static int dev_is_class(struct device *dev, void *class) static int dev_is_class(struct device *dev, void *class)
{ {
if (dev->class != NULL && !strcmp(dev->class->name, class)) if (dev->class != NULL && !strcmp(dev->class->name, class))
......
...@@ -335,6 +335,8 @@ static void dsa_port_teardown(struct dsa_port *dp) ...@@ -335,6 +335,8 @@ static void dsa_port_teardown(struct dsa_port *dp)
case DSA_PORT_TYPE_UNUSED: case DSA_PORT_TYPE_UNUSED:
break; break;
case DSA_PORT_TYPE_CPU: case DSA_PORT_TYPE_CPU:
dsa_tag_driver_put(dp->tag_ops);
/* fall-through */
case DSA_PORT_TYPE_DSA: case DSA_PORT_TYPE_DSA:
dsa_port_link_unregister_of(dp); dsa_port_link_unregister_of(dp);
break; break;
......
...@@ -85,6 +85,7 @@ struct dsa_slave_priv { ...@@ -85,6 +85,7 @@ struct dsa_slave_priv {
/* dsa.c */ /* dsa.c */
const struct dsa_device_ops *dsa_tag_driver_get(int tag_protocol); const struct dsa_device_ops *dsa_tag_driver_get(int tag_protocol);
void dsa_tag_driver_put(const struct dsa_device_ops *ops);
bool dsa_schedule_work(struct work_struct *work); bool dsa_schedule_work(struct work_struct *work);
const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops); const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops);
......
...@@ -163,6 +163,8 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, ...@@ -163,6 +163,8 @@ static int dsa_switch_setup_one(struct dsa_switch *ds,
dst->cpu_dp->dst = dst; dst->cpu_dp->dst = dst;
} }
dsa_tag_driver_put(dst->cpu_dp->tag_ops);
memcpy(ds->rtable, cd->rtable, sizeof(ds->rtable)); memcpy(ds->rtable, cd->rtable, sizeof(ds->rtable));
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment