Skip to content

Commit ac53c26

Browse files
wojtas-marcindavem330
authored andcommitted
net: mdiobus: withdraw fwnode_mdbiobus_register
The newly implemented fwnode_mdbiobus_register turned out to be problematic - in case the fwnode_/of_/acpi_mdio are built as modules, a dependency cycle can be observed during the depmod phase of modules_install, eg.: depmod: ERROR: Cycle detected: fwnode_mdio -> of_mdio -> fwnode_mdio depmod: ERROR: Found 2 modules in dependency cycles! OR: depmod: ERROR: Cycle detected: acpi_mdio -> fwnode_mdio -> acpi_mdio depmod: ERROR: Found 2 modules in dependency cycles! A possible solution could be to rework fwnode_mdiobus_register, so that to merge the contents of acpi_mdiobus_register and of_mdiobus_register. However feasible, such change would be very intrusive and affect huge amount of the of_mdiobus_register users. Since there are currently 2 users of ACPI and MDIO (xgmac_mdio and mvmdio), withdraw the fwnode_mdbiobus_register and roll back to a simple 'if' condition in affected drivers. Fixes: 62a6ef6 ("net: mdiobus: Introduce fwnode_mdbiobus_register()") Signed-off-by: Marcin Wojtas <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f92e186 commit ac53c26

File tree

5 files changed

+20
-39
lines changed

5 files changed

+20
-39
lines changed

drivers/net/ethernet/freescale/Kconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ config FSL_PQ_MDIO
6767

6868
config FSL_XGMAC_MDIO
6969
tristate "Freescale XGMAC MDIO"
70-
depends on FWNODE_MDIO
70+
select PHYLIB
71+
depends on OF
72+
select OF_MDIO
7173
help
7274
This driver supports the MDIO bus on the Fman 10G Ethernet MACs, and
7375
on the FMan mEMAC (which supports both Clauses 22 and 45)

drivers/net/ethernet/freescale/xgmac_mdio.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414

1515
#include <linux/acpi.h>
16-
#include <linux/fwnode_mdio.h>
16+
#include <linux/acpi_mdio.h>
1717
#include <linux/interrupt.h>
1818
#include <linux/kernel.h>
1919
#include <linux/mdio.h>
@@ -246,6 +246,7 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
246246

247247
static int xgmac_mdio_probe(struct platform_device *pdev)
248248
{
249+
struct fwnode_handle *fwnode;
249250
struct mdio_fsl_priv *priv;
250251
struct resource *res;
251252
struct mii_bus *bus;
@@ -290,7 +291,13 @@ static int xgmac_mdio_probe(struct platform_device *pdev)
290291
priv->has_a011043 = device_property_read_bool(&pdev->dev,
291292
"fsl,erratum-a011043");
292293

293-
ret = fwnode_mdiobus_register(bus, pdev->dev.fwnode);
294+
fwnode = pdev->dev.fwnode;
295+
if (is_of_node(fwnode))
296+
ret = of_mdiobus_register(bus, to_of_node(fwnode));
297+
else if (is_acpi_node(fwnode))
298+
ret = acpi_mdiobus_register(bus, fwnode);
299+
else
300+
ret = -EINVAL;
294301
if (ret) {
295302
dev_err(&pdev->dev, "cannot register MDIO bus\n");
296303
goto err_registration;

drivers/net/ethernet/marvell/mvmdio.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
*/
1919

2020
#include <linux/acpi.h>
21+
#include <linux/acpi_mdio.h>
2122
#include <linux/clk.h>
2223
#include <linux/delay.h>
23-
#include <linux/fwnode_mdio.h>
2424
#include <linux/interrupt.h>
2525
#include <linux/io.h>
2626
#include <linux/kernel.h>
@@ -371,7 +371,13 @@ static int orion_mdio_probe(struct platform_device *pdev)
371371
goto out_mdio;
372372
}
373373

374-
ret = fwnode_mdiobus_register(bus, pdev->dev.fwnode);
374+
/* For the platforms not supporting DT/ACPI fall-back
375+
* to mdiobus_register via of_mdiobus_register.
376+
*/
377+
if (is_acpi_node(pdev->dev.fwnode))
378+
ret = acpi_mdiobus_register(bus, pdev->dev.fwnode);
379+
else
380+
ret = of_mdiobus_register(bus, pdev->dev.of_node);
375381
if (ret < 0) {
376382
dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret);
377383
goto out_mdio;

drivers/net/mdio/fwnode_mdio.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
*/
88

99
#include <linux/acpi.h>
10-
#include <linux/acpi_mdio.h>
1110
#include <linux/fwnode_mdio.h>
1211
#include <linux/of.h>
13-
#include <linux/of_mdio.h>
1412
#include <linux/phy.h>
1513

1614
MODULE_AUTHOR("Calvin Johnson <[email protected]>");
@@ -144,23 +142,3 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,
144142
return 0;
145143
}
146144
EXPORT_SYMBOL(fwnode_mdiobus_register_phy);
147-
148-
/**
149-
* fwnode_mdiobus_register - bring up all the PHYs on a given MDIO bus and
150-
* attach them to it.
151-
* @bus: Target MDIO bus.
152-
* @fwnode: Pointer to fwnode of the MDIO controller.
153-
*
154-
* Return values are determined accordingly to acpi_/of_ mdiobus_register()
155-
* operation.
156-
*/
157-
int fwnode_mdiobus_register(struct mii_bus *bus, struct fwnode_handle *fwnode)
158-
{
159-
if (is_acpi_node(fwnode))
160-
return acpi_mdiobus_register(bus, fwnode);
161-
else if (is_of_node(fwnode))
162-
return of_mdiobus_register(bus, to_of_node(fwnode));
163-
else
164-
return -EINVAL;
165-
}
166-
EXPORT_SYMBOL(fwnode_mdiobus_register);

include/linux/fwnode_mdio.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
1616
int fwnode_mdiobus_register_phy(struct mii_bus *bus,
1717
struct fwnode_handle *child, u32 addr);
1818

19-
int fwnode_mdiobus_register(struct mii_bus *bus, struct fwnode_handle *fwnode);
2019
#else /* CONFIG_FWNODE_MDIO */
2120
int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
2221
struct phy_device *phy,
@@ -31,17 +30,6 @@ static inline int fwnode_mdiobus_register_phy(struct mii_bus *bus,
3130
{
3231
return -EINVAL;
3332
}
34-
35-
static inline int fwnode_mdiobus_register(struct mii_bus *bus,
36-
struct fwnode_handle *fwnode)
37-
{
38-
/*
39-
* Fall back to mdiobus_register() function to register a bus.
40-
* This way, we don't have to keep compat bits around in drivers.
41-
*/
42-
43-
return mdiobus_register(bus);
44-
}
4533
#endif
4634

4735
#endif /* __LINUX_FWNODE_MDIO_H */

0 commit comments

Comments
 (0)