public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: David Decotigny <ddecotig@gmail.com>
Cc: Amir Vadai <amirv@mellanox.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-api@vger.kernel.org, David Decotigny <decot@googlers.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jason Wang <jasowang@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Masatake YAMATO <yamato@redhat.com>, Xi Wang <xii@google.com>,
	Neil Horman <nhorman@tuxdriver.com>,
	WANG Cong <xiyou.wangcong@gmail.com>,
	Flavio Leitner <fbl@redhat.com>, Tom Gundersen <teg@jklm.no>,
	Jiri Pirko <jiri@resnulli.us>,
	Vlad Yasevich <vyasevic@redhat.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Saeed Mahameed <saeedm@mellanox.com>,
	Venkata Duvvuru <VenkatKumar.Duvvuru@Emulex.Com>,
	Govindarajulu Varadarajan <_govind@gmx.com>
Subject: Re: [PATCH net-next v1 2/7] net: phy: extend link mode support to 48 bits
Date: Sun, 04 Jan 2015 22:03:49 +0000	[thread overview]
Message-ID: <1420409029.5686.147.camel@decadent.org.uk> (raw)
In-Reply-To: <1420405017-23278-3-git-send-email-ddecotig@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2158 bytes --]

On Sun, 2015-01-04 at 12:56 -0800, David Decotigny wrote:
> From: David Decotigny <decot@googlers.com>
> 
> Signed-off-by: David Decotigny <decot@googlers.com>
> ---
>  drivers/net/phy/phy.c        | 29 ++++++++++++++---------------
>  drivers/net/phy/phy_device.c |  4 ++--
>  include/linux/phy.h          | 10 +++++-----
>  3 files changed, 21 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 767cd11..e9c8499 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
[...]
> @@ -245,7 +246,7 @@ static inline unsigned int phy_find_valid(unsigned int idx, u32 features)
>   */
>  static void phy_sanitize_settings(struct phy_device *phydev)
>  {
> -	u32 features = phydev->supported;
> +	ethtool_link_mode_mask_t features = phydev->supported;
>  	unsigned int idx;
>  
>  	/* Sanitize settings based on PHY capabilities */
> @@ -279,13 +280,13 @@ int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd)
>  		return -EINVAL;
>  
>  	/* We make sure that we don't pass unsupported values in to the PHY */
> -	cmd->advertising &= phydev->supported;
> +	phydev->advertising = ethtool_cmd_advertising(cmd) & phydev->supported;

phydev->advertising should not be changed until after the following
validation.  Use a local variable for this.

>  	/* Verify the settings we care about. */
>  	if (cmd->autoneg != AUTONEG_ENABLE && cmd->autoneg != AUTONEG_DISABLE)
>  		return -EINVAL;
>  
> -	if (cmd->autoneg == AUTONEG_ENABLE && cmd->advertising == 0)
> +	if (cmd->autoneg == AUTONEG_ENABLE && phydev->advertising == 0)
>  		return -EINVAL;
>  
>  	if (cmd->autoneg == AUTONEG_DISABLE &&
> @@ -300,8 +301,6 @@ int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd)
>  
>  	phydev->speed = speed;
>  
> -	phydev->advertising = cmd->advertising;
> -
>  	if (AUTONEG_ENABLE == cmd->autoneg)
>  		phydev->advertising |= ADVERTISED_Autoneg;
>  	else
[...]

The assignment to phydev->advertising should probably remain here.

Ben.

-- 
Ben Hutchings
This sentence contradicts itself - no actually it doesn't.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

  reply	other threads:[~2015-01-04 22:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-04 20:56 [PATCH net-next v1 0/7] net: extend ethtool link mode bitmaps to 48 bits David Decotigny
2015-01-04 20:56 ` [PATCH net-next v1 1/7] net: ethtool: extend link mode support " David Decotigny
2015-01-04 22:01   ` Ben Hutchings
2015-01-04 20:56 ` [PATCH net-next v1 2/7] net: phy: " David Decotigny
2015-01-04 22:03   ` Ben Hutchings [this message]
2015-01-04 20:56 ` [PATCH net-next v1 3/7] net: mii: " David Decotigny
2015-01-04 20:56 ` [PATCH net-next v1 4/7] net: mdio: " David Decotigny
2015-01-04 20:56 ` [PATCH net-next v1 5/7] net: veth: " David Decotigny
2015-01-04 20:56 ` [PATCH net-next v1 6/7] net: tun: " David Decotigny
2015-01-04 20:56 ` [PATCH net-next v1 7/7] net: mlx4_en: " David Decotigny
2015-01-04 21:55 ` [PATCH net-next v1 0/7] net: extend ethtool link mode bitmaps " Ben Hutchings
2015-01-05  0:34   ` Maciej Żenczykowski
2015-01-05  2:30     ` Ben Hutchings
2015-01-05 18:16       ` David Decotigny

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=1420409029.5686.147.camel@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=VenkatKumar.Duvvuru@Emulex.Com \
    --cc=_govind@gmx.com \
    --cc=amirv@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=ddecotig@gmail.com \
    --cc=decot@googlers.com \
    --cc=ebiederm@xmission.com \
    --cc=f.fainelli@gmail.com \
    --cc=fbl@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jasowang@redhat.com \
    --cc=jiri@resnulli.us \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=saeedm@mellanox.com \
    --cc=teg@jklm.no \
    --cc=viro@zeniv.linux.org.uk \
    --cc=vyasevic@redhat.com \
    --cc=xii@google.com \
    --cc=xiyou.wangcong@gmail.com \
    --cc=yamato@redhat.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