diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2017-02-05 00:02:44 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-02-07 18:51:46 +0300 |
commit | 648ea0134069cda7d4940f397bcc6901fb88752a (patch) | |
tree | 2e898d9c56777f31708c0292170eae5d76c13882 /drivers/net/phy/mdio_device.c | |
parent | 71e0bbde0d88047f66b25721f69a441d46083748 (diff) | |
download | linux-648ea0134069cda7d4940f397bcc6901fb88752a.tar.xz |
net: phy: Allow pre-declaration of MDIO devices
Allow board support code to collect pre-declarations for MDIO devices by
registering them with mdiobus_register_board_info(). SPI and I2C buses
have a similar feature, we were missing this for MDIO devices, but this
is particularly useful for e.g: MDIO-connected switches which need to
provide their port layout (often board-specific) to a MDIO Ethernet
switch driver.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/mdio_device.c')
-rw-r--r-- | drivers/net/phy/mdio_device.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/phy/mdio_device.c b/drivers/net/phy/mdio_device.c index fc3aaaa36b1d..e24f28924af8 100644 --- a/drivers/net/phy/mdio_device.c +++ b/drivers/net/phy/mdio_device.c @@ -34,6 +34,17 @@ static void mdio_device_release(struct device *dev) kfree(to_mdio_device(dev)); } +int mdio_device_bus_match(struct device *dev, struct device_driver *drv) +{ + struct mdio_device *mdiodev = to_mdio_device(dev); + struct mdio_driver *mdiodrv = to_mdio_driver(drv); + + if (mdiodrv->mdiodrv.flags & MDIO_DEVICE_IS_PHY) + return 0; + + return strcmp(mdiodev->modalias, drv->name) == 0; +} + struct mdio_device *mdio_device_create(struct mii_bus *bus, int addr) { struct mdio_device *mdiodev; |