diff mbox series

[net,v2,1/1] net: phy: micrel: Correct bit assignments for phy_device flags

Message ID 20230901045323.3907976-1-o.rempel@pengutronix.de (mailing list archive)
State Accepted
Commit 719c5e37e99d2fd588d1c994284d17650a66354c
Delegated to: Netdev Maintainers
Headers show
Series [net,v2,1/1] net: phy: micrel: Correct bit assignments for phy_device flags | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1369 this patch: 1369
netdev/cc_maintainers warning 2 maintainers not CCed: michael@walle.cc horatiu.vultur@microchip.com
netdev/build_clang success Errors and warnings before: 1353 this patch: 1353
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1392 this patch: 1392
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 12 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Oleksij Rempel Sept. 1, 2023, 4:53 a.m. UTC
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(-)

Comments

Russell King (Oracle) Sept. 1, 2023, 7:12 a.m. UTC | #1
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!
patchwork-bot+netdevbpf@kernel.org Sept. 4, 2023, 6:21 a.m. UTC | #2
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!
diff mbox series

Patch

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