summaryrefslogtreecommitdiffstats
path: root/common/miiphyutil.c
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2015-10-07 21:32:37 -0700
committerJoe Hershberger <joe.hershberger@ni.com>2015-10-29 14:05:50 -0500
commitcb6baca77bca0ef999203a7ed73bd123e7da062e (patch)
tree85a5e8d2c44a7b6332fd9b7542d2915527d09755 /common/miiphyutil.c
parent17ecfa9b45db7964f6a20cd710a87decd2f2e1f5 (diff)
downloadblackbird-obmc-uboot-cb6baca77bca0ef999203a7ed73bd123e7da062e.tar.gz
blackbird-obmc-uboot-cb6baca77bca0ef999203a7ed73bd123e7da062e.zip
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>
Diffstat (limited to 'common/miiphyutil.c')
-rw-r--r--common/miiphyutil.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/common/miiphyutil.c b/common/miiphyutil.c
index c88c28adbf..e499b58836 100644
--- a/common/miiphyutil.c
+++ b/common/miiphyutil.c
@@ -152,6 +152,11 @@ struct mii_dev *mdio_alloc(void)
return bus;
}
+void mdio_free(struct mii_dev *bus)
+{
+ free(bus);
+}
+
int mdio_register(struct mii_dev *bus)
{
if (!bus || !bus->name || !bus->read || !bus->write)
@@ -173,6 +178,20 @@ int mdio_register(struct mii_dev *bus)
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)
{
struct list_head *entry;
OpenPOWER on IntegriCloud