From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: jiri@resnulli.us, Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@savoirfairelinux.com>,
"David S. Miller" <davem@davemloft.net>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net] net: dsa: Do not register devlink for unused ports
Date: Thu, 17 May 2018 15:29:21 -0700 [thread overview]
Message-ID: <2459d343-9185-b2b9-4e06-7f6d0bca46e4@gmail.com> (raw)
In-Reply-To: <20180517221626.13045-1-f.fainelli@gmail.com>
On 05/17/2018 03:16 PM, Florian Fainelli wrote:
> Even if commit 1d27732f411d ("net: dsa: setup and teardown ports") indicated
> that registering a devlink instance for unused ports is not a problem, and this
> is true, this can be confusing nonetheless, so let's not do it.
>
> Fixes: 1d27732f411d ("net: dsa: setup and teardown ports")
> Reported-by: Jiri Pirko <jiri@resnulli.us>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> net/dsa/dsa2.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
> index adf50fbc4c13..cc45a8ca45fb 100644
> --- a/net/dsa/dsa2.c
> +++ b/net/dsa/dsa2.c
> @@ -262,13 +262,14 @@ static int dsa_port_setup(struct dsa_port *dp)
>
> memset(&dp->devlink_port, 0, sizeof(dp->devlink_port));
>
> + if (dp->type == DSA_PORT_TYPE_UNUSED)
> + return 0;
> +
> err = devlink_port_register(ds->devlink, &dp->devlink_port, dp->index);
> if (err)
> return err;
>
> switch (dp->type) {
> - case DSA_PORT_TYPE_UNUSED:
> - break;
> case DSA_PORT_TYPE_CPU:
> case DSA_PORT_TYPE_DSA:
> err = dsa_port_link_register_of(dp);
> @@ -293,11 +294,12 @@ static int dsa_port_setup(struct dsa_port *dp)
>
> static void dsa_port_teardown(struct dsa_port *dp)
> {
> + if (dp->type == DSA_PORT_TYPE_UNUSED)
> + return;
> +
> devlink_port_unregister(&dp->devlink_port);
>
> switch (dp->type) {
> - case DSA_PORT_TYPE_UNUSED:
> - break;
Actually those should be kept in there in order not to generate a
warning about DSA_PORT_TYPE_UNUSED not being handled by the switch()
case statement, I will resubmit that shortly, or we could even move the
registration until after, either way is likely fine.
--
Florian
prev parent reply other threads:[~2018-05-17 22:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-17 22:16 [PATCH net] net: dsa: Do not register devlink for unused ports Florian Fainelli
2018-05-17 22:29 ` Florian Fainelli [this message]
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=2459d343-9185-b2b9-4e06-7f6d0bca46e4@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=jiri@resnulli.us \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@savoirfairelinux.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).