> -----Original Message-----
> From: Yury Norov <[email protected]>
> Sent: Monday, September 7, 2026 11:55 PM
> To: Andrew Lunn <[email protected]>; Heiner Kallweit
> <[email protected]>; Russell King <[email protected]>; Raju
> Rangoju <[email protected]>; Prashanth Kumar K R
> <[email protected]>; Nguyen, Anthony L
> <[email protected]>; Kitszel, Przemyslaw
> <[email protected]>; Jian Shen <[email protected]>;
> Jijie Shao <[email protected]>; David S. Miller
> <[email protected]>; Eric Dumazet <[email protected]>; Jakub
> Kicinski <[email protected]>; Paolo Abeni <[email protected]>; linux-
> [email protected]; [email protected]; intel-wired-
> [email protected]; [email protected]
> Cc: Yury Norov <[email protected]>; Yury Norov <[email protected]>;
> Rasmus Villemoes <[email protected]>; Andrew Morton
> <[email protected]>
> 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 <[email protected]>
> ---
> 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 <[email protected]>