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

Configure Feed

Select the types of activity you want to include in your feed.

net: phy: assign default match function for non-PHY MDIO devices

Make mdio_device_bus_match() the default match function for non-PHY
MDIO devices. Benefit is that we don't have to export this function
any longer. As long as mdiodev->modalias isn't set, there's no change
in behavior. mdiobus_create_device() is the only place where
mdiodev->modalias gets set, but this function sets
mdio_device_bus_match() as match function anyway.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://patch.msgid.link/6c94e3d3-bfb0-4ddc-a518-6fddbc64e1d0@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Heiner Kallweit and committed by
Jakub Kicinski
b1b36680 8f9fee25

+3 -4
-1
drivers/net/phy/mdio_bus_provider.c
··· 152 152 153 153 strscpy(mdiodev->modalias, bi->modalias, 154 154 sizeof(mdiodev->modalias)); 155 - mdiodev->bus_match = mdio_device_bus_match; 156 155 mdiodev->dev.platform_data = (void *)bi->platform_data; 157 156 158 157 ret = mdio_device_register(mdiodev);
+3 -2
drivers/net/phy/mdio_device.c
··· 35 35 kfree(to_mdio_device(dev)); 36 36 } 37 37 38 - int mdio_device_bus_match(struct device *dev, const struct device_driver *drv) 38 + static int mdio_device_bus_match(struct device *dev, 39 + const struct device_driver *drv) 39 40 { 40 41 struct mdio_device *mdiodev = to_mdio_device(dev); 41 42 const struct mdio_driver *mdiodrv = to_mdio_driver(drv); ··· 46 45 47 46 return strcmp(mdiodev->modalias, drv->name) == 0; 48 47 } 49 - EXPORT_SYMBOL_GPL(mdio_device_bus_match); 50 48 51 49 struct mdio_device *mdio_device_create(struct mii_bus *bus, int addr) 52 50 { ··· 59 59 mdiodev->dev.release = mdio_device_release; 60 60 mdiodev->dev.parent = &bus->dev; 61 61 mdiodev->dev.bus = &mdio_bus_type; 62 + mdiodev->bus_match = mdio_device_bus_match; 62 63 mdiodev->device_free = mdio_device_free; 63 64 mdiodev->device_remove = mdio_device_remove; 64 65 mdiodev->bus = bus;
-1
include/linux/mdio.h
··· 95 95 void mdio_device_reset(struct mdio_device *mdiodev, int value); 96 96 int mdio_driver_register(struct mdio_driver *drv); 97 97 void mdio_driver_unregister(struct mdio_driver *drv); 98 - int mdio_device_bus_match(struct device *dev, const struct device_driver *drv); 99 98 100 99 static inline void mdio_device_get(struct mdio_device *mdiodev) 101 100 {