[PATCH 8/9] r8152: use linkmode_and_and() in EEE checks

Loktionov, Aleksandr aleksandr.loktionov at intel.com
Tue Sep 8 13:12:01 UTC 2026



> -----Original Message-----
> From: Yury Norov <yury.norov at gmail.com>
> Sent: Monday, September 7, 2026 11:55 PM
> To: Andrew Lunn <andrew at lunn.ch>; Heiner Kallweit
> <hkallweit1 at gmail.com>; Russell King <linux at armlinux.org.uk>; Raju
> Rangoju <Raju.Rangoju at amd.com>; Prashanth Kumar K R
> <PrashanthKumar.K.R at amd.com>; Nguyen, Anthony L
> <anthony.l.nguyen at intel.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel at intel.com>; Jian Shen <shenjian15 at huawei.com>;
> Jijie Shao <shaojijie at huawei.com>; David S. Miller
> <davem at davemloft.net>; Eric Dumazet <edumazet at google.com>; Jakub
> Kicinski <kuba at kernel.org>; Paolo Abeni <pabeni at redhat.com>; linux-
> kernel at vger.kernel.org; netdev at vger.kernel.org; intel-wired-
> lan at lists.osuosl.org; linux-usb at vger.kernel.org
> Cc: Yury Norov <ynorov at nvidia.com>; Yury Norov <yury.norov at gmail.com>;
> Rasmus Villemoes <linux at rasmusvillemoes.dk>; Andrew Morton
> <akpm at linux-foundation.org>
> Subject: [PATCH 8/9] r8152: use linkmode_and_and() in EEE checks
> 
> Combine the three link mode masks in a single operation and use its
> return value to determine whether EEE is active.
> 
> Signed-off-by: Yury Norov <ynorov at nvidia.com>
> ---
>  drivers/net/usb/r8152.c  | 10 ++++------  include/linux/linkmode.h |
> 8 ++++++++
>  2 files changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index
> f61686433031..75f0574fe1d4 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
> @@ -9149,9 +9149,8 @@ static int r8152_get_eee(struct r8152 *tp,
> struct ethtool_keee *eee)
>  	if (speed & _100bps)
>  		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT,
> common);
> 
> -	linkmode_and(common, common, eee->advertised);
> -	linkmode_and(common, common, eee->lp_advertised);
> -	eee->eee_active = !linkmode_empty(common);
> +	eee->eee_active = linkmode_and_and(common, common, eee-
> >advertised,
> +					   eee->lp_advertised);
> 
>  	return 0;
>  }
> @@ -9222,9 +9221,8 @@ static int r8153_get_eee(struct r8152 *tp,
> struct ethtool_keee *eee)
>  	if (speed & _100bps)
>  		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT,
> common);
> 
> -	linkmode_and(common, common, eee->advertised);
> -	linkmode_and(common, common, eee->lp_advertised);
> -	eee->eee_active = !linkmode_empty(common);
> +	eee->eee_active = linkmode_and_and(common, common, eee-
> >advertised,
> +					   eee->lp_advertised);
> 
>  	return 0;
>  }
> diff --git a/include/linux/linkmode.h b/include/linux/linkmode.h index
> 49587a2e0f69..efd392dc62ae 100644
> --- a/include/linux/linkmode.h
> +++ b/include/linux/linkmode.h
> @@ -26,6 +26,14 @@ static inline bool linkmode_and(unsigned long *dst,
> const unsigned long *a,
>  	return bitmap_and(dst, a, b, __ETHTOOL_LINK_MODE_MASK_NBITS);
> }
> 
> +static inline bool linkmode_and_and(unsigned long *dst,
> +				    const unsigned long *a,
> +				    const unsigned long *b,
> +				    const unsigned long *c)
> +{
> +	return bitmap_and_and(dst, a, b, c,
> __ETHTOOL_LINK_MODE_MASK_NBITS); }
> +
>  static inline bool linkmode_and_andnot(unsigned long *dst,
>  				       const unsigned long *a,
>  				       const unsigned long *b,
> --
> 2.53.0

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov at intel.com>


More information about the Intel-wired-lan mailing list