dsa: Rename dsa_resolve_tag_protocol() to _get ready for locking
authorAndrew Lunn <andrew@lunn.ch>
Sun, 28 Apr 2019 17:37:18 +0000 (19:37 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 28 Apr 2019 23:41:01 +0000 (19:41 -0400)
dsa_resolve_tag_protocol() is used to find the tagging driver needed
by a switch driver. When the tagging drivers become modules, it will
be necassary to take a reference on the module to prevent it being
unloaded. So rename this function to _get() to indicate it has some
locking properties.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
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 71907acd8f82f2a96b47f8595cec052a54c34a3e..0a68d784ea184d1023eda6d032fd5c291fd9ec0b 100644 (file)
@@ -123,7 +123,7 @@ const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops)
        return ops->name;
 };
 
-const struct dsa_device_ops *dsa_resolve_tag_protocol(int tag_protocol)
+const struct dsa_device_ops *dsa_tag_driver_get(int tag_protocol)
 {
        const struct dsa_device_ops *ops;
 
index d122f1bcdab2d054a829f6a0c4149c759be13994..ba91bda8bdd389e02cd57aaffeaed9189537ea6b 100644 (file)
@@ -577,7 +577,7 @@ static int dsa_port_parse_cpu(struct dsa_port *dp, struct net_device *master)
        enum dsa_tag_protocol tag_protocol;
 
        tag_protocol = ds->ops->get_tag_protocol(ds, dp->index);
-       tag_ops = dsa_resolve_tag_protocol(tag_protocol);
+       tag_ops = dsa_tag_driver_get(tag_protocol);
        if (IS_ERR(tag_ops)) {
                dev_warn(ds->dev, "No tagger for this switch\n");
                return PTR_ERR(tag_ops);
index 093b7d145eb14d7c8b581c1f1438fa270d9800e4..abe3abeb0bb9587cec19f574940f0920ffb3ada3 100644 (file)
@@ -84,7 +84,8 @@ struct dsa_slave_priv {
 };
 
 /* dsa.c */
-const struct dsa_device_ops *dsa_resolve_tag_protocol(int tag_protocol);
+const struct dsa_device_ops *dsa_tag_driver_get(int tag_protocol);
+
 bool dsa_schedule_work(struct work_struct *work);
 const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops);
 
index cb42939db7767bf1fc748c5da7b0f76a135a1171..a8c076250237b5661f0217afea0de1834766cf9d 100644 (file)
@@ -152,7 +152,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds,
                enum dsa_tag_protocol tag_protocol;
 
                tag_protocol = ops->get_tag_protocol(ds, dst->cpu_dp->index);
-               tag_ops = dsa_resolve_tag_protocol(tag_protocol);
+               tag_ops = dsa_tag_driver_get(tag_protocol);
                if (IS_ERR(tag_ops))
                        return PTR_ERR(tag_ops);