dsa: Add stub tag driver put method
authorAndrew Lunn <andrew@lunn.ch>
Sun, 28 Apr 2019 17:37:19 +0000 (19:37 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 28 Apr 2019 23:41:01 +0000 (19:41 -0400)
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>
net/dsa/dsa.c
net/dsa/dsa2.c
net/dsa/dsa_priv.h
net/dsa/legacy.c

index 0a68d784ea184d1023eda6d032fd5c291fd9ec0b..54e89c97ce114c47d97205ef689091c16565a642 100644 (file)
@@ -137,6 +137,10 @@ const struct dsa_device_ops *dsa_tag_driver_get(int tag_protocol)
        return ops;
 }
 
+void dsa_tag_driver_put(const struct dsa_device_ops *ops)
+{
+}
+
 static int dev_is_class(struct device *dev, void *class)
 {
        if (dev->class != NULL && !strcmp(dev->class->name, class))
index ba91bda8bdd389e02cd57aaffeaed9189537ea6b..bbc9f56e89b9e81885ce01274e17b6e83056f0f0 100644 (file)
@@ -335,6 +335,8 @@ static void dsa_port_teardown(struct dsa_port *dp)
        case DSA_PORT_TYPE_UNUSED:
                break;
        case DSA_PORT_TYPE_CPU:
+               dsa_tag_driver_put(dp->tag_ops);
+               /* fall-through */
        case DSA_PORT_TYPE_DSA:
                dsa_port_link_unregister_of(dp);
                break;
index abe3abeb0bb9587cec19f574940f0920ffb3ada3..ea482e88f7b84e6c66cf44d5a3a40a8cd3ad7b76 100644 (file)
@@ -85,6 +85,7 @@ struct dsa_slave_priv {
 
 /* dsa.c */
 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);
 const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops);
index a8c076250237b5661f0217afea0de1834766cf9d..219f4fa7ff4bb8d7288b4c03d32adb28844a6070 100644 (file)
@@ -163,6 +163,8 @@ static int dsa_switch_setup_one(struct dsa_switch *ds,
                dst->cpu_dp->dst = dst;
        }
 
+       dsa_tag_driver_put(dst->cpu_dp->tag_ops);
+
        memcpy(ds->rtable, cd->rtable, sizeof(ds->rtable));
 
        /*