From patchwork Sat Apr 27 17:00:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 1092068 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lunn.ch Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=lunn.ch header.i=@lunn.ch header.b="PavR/LfO"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44ry5D1Qxtz9s4V for ; Sun, 28 Apr 2019 03:06:56 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726074AbfD0RGz (ORCPT ); Sat, 27 Apr 2019 13:06:55 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:46760 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725974AbfD0RGy (ORCPT ); Sat, 27 Apr 2019 13:06:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=MXeOxh1KRjIAHlGTTWNfvBLliZrFuRMqKtxu397lf1o=; b=PavR/LfOgQSMRSIO7PaZsaUNGi KBwLlGPWVvRfeJERENthGMeaYkmQFc5PxpSxMb+O/DBXG+psBjDoIeSpAarb7fma4sp4rmyw2m2c2 10/jxH3fUdZOPHzDb2FHe+CSk9d7mrkIb/Ou97zGQ/A8k97/1zftkpl+yr2G/0tGGV2c=; Received: from andrew by vps0.lunn.ch with local (Exim 4.89) (envelope-from ) id 1hKQgr-00030V-Uu; Sat, 27 Apr 2019 19:00:41 +0200 From: Andrew Lunn To: David Miller Cc: netdev , Florian Fainelli , Vivien Didelot , Andrew Lunn Subject: [PATCH v3 net-next 09/14] dsa: Rename dsa_resolve_tag_protocol() to _get ready for locking Date: Sat, 27 Apr 2019 19:00:30 +0200 Message-Id: <20190427170035.11479-10-andrew@lunn.ch> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190427170035.11479-1-andrew@lunn.ch> References: <20190427170035.11479-1-andrew@lunn.ch> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Reviewed-by: Florian Fainelli --- 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 71907acd8f82..0a68d784ea18 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -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; 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 093b7d145eb1..abe3abeb0bb9 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);