Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 803ca24d2f92 ("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>

authored by

Florian Fainelli and committed by
David S. Miller
30b605b8 99669259

+14 -5
+6 -4
drivers/net/mdio/acpi_mdio.c
··· 18 18 MODULE_LICENSE("GPL"); 19 19 20 20 /** 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. 22 22 * @mdio: pointer to mii_bus structure 23 23 * @fwnode: pointer to fwnode of MDIO bus. This fwnode is expected to represent 24 + * @owner: module owning this @mdio object. 24 25 * an ACPI device object corresponding to the MDIO bus and its children are 25 26 * expected to correspond to the PHY devices on that bus. 26 27 * 27 28 * This function registers the mii_bus structure and registers a phy_device 28 29 * for each child node of @fwnode. 29 30 */ 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) 31 33 { 32 34 struct fwnode_handle *child; 33 35 u32 addr; ··· 37 35 38 36 /* Mask out all PHYs from auto probing. */ 39 37 mdio->phy_mask = GENMASK(31, 0); 40 - ret = mdiobus_register(mdio); 38 + ret = __mdiobus_register(mdio, owner); 41 39 if (ret) 42 40 return ret; 43 41 ··· 57 55 } 58 56 return 0; 59 57 } 60 - EXPORT_SYMBOL(acpi_mdiobus_register); 58 + EXPORT_SYMBOL(__acpi_mdiobus_register);
+8 -1
include/linux/acpi_mdio.h
··· 9 9 #include <linux/phy.h> 10 10 11 11 #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 + } 13 20 #else /* CONFIG_ACPI_MDIO */ 14 21 static inline int 15 22 acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode)