net: mdio: Add mdio_free() and mdio_unregister() API
Currently there is no API to uninitialize mdio. Add two APIs for this. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>utp
parent
17ecfa9b45
commit
cb6baca77b
|
@ -152,6 +152,11 @@ struct mii_dev *mdio_alloc(void)
|
||||||
return bus;
|
return bus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mdio_free(struct mii_dev *bus)
|
||||||
|
{
|
||||||
|
free(bus);
|
||||||
|
}
|
||||||
|
|
||||||
int mdio_register(struct mii_dev *bus)
|
int mdio_register(struct mii_dev *bus)
|
||||||
{
|
{
|
||||||
if (!bus || !bus->name || !bus->read || !bus->write)
|
if (!bus || !bus->name || !bus->read || !bus->write)
|
||||||
|
@ -173,6 +178,20 @@ int mdio_register(struct mii_dev *bus)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int mdio_unregister(struct mii_dev *bus)
|
||||||
|
{
|
||||||
|
if (!bus)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* delete it from the list */
|
||||||
|
list_del(&bus->link);
|
||||||
|
|
||||||
|
if (current_mii == bus)
|
||||||
|
current_mii = NULL;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void mdio_list_devices(void)
|
void mdio_list_devices(void)
|
||||||
{
|
{
|
||||||
struct list_head *entry;
|
struct list_head *entry;
|
||||||
|
|
|
@ -59,7 +59,9 @@ struct phy_device *mdio_phydev_for_ethname(const char *devname);
|
||||||
void miiphy_listdev(void);
|
void miiphy_listdev(void);
|
||||||
|
|
||||||
struct mii_dev *mdio_alloc(void);
|
struct mii_dev *mdio_alloc(void);
|
||||||
|
void mdio_free(struct mii_dev *bus);
|
||||||
int mdio_register(struct mii_dev *bus);
|
int mdio_register(struct mii_dev *bus);
|
||||||
|
int mdio_unregister(struct mii_dev *bus);
|
||||||
void mdio_list_devices(void);
|
void mdio_list_devices(void);
|
||||||
|
|
||||||
#ifdef CONFIG_BITBANGMII
|
#ifdef CONFIG_BITBANGMII
|
||||||
|
|
Loading…
Reference in New Issue