Commit 6e5484d
net: phy: as21xxx: make PHY matching side-effect free and non-fatal
The AS21xxx match callbacks were mutating device state while the core was still
deciding which driver to bind.
Specifically, match paths were writing `phydev->phy_id` (and for gen1 also
touching vendor registers). On C45-discovered devices, `phydev->phy_id` may
start as 0, so this could leave sysfs showing `0x00000000` or stale values.
Also, returning negative errors from `match_phy_device()` can abort driver
matching and leave the PHY unbound, which breaks management LED setup.
Fix this by:
- making gen1/gen2 match callbacks return `0` on read failure
- removing `phydev->phy_id` updates from match callbacks
- removing side-effect register writes from match callbacks
- updating `phydev->phy_id` in gen1/gen2 probe after successful init using a
best-effort PID re-read
This keeps matching pure, avoids premature bind aborts, and ensures sysfs
`phy_id` is updated only after the PHY is actually initialized.
Signed-off-by: Rudy Andram <rmandrad@gmail.com>1 parent 23c2b22 commit 6e5484d
1 file changed
Lines changed: 25 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1041 | 1041 | | |
1042 | 1042 | | |
1043 | 1043 | | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
1044 | 1047 | | |
1045 | 1048 | | |
1046 | 1049 | | |
| 1050 | + | |
1047 | 1051 | | |
1048 | 1052 | | |
1049 | 1053 | | |
| |||
1079 | 1083 | | |
1080 | 1084 | | |
1081 | 1085 | | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
1082 | 1094 | | |
1083 | 1095 | | |
1084 | 1096 | | |
| |||
1087 | 1099 | | |
1088 | 1100 | | |
1089 | 1101 | | |
| 1102 | + | |
1090 | 1103 | | |
1091 | 1104 | | |
1092 | 1105 | | |
| |||
1113 | 1126 | | |
1114 | 1127 | | |
1115 | 1128 | | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
1116 | 1137 | | |
1117 | 1138 | | |
1118 | 1139 | | |
| |||
1510 | 1531 | | |
1511 | 1532 | | |
1512 | 1533 | | |
1513 | | - | |
1514 | | - | |
1515 | | - | |
| 1534 | + | |
| 1535 | + | |
1516 | 1536 | | |
1517 | 1537 | | |
1518 | 1538 | | |
| |||
1527 | 1547 | | |
1528 | 1548 | | |
1529 | 1549 | | |
1530 | | - | |
1531 | | - | |
1532 | 1550 | | |
1533 | 1551 | | |
1534 | 1552 | | |
| |||
1546 | 1564 | | |
1547 | 1565 | | |
1548 | 1566 | | |
1549 | | - | |
1550 | | - | |
1551 | | - | |
| 1567 | + | |
| 1568 | + | |
1552 | 1569 | | |
1553 | 1570 | | |
1554 | | - | |
1555 | 1571 | | |
1556 | 1572 | | |
1557 | 1573 | | |
| |||
0 commit comments