You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
mdio: Abstract device_remove() and device_free()
Make device_free and device_remove operations in the mdio device structure, so the core code does not need to differentiate between phy devices and generic mdio devices. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
a9049e0c51
commit
711fdba37a
@@ -47,11 +47,27 @@ void phy_device_free(struct phy_device *phydev)
|
||||
}
|
||||
EXPORT_SYMBOL(phy_device_free);
|
||||
|
||||
static void phy_mdio_device_free(struct mdio_device *mdiodev)
|
||||
{
|
||||
struct phy_device *phydev;
|
||||
|
||||
phydev = container_of(mdiodev, struct phy_device, mdio);
|
||||
phy_device_free(phydev);
|
||||
}
|
||||
|
||||
static void phy_device_release(struct device *dev)
|
||||
{
|
||||
kfree(to_phy_device(dev));
|
||||
}
|
||||
|
||||
static void phy_mdio_device_remove(struct mdio_device *mdiodev)
|
||||
{
|
||||
struct phy_device *phydev;
|
||||
|
||||
phydev = container_of(mdiodev, struct phy_device, mdio);
|
||||
phy_device_remove(phydev);
|
||||
}
|
||||
|
||||
enum genphy_driver {
|
||||
GENPHY_DRV_1G,
|
||||
GENPHY_DRV_10G,
|
||||
@@ -308,6 +324,8 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
|
||||
mdiodev->bus_match = phy_bus_match;
|
||||
mdiodev->addr = addr;
|
||||
mdiodev->flags = MDIO_DEVICE_FLAG_PHY;
|
||||
mdiodev->device_free = phy_mdio_device_free;
|
||||
mdiodev->device_remove = phy_mdio_device_remove;
|
||||
|
||||
dev->speed = 0;
|
||||
dev->duplex = -1;
|
||||
|
||||
Reference in New Issue
Block a user