RE: [PATCH 8/9] r8152: use linkmode_and_and() in EEE checks
flat view
From: Loktionov, Aleksandr <hidden>
Date: 2026-09-08 13:12:10
Also in:
intel-wired-lan, linux-usb, lkml
quoted hunk ↗ jump to hunk
-----Original Message----- From: Yury Norov <yury.norov@gmail.com> Sent: Monday, September 7, 2026 11:55 PM To: Andrew Lunn <andrew@lunn.ch>; Heiner Kallweit [off-list ref]; Russell King [off-list ref]; Raju Rangoju [off-list ref]; Prashanth Kumar K R [off-list ref]; Nguyen, Anthony L [off-list ref]; Kitszel, Przemyslaw [off-list ref]; Jian Shen [off-list ref]; Jijie Shao [off-list ref]; David S. Miller [off-list ref]; Eric Dumazet [off-list ref]; Jakub Kicinski [off-list ref]; Paolo Abeni [off-list ref]; linux- kernel@vger.kernel.org; netdev@vger.kernel.org; intel-wired- lan@lists.osuosl.org; linux-usb@vger.kernel.org Cc: Yury Norov <redacted>; Yury Norov <yury.norov@gmail.com>; Rasmus Villemoes [off-list ref]; Andrew Morton [off-list ref] 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 <redacted> --- 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 indexf61686433031..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-quoted
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-quoted
advertised,+ eee->lp_advertised); return 0; }diff --git a/include/linux/linkmode.h b/include/linux/linkmode.h index49587a2e0f69..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 <redacted>