Skip to content

Commit 30b605b

Browse files
ffainellidavem330
authored andcommitted
net: mdio: fix owner field for mdio buses registered using ACPI
Bus ownership is wrong when using acpi_mdiobus_register() to register an mdio bus. That function is not inline, so when it calls mdiobus_register() the wrong THIS_MODULE value is captured. CC: Maxime Bizon <mbizon@freebox.fr> Fixes: 803ca24 ("net: mdio: Add ACPI support code for mdio") Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 9966925 commit 30b605b

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

drivers/net/mdio/acpi_mdio.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,26 @@ MODULE_AUTHOR("Calvin Johnson <calvin.johnson@oss.nxp.com>");
1818
MODULE_LICENSE("GPL");
1919

2020
/**
21-
* acpi_mdiobus_register - Register mii_bus and create PHYs from the ACPI ASL.
21+
* __acpi_mdiobus_register - Register mii_bus and create PHYs from the ACPI ASL.
2222
* @mdio: pointer to mii_bus structure
2323
* @fwnode: pointer to fwnode of MDIO bus. This fwnode is expected to represent
24+
* @owner: module owning this @mdio object.
2425
* an ACPI device object corresponding to the MDIO bus and its children are
2526
* expected to correspond to the PHY devices on that bus.
2627
*
2728
* This function registers the mii_bus structure and registers a phy_device
2829
* for each child node of @fwnode.
2930
*/
30-
int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode)
31+
int __acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode,
32+
struct module *owner)
3133
{
3234
struct fwnode_handle *child;
3335
u32 addr;
3436
int ret;
3537

3638
/* Mask out all PHYs from auto probing. */
3739
mdio->phy_mask = GENMASK(31, 0);
38-
ret = mdiobus_register(mdio);
40+
ret = __mdiobus_register(mdio, owner);
3941
if (ret)
4042
return ret;
4143

@@ -55,4 +57,4 @@ int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode)
5557
}
5658
return 0;
5759
}
58-
EXPORT_SYMBOL(acpi_mdiobus_register);
60+
EXPORT_SYMBOL(__acpi_mdiobus_register);

include/linux/acpi_mdio.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@
99
#include <linux/phy.h>
1010

1111
#if IS_ENABLED(CONFIG_ACPI_MDIO)
12-
int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode);
12+
int __acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode,
13+
struct module *owner);
14+
15+
static inline int
16+
acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *handle)
17+
{
18+
return __acpi_mdiobus_register(mdio, handle, THIS_MODULE);
19+
}
1320
#else /* CONFIG_ACPI_MDIO */
1421
static inline int
1522
acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode)

0 commit comments

Comments
 (0)