[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190418023120.17067-11-andrew@lunn.ch>
Date: Thu, 18 Apr 2019 04:31:15 +0200
From: Andrew Lunn <andrew@...n.ch>
To: David Miller <davem@...emloft.net>
Cc: netdev <netdev@...r.kernel.org>,
Florian Fainelli <f.fainelli@...il.com>,
Vivien Didelot <vivien.didelot@...il.com>,
Andrew Lunn <andrew@...n.ch>
Subject: [PATCH net-next 10/15] dsa: Rename dsa_resolve_tag_protocol() to _get ready for locking
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@...n.ch>
---
net/dsa/dsa.c | 2 +-
net/dsa/dsa2.c | 2 +-
net/dsa/dsa_priv.h | 3 ++-
net/dsa/legacy.c | 2 +-
4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index a91c5ac86d86..5e99f291723f 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -127,7 +127,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;
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index d122f1bcdab2..ba91bda8bdd3 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -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);
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 32a063cefe46..d7dbdf06e437 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -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);
diff --git a/net/dsa/legacy.c b/net/dsa/legacy.c
index cb42939db776..a8c076250237 100644
--- a/net/dsa/legacy.c
+++ b/net/dsa/legacy.c
@@ -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);
--
2.20.1
Powered by blists - more mailing lists