Skip to content

Commit a3e1c0a

Browse files
hkallweitkuba-moo
authored andcommitted
net: phy: factor out provider part from mdio_bus.c
After 52358dd ("net: phy: remove function stubs") there's a problem if CONFIG_MDIO_BUS is set, but CONFIG_PHYLIB is not. mdiobus_scan() uses phylib functions like get_phy_device(). Bringing back the stub wouldn't make much sense, because it would allow to compile mdiobus_scan(), but the function would be unusable. The stub returned NULL, and we have the following in mdiobus_scan(): phydev = get_phy_device(bus, addr, c45); if (IS_ERR(phydev)) return phydev; So calling mdiobus_scan() w/o CONFIG_PHYLIB would cause a crash later in mdiobus_scan(). In general the PHYLIB functionality isn't optional here. Consequently, MDIO bus providers depend on PHYLIB. Therefore factor it out and build it together with the libphy core modules. In addition make all MDIO bus providers under /drivers/net/mdio depend on PHYLIB. Same applies to enetc MDIO bus provider. Note that PHYLIB selects MDIO_DEVRES, therefore we can omit this here. Fixes: 52358dd ("net: phy: remove function stubs") Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Reviewed-by: Jacob Keller <[email protected]> Signed-off-by: Heiner Kallweit <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 51cf06d commit a3e1c0a

File tree

6 files changed

+494
-474
lines changed

6 files changed

+494
-474
lines changed

drivers/net/ethernet/freescale/enetc/Kconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ config FSL_ENETC_IERB
7373

7474
config FSL_ENETC_MDIO
7575
tristate "ENETC MDIO driver"
76-
depends on PCI && MDIO_BUS
77-
select MDIO_DEVRES
76+
depends on PCI && PHYLIB
7877
help
7978
This driver supports NXP ENETC Central MDIO controller as a PCIe
8079
physical function (PF) device.

drivers/net/mdio/Kconfig

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,25 @@ config MDIO_BUS
1919
reflects whether the mdio_bus/mdio_device code is built as a
2020
loadable module or built-in.
2121

22+
if PHYLIB
23+
2224
config FWNODE_MDIO
23-
def_tristate PHYLIB
24-
depends on (ACPI || OF) || COMPILE_TEST
25+
def_tristate (ACPI || OF) || COMPILE_TEST
2526
select FIXED_PHY
2627
help
2728
FWNODE MDIO bus (Ethernet PHY) accessors
2829

2930
config OF_MDIO
30-
def_tristate PHYLIB
31-
depends on OF
32-
depends on PHYLIB
31+
def_tristate OF
3332
select FIXED_PHY
3433
help
3534
OpenFirmware MDIO bus (Ethernet PHY) accessors
3635

3736
config ACPI_MDIO
38-
def_tristate PHYLIB
39-
depends on ACPI
40-
depends on PHYLIB
37+
def_tristate ACPI
4138
help
4239
ACPI MDIO bus (Ethernet PHY) accessors
4340

44-
if MDIO_BUS
45-
4641
config MDIO_DEVRES
4742
tristate
4843

@@ -57,7 +52,6 @@ config MDIO_SUN4I
5752
config MDIO_XGENE
5853
tristate "APM X-Gene SoC MDIO bus controller"
5954
depends on ARCH_XGENE || COMPILE_TEST
60-
depends on PHYLIB
6155
help
6256
This module provides a driver for the MDIO busses found in the
6357
APM X-Gene SoC's.

drivers/net/phy/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
libphy-y := phy.o phy-c45.o phy-core.o phy_device.o \
55
linkmode.o phy_link_topology.o \
6-
phy_package.o phy_caps.o
6+
phy_package.o phy_caps.o mdio_bus_provider.o
77
mdio-bus-y += mdio_bus.o mdio_device.o
88

99
ifdef CONFIG_MDIO_DEVICE

0 commit comments

Comments
 (0)