From: Andrew Lunn <andrew@lunn•ch>
To: Piergiorgio Beruto <piergiorgio.beruto@gmail•com>
Cc: Heiner Kallweit <hkallweit1@gmail•com>,
Russell King <linux@armlinux•org.uk>,
"David S. Miller" <davem@davemloft•net>,
Eric Dumazet <edumazet@google•com>,
Jakub Kicinski <kuba@kernel•org>, Paolo Abeni <pabeni@redhat•com>,
linux-kernel@vger•kernel.org, netdev@vger•kernel.org,
Oleksij Rempel <o.rempel@pengutronix•de>,
mailhol.vincent@wanadoo•fr, sudheer.mogilappagari@intel•com,
sbhatta@marvell•com, linux-doc@vger•kernel.org,
wangjie125@huawei•com, corbet@lwn•net, lkp@intel•com,
gal@nvidia•com, gustavoars@kernel•org
Subject: Re: [PATCH v2 net-next 3/5] drivers/net/phy: add connection between ethtool and phylib for PLCA
Date: Sat, 7 Jan 2023 18:37:52 +0100 [thread overview]
Message-ID: <Y7mt8IUUbMv6bt5v@lunn.ch> (raw)
In-Reply-To: <9a25328bcf2c0d963e34d33ff0968f83755905f4.1673030528.git.piergiorgio.beruto@gmail.com>
> + // if not enabling PLCA, skip a few sanity checks
> + if (plca_cfg->enabled <= 0)
> + goto apply_cfg;
> +
> + if (!linkmode_test_bit(ETHTOOL_LINK_MODE_10baseT1S_P2MP_Half_BIT,
> + phydev->advertising)) {
> + ret = -EOPNOTSUPP;
> + NL_SET_ERR_MSG(extack,
> + "Point to Multi-Point mode is not enabled");
> + }
> +
> + // allow setting node_id concurrently with enabled
> + if (plca_cfg->node_id >= 0)
> + curr_plca_cfg->node_id = plca_cfg->node_id;
> +
> + if (curr_plca_cfg->node_id >= 255) {
> + NL_SET_ERR_MSG(extack, "PLCA node ID is not set");
> + ret = -EINVAL;
> + goto out_drv;
> + }
> +
> +apply_cfg:
> + ret = phydev->drv->set_plca_cfg(phydev, plca_cfg);
Goto which don't jump to the end of the function is generally frowned
upon. I suggest you put these sanity checks into a little helper, so
you can avoid the goto.
With that change make, feel free to add my reviewed-by.
Andrew
next prev parent reply other threads:[~2023-01-07 17:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-06 18:43 [PATCH v2 net-next 0/5] add PLCA RS support and onsemi NCN26000 Piergiorgio Beruto
2023-01-06 18:44 ` [PATCH v2 net-next 1/5] net/ethtool: add netlink interface for the PLCA RS Piergiorgio Beruto
2023-01-07 17:29 ` Andrew Lunn
2023-01-06 18:44 ` [PATCH v2 net-next 2/5] drivers/net/phy: add the link modes for the 10BASE-T1S Ethernet PHY Piergiorgio Beruto
2023-01-07 17:31 ` Andrew Lunn
2023-01-06 18:45 ` [PATCH v2 net-next 3/5] drivers/net/phy: add connection between ethtool and phylib for PLCA Piergiorgio Beruto
2023-01-07 17:37 ` Andrew Lunn [this message]
2023-01-08 23:48 ` Piergiorgio Beruto
2023-01-06 18:45 ` [PATCH v2 net-next 4/5] drivers/net/phy: add helpers to get/set PLCA configuration Piergiorgio Beruto
2023-01-07 18:07 ` Andrew Lunn
2023-01-08 23:50 ` Piergiorgio Beruto
2023-01-06 18:45 ` [PATCH v2 net-next 5/5] drivers/net/phy: add driver for the onsemi NCN26000 10BASE-T1S PHY Piergiorgio Beruto
2023-01-07 18:23 ` Andrew Lunn
2023-01-08 23:57 ` Piergiorgio Beruto
2023-01-09 13:31 ` Andrew Lunn
2023-01-09 14:21 ` Piergiorgio Beruto
2023-01-09 14:24 ` Andrew Lunn
2023-01-09 17:12 ` Piergiorgio Beruto
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=Y7mt8IUUbMv6bt5v@lunn.ch \
--to=andrew@lunn$(echo .)ch \
--cc=corbet@lwn$(echo .)net \
--cc=davem@davemloft$(echo .)net \
--cc=edumazet@google$(echo .)com \
--cc=gal@nvidia$(echo .)com \
--cc=gustavoars@kernel$(echo .)org \
--cc=hkallweit1@gmail$(echo .)com \
--cc=kuba@kernel$(echo .)org \
--cc=linux-doc@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux@armlinux$(echo .)org.uk \
--cc=lkp@intel$(echo .)com \
--cc=mailhol.vincent@wanadoo$(echo .)fr \
--cc=netdev@vger$(echo .)kernel.org \
--cc=o.rempel@pengutronix$(echo .)de \
--cc=pabeni@redhat$(echo .)com \
--cc=piergiorgio.beruto@gmail$(echo .)com \
--cc=sbhatta@marvell$(echo .)com \
--cc=sudheer.mogilappagari@intel$(echo .)com \
--cc=wangjie125@huawei$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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