Commit 30b605b8 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

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: 803ca24d ("net: mdio: Add ACPI support code for mdio")
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 99669259
...@@ -18,16 +18,18 @@ MODULE_AUTHOR("Calvin Johnson <calvin.johnson@oss.nxp.com>"); ...@@ -18,16 +18,18 @@ MODULE_AUTHOR("Calvin Johnson <calvin.johnson@oss.nxp.com>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
/** /**
* acpi_mdiobus_register - Register mii_bus and create PHYs from the ACPI ASL. * __acpi_mdiobus_register - Register mii_bus and create PHYs from the ACPI ASL.
* @mdio: pointer to mii_bus structure * @mdio: pointer to mii_bus structure
* @fwnode: pointer to fwnode of MDIO bus. This fwnode is expected to represent * @fwnode: pointer to fwnode of MDIO bus. This fwnode is expected to represent
* @owner: module owning this @mdio object.
* an ACPI device object corresponding to the MDIO bus and its children are * an ACPI device object corresponding to the MDIO bus and its children are
* expected to correspond to the PHY devices on that bus. * expected to correspond to the PHY devices on that bus.
* *
* This function registers the mii_bus structure and registers a phy_device * This function registers the mii_bus structure and registers a phy_device
* for each child node of @fwnode. * for each child node of @fwnode.
*/ */
int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode) int __acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode,
struct module *owner)
{ {
struct fwnode_handle *child; struct fwnode_handle *child;
u32 addr; u32 addr;
...@@ -35,7 +37,7 @@ int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode) ...@@ -35,7 +37,7 @@ int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode)
/* Mask out all PHYs from auto probing. */ /* Mask out all PHYs from auto probing. */
mdio->phy_mask = GENMASK(31, 0); mdio->phy_mask = GENMASK(31, 0);
ret = mdiobus_register(mdio); ret = __mdiobus_register(mdio, owner);
if (ret) if (ret)
return ret; return ret;
...@@ -55,4 +57,4 @@ int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode) ...@@ -55,4 +57,4 @@ int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode)
} }
return 0; return 0;
} }
EXPORT_SYMBOL(acpi_mdiobus_register); EXPORT_SYMBOL(__acpi_mdiobus_register);
...@@ -9,7 +9,14 @@ ...@@ -9,7 +9,14 @@
#include <linux/phy.h> #include <linux/phy.h>
#if IS_ENABLED(CONFIG_ACPI_MDIO) #if IS_ENABLED(CONFIG_ACPI_MDIO)
int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode); int __acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode,
struct module *owner);
static inline int
acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *handle)
{
return __acpi_mdiobus_register(mdio, handle, THIS_MODULE);
}
#else /* CONFIG_ACPI_MDIO */ #else /* CONFIG_ACPI_MDIO */
static inline int static inline int
acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode) acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment