diff mbox series

net: phylink: update to use phy_support_asym_pause()

Message ID E1iVhqj-0007eY-8u@rmk-PC.armlinux.org.uk
State Accepted
Delegated to: David Miller
Headers show
Series net: phylink: update to use phy_support_asym_pause() | expand

Commit Message

Russell King (Oracle) Nov. 15, 2019, 8:05 p.m. UTC
Use phy_support_asym_pause() rather than open-coding it.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/net/phy/phylink.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

Comments

Russell King (Oracle) Nov. 15, 2019, 8:07 p.m. UTC | #1
Forgetting the net-next tag again...

On Fri, Nov 15, 2019 at 08:05:45PM +0000, Russell King wrote:
> Use phy_support_asym_pause() rather than open-coding it.
> 
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> ---
>  drivers/net/phy/phylink.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index 2b70b4d50573..a68d664b65a3 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -697,11 +697,6 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy)
>  	__ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
>  	int ret;
>  
> -	memset(&config, 0, sizeof(config));
> -	linkmode_copy(supported, phy->supported);
> -	linkmode_copy(config.advertising, phy->advertising);
> -	config.interface = pl->link_config.interface;
> -
>  	/*
>  	 * This is the new way of dealing with flow control for PHYs,
>  	 * as described by Timur Tabi in commit 529ed1275263 ("net: phy:
> @@ -709,10 +704,12 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy)
>  	 * using our validate call to the MAC, we rely upon the MAC
>  	 * clearing the bits from both supported and advertising fields.
>  	 */
> -	if (phylink_test(supported, Pause))
> -		phylink_set(config.advertising, Pause);
> -	if (phylink_test(supported, Asym_Pause))
> -		phylink_set(config.advertising, Asym_Pause);
> +	phy_support_asym_pause(phy);
> +
> +	memset(&config, 0, sizeof(config));
> +	linkmode_copy(supported, phy->supported);
> +	linkmode_copy(config.advertising, phy->advertising);
> +	config.interface = pl->link_config.interface;
>  
>  	ret = phylink_validate(pl, supported, &config);
>  	if (ret)
> -- 
> 2.20.1
> 
>
Andrew Lunn Nov. 16, 2019, 4:08 p.m. UTC | #2
On Fri, Nov 15, 2019 at 08:05:45PM +0000, Russell King wrote:
> Use phy_support_asym_pause() rather than open-coding it.
> 
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
David Miller Nov. 16, 2019, 9:09 p.m. UTC | #3
From: Russell King <rmk+kernel@armlinux.org.uk>
Date: Fri, 15 Nov 2019 20:05:45 +0000

> Use phy_support_asym_pause() rather than open-coding it.
> 
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>

Applied, thank you.
diff mbox series

Patch

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 2b70b4d50573..a68d664b65a3 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -697,11 +697,6 @@  static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy)
 	__ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
 	int ret;
 
-	memset(&config, 0, sizeof(config));
-	linkmode_copy(supported, phy->supported);
-	linkmode_copy(config.advertising, phy->advertising);
-	config.interface = pl->link_config.interface;
-
 	/*
 	 * This is the new way of dealing with flow control for PHYs,
 	 * as described by Timur Tabi in commit 529ed1275263 ("net: phy:
@@ -709,10 +704,12 @@  static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy)
 	 * using our validate call to the MAC, we rely upon the MAC
 	 * clearing the bits from both supported and advertising fields.
 	 */
-	if (phylink_test(supported, Pause))
-		phylink_set(config.advertising, Pause);
-	if (phylink_test(supported, Asym_Pause))
-		phylink_set(config.advertising, Asym_Pause);
+	phy_support_asym_pause(phy);
+
+	memset(&config, 0, sizeof(config));
+	linkmode_copy(supported, phy->supported);
+	linkmode_copy(config.advertising, phy->advertising);
+	config.interface = pl->link_config.interface;
 
 	ret = phylink_validate(pl, supported, &config);
 	if (ret)