Skip to content

Commit

Permalink
net: phy: at803x: use GENMASK() for speed status
Browse files Browse the repository at this point in the history
Use GENMASK() for the current speed value.

Signed-off-by: Luo Jie <luoj@codeaurora.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Luo Jie authored and David S. Miller committed Oct 25, 2021
1 parent 7beecaf commit 9540cdd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/net/phy/at803x.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
#define AT803X_SFC_DISABLE_JABBER BIT(0)

#define AT803X_SPECIFIC_STATUS 0x11
#define AT803X_SS_SPEED_MASK (3 << 14)
#define AT803X_SS_SPEED_1000 (2 << 14)
#define AT803X_SS_SPEED_100 (1 << 14)
#define AT803X_SS_SPEED_10 (0 << 14)
#define AT803X_SS_SPEED_MASK GENMASK(15, 14)
#define AT803X_SS_SPEED_1000 2
#define AT803X_SS_SPEED_100 1
#define AT803X_SS_SPEED_10 0
#define AT803X_SS_DUPLEX BIT(13)
#define AT803X_SS_SPEED_DUPLEX_RESOLVED BIT(11)
#define AT803X_SS_MDIX BIT(6)
Expand Down Expand Up @@ -994,7 +994,7 @@ static int at803x_read_status(struct phy_device *phydev)
if (sfc < 0)
return sfc;

switch (ss & AT803X_SS_SPEED_MASK) {
switch (FIELD_GET(AT803X_SS_SPEED_MASK, ss)) {
case AT803X_SS_SPEED_10:
phydev->speed = SPEED_10;
break;
Expand Down

0 comments on commit 9540cdd

Please sign in to comment.