net: mdio: add mdio_device_get() and mdio_device_put()
Add two new operations for a mdio device to manage the refcount on the underlying struct device. This will be used by mdio PCS drivers to simplify the creation and destruction handling, making it easier for users to get it correct. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
75455b906d
commit
c4933fa88a
|
@ -106,6 +106,16 @@ int mdio_driver_register(struct mdio_driver *drv);
|
|||
void mdio_driver_unregister(struct mdio_driver *drv);
|
||||
int mdio_device_bus_match(struct device *dev, struct device_driver *drv);
|
||||
|
||||
static inline void mdio_device_get(struct mdio_device *mdiodev)
|
||||
{
|
||||
get_device(&mdiodev->dev);
|
||||
}
|
||||
|
||||
static inline void mdio_device_put(struct mdio_device *mdiodev)
|
||||
{
|
||||
mdio_device_free(mdiodev);
|
||||
}
|
||||
|
||||
static inline bool mdio_phy_id_is_c45(int phy_id)
|
||||
{
|
||||
return (phy_id & MDIO_PHY_ID_C45) && !(phy_id & ~MDIO_PHY_ID_C45_MASK);
|
||||
|
|
Loading…
Reference in New Issue