From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Ling Pei Lee <pei.lee.ling@intel.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
davem@davemloft.net, Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Marek Behun <marek.behun@nic.cz>,
weifeng.voon@intel.com, vee.khee.wong@linux.intel.com,
vee.khee.wong@intel.com
Subject: Re: [PATCH net-next] net: phy: marvell10g: enable WoL for mv2110
Date: Wed, 23 Jun 2021 21:06:18 +0100 [thread overview]
Message-ID: <20210623200618.GO22278@shell.armlinux.org.uk> (raw)
In-Reply-To: <20210623130929.805559-1-pei.lee.ling@intel.com>
On Wed, Jun 23, 2021 at 09:09:29PM +0800, Ling Pei Lee wrote:
> +static void mv2110_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
> +{
> + int ret = 0;
This initialiser doesn't do anything.
> +
> + wol->supported = WAKE_MAGIC;
> + wol->wolopts = 0;
> +
> + ret = phy_read_mmd(phydev, MDIO_MMD_VEND2, MV_V2_WOL_CTRL);
> +
> + if (ret & MV_V2_WOL_MAGIC_PKT_EN)
> + wol->wolopts |= WAKE_MAGIC;
You need to check whether "ret" is a negative number - if phy_read_mmd()
returns an error, this test could be true or false. It would be better
to have well defined behaviour (e.g. reporting that WOL is disabled?)
> + /* Reset the clear WOL status bit as it does not self-clear */
> + ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2,
> + MV_V2_WOL_CTRL,
> + MV_V2_WOL_CLEAR_STS);
> +
> + if (ret < 0)
> + return ret;
> + } else {
> + /* Disable magic packet matching & reset WOL status bit */
> + ret = phy_modify_mmd(phydev, MDIO_MMD_VEND2,
> + MV_V2_WOL_CTRL,
> + MV_V2_WOL_MAGIC_PKT_EN,
> + MV_V2_WOL_CLEAR_STS);
> +
> + if (ret < 0)
> + return ret;
> +
> + ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2,
> + MV_V2_WOL_CTRL,
> + MV_V2_WOL_CLEAR_STS);
> +
> + if (ret < 0)
> + return ret;
This phy_clear_bits_mmd() is the same as the tail end of the other part
of the if() clause. Consider moving it after the if () { } else { }
statement...
> + }
> +
> + return ret;
and as all paths return "ret" just do:
return phy_clear_bits_mmd(...
I will also need to check whether this is the same as the 88x3310, but
I'm afraid I don't have the energy this evening - please email me a
remind to look at this tomorrow. Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2021-06-23 20:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-23 13:09 [PATCH net-next] net: phy: marvell10g: enable WoL for mv2110 Ling Pei Lee
2021-06-23 20:06 ` Russell King (Oracle) [this message]
2021-06-24 15:27 ` Wong Vee Khee
2021-06-23 21:38 ` Marek Behun
2021-06-24 2:56 ` Wong Vee Khee
2021-06-24 15:34 ` Russell King (Oracle)
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=20210623200618.GO22278@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marek.behun@nic.cz \
--cc=netdev@vger.kernel.org \
--cc=pei.lee.ling@intel.com \
--cc=vee.khee.wong@intel.com \
--cc=vee.khee.wong@linux.intel.com \
--cc=weifeng.voon@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.