netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: David Miller <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>
Subject: [PATCH net-next 10/15] dsa: Rename dsa_resolve_tag_protocol() to _get ready for locking
Date: Thu, 18 Apr 2019 04:31:15 +0200	[thread overview]
Message-ID: <20190418023120.17067-11-andrew@lunn.ch> (raw)
In-Reply-To: <20190418023120.17067-1-andrew@lunn.ch>

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>
---
 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


  parent reply	other threads:[~2019-04-18  2:32 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-18  2:31 [PATCH net-next 00/15] Make DSA tag drivers kernel modules Andrew Lunn
2019-04-18  2:31 ` [PATCH net-next 01/15] dsa: Add SPDX header to tag drivers Andrew Lunn
2019-04-18 17:35   ` Florian Fainelli
2019-04-18  2:31 ` [PATCH net-next 02/15] dsa: Move tagger name into its ops structure Andrew Lunn
2019-04-18 17:37   ` Florian Fainelli
2019-04-18  2:31 ` [PATCH net-next 03/15] dsa: Add MODULE_ALIAS to taggers in preperation to become modules Andrew Lunn
2019-04-19 15:25   ` Florian Fainelli
2019-04-18  2:31 ` [PATCH net-next 04/15] dsa: Add MODULE_LICENSE to tag drivers Andrew Lunn
2019-04-18 17:51   ` Florian Fainelli
2019-04-18  2:31 ` [PATCH net-next 05/15] dsa: Add TAG protocol to tag ops Andrew Lunn
2019-04-19 15:27   ` Florian Fainelli
2019-04-18  2:31 ` [PATCH net-next 06/15] dsa: Remove const from tag driver ops structure Andrew Lunn
2019-04-18 17:58   ` Florian Fainelli
2019-04-18 21:47     ` Andrew Lunn
2019-04-19 15:26       ` Florian Fainelli
2019-04-18  2:31 ` [PATCH net-next 07/15] dsa: Add boilerplate helper to register DSA tag driver modules Andrew Lunn
2019-04-19 15:29   ` Florian Fainelli
2019-04-18  2:31 ` [PATCH net-next 08/15] dsa: Keep link list of tag drivers Andrew Lunn
2019-04-18  7:25   ` David Miller
2019-04-18  9:35   ` Sergei Shtylyov
2019-04-18 13:19     ` Andrew Lunn
2019-04-18 14:40       ` Sergei Shtylyov
2019-04-19 15:30   ` Florian Fainelli
2019-04-18  2:31 ` [PATCH net-next 09/15] dsa: Register the none tagger ops Andrew Lunn
2019-04-19 15:31   ` Florian Fainelli
2019-04-18  2:31 ` Andrew Lunn [this message]
2019-04-19 15:31   ` [PATCH net-next 10/15] dsa: Rename dsa_resolve_tag_protocol() to _get ready for locking Florian Fainelli
2019-04-18  2:31 ` [PATCH net-next 11/15] dsa: Add stub tag driver put method Andrew Lunn
2019-04-19 15:32   ` Florian Fainelli
2019-04-18  2:31 ` [PATCH net-next 12/15] dsa: Make use of the list of tag drivers Andrew Lunn
2019-04-19 15:33   ` Florian Fainelli
2019-04-18  2:31 ` [PATCH net-next 13/15] dsa: Cleanup unneeded table and make tag structures static Andrew Lunn
2019-04-19 15:34   ` Florian Fainelli
2019-04-18  2:31 ` [PATCH net-next 14/15] dsa: Allow tag drivers to be built as modules Andrew Lunn
2019-04-19 15:38   ` Florian Fainelli
2019-04-18  2:31 ` [PATCH net-next 15/15] dsa: tag_brcm: Avoid unused symbols Andrew Lunn
2019-04-19 15:39   ` Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190418023120.17067-11-andrew@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).