netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2 1/1] net: phy: micrel: Correct bit assignments for phy_device flags
@ 2023-09-01  4:53 Oleksij Rempel
  2023-09-01  7:12 ` Russell King (Oracle)
  2023-09-04  6:21 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Oleksij Rempel @ 2023-09-01  4:53 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Oleksij Rempel, kernel, linux-kernel, Russell King, netdev,
	Lukasz Majewski

Previously, the defines for phy_device flags in the Micrel driver were
ambiguous in their representation. They were intended to be bit masks
but were mistakenly defined as bit positions. This led to the following
issues:

- MICREL_KSZ8_P1_ERRATA, designated for KSZ88xx switches, overlapped
  with MICREL_PHY_FXEN and MICREL_PHY_50MHZ_CLK.
- Due to this overlap, the code path for MICREL_PHY_FXEN, tailored for
  the KSZ8041 PHY, was not executed for KSZ88xx PHYs.
- Similarly, the code associated with MICREL_PHY_50MHZ_CLK wasn't
  triggered for KSZ88xx.

To rectify this, all three flags have now been explicitly converted to
use the `BIT()` macro, ensuring they are defined as bit masks and
preventing potential overlaps in the future.

Fixes: 49011e0c1555 ("net: phy: micrel: ksz886x/ksz8081: add cabletest support")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 include/linux/micrel_phy.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index 8bef1ab62bba3..322d872559847 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -41,9 +41,9 @@
 #define	PHY_ID_KSZ9477		0x00221631
 
 /* struct phy_device dev_flags definitions */
-#define MICREL_PHY_50MHZ_CLK	0x00000001
-#define MICREL_PHY_FXEN		0x00000002
-#define MICREL_KSZ8_P1_ERRATA	0x00000003
+#define MICREL_PHY_50MHZ_CLK	BIT(0)
+#define MICREL_PHY_FXEN		BIT(1)
+#define MICREL_KSZ8_P1_ERRATA	BIT(2)
 
 #define MICREL_KSZ9021_EXTREG_CTRL	0xB
 #define MICREL_KSZ9021_EXTREG_DATA_WRITE	0xC
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net v2 1/1] net: phy: micrel: Correct bit assignments for phy_device flags
  2023-09-01  4:53 [PATCH net v2 1/1] net: phy: micrel: Correct bit assignments for phy_device flags Oleksij Rempel
@ 2023-09-01  7:12 ` Russell King (Oracle)
  2023-09-04  6:21 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Russell King (Oracle) @ 2023-09-01  7:12 UTC (permalink / raw)
  To: Oleksij Rempel
  Cc: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, kernel, linux-kernel, netdev,
	Lukasz Majewski

On Fri, Sep 01, 2023 at 06:53:23AM +0200, Oleksij Rempel wrote:
> Previously, the defines for phy_device flags in the Micrel driver were
> ambiguous in their representation. They were intended to be bit masks
> but were mistakenly defined as bit positions. This led to the following
> issues:
> 
> - MICREL_KSZ8_P1_ERRATA, designated for KSZ88xx switches, overlapped
>   with MICREL_PHY_FXEN and MICREL_PHY_50MHZ_CLK.
> - Due to this overlap, the code path for MICREL_PHY_FXEN, tailored for
>   the KSZ8041 PHY, was not executed for KSZ88xx PHYs.
> - Similarly, the code associated with MICREL_PHY_50MHZ_CLK wasn't
>   triggered for KSZ88xx.
> 
> To rectify this, all three flags have now been explicitly converted to
> use the `BIT()` macro, ensuring they are defined as bit masks and
> preventing potential overlaps in the future.
> 
> Fixes: 49011e0c1555 ("net: phy: micrel: ksz886x/ksz8081: add cabletest support")
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Thanks!

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net v2 1/1] net: phy: micrel: Correct bit assignments for phy_device flags
  2023-09-01  4:53 [PATCH net v2 1/1] net: phy: micrel: Correct bit assignments for phy_device flags Oleksij Rempel
  2023-09-01  7:12 ` Russell King (Oracle)
@ 2023-09-04  6:21 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-09-04  6:21 UTC (permalink / raw)
  To: Oleksij Rempel
  Cc: andrew, hkallweit1, davem, edumazet, kuba, pabeni, kernel,
	linux-kernel, linux, netdev, lukma

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Fri,  1 Sep 2023 06:53:23 +0200 you wrote:
> Previously, the defines for phy_device flags in the Micrel driver were
> ambiguous in their representation. They were intended to be bit masks
> but were mistakenly defined as bit positions. This led to the following
> issues:
> 
> - MICREL_KSZ8_P1_ERRATA, designated for KSZ88xx switches, overlapped
>   with MICREL_PHY_FXEN and MICREL_PHY_50MHZ_CLK.
> - Due to this overlap, the code path for MICREL_PHY_FXEN, tailored for
>   the KSZ8041 PHY, was not executed for KSZ88xx PHYs.
> - Similarly, the code associated with MICREL_PHY_50MHZ_CLK wasn't
>   triggered for KSZ88xx.
> 
> [...]

Here is the summary with links:
  - [net,v2,1/1] net: phy: micrel: Correct bit assignments for phy_device flags
    https://git.kernel.org/netdev/net/c/719c5e37e99d

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-04  6:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-01  4:53 [PATCH net v2 1/1] net: phy: micrel: Correct bit assignments for phy_device flags Oleksij Rempel
2023-09-01  7:12 ` Russell King (Oracle)
2023-09-04  6:21 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).