summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2015-10-07 21:32:38 -0700
committerJoe Hershberger <joe.hershberger@ni.com>2015-10-29 14:05:50 -0500
commit5d2459fd466ebf86c717ccb28a8f56707a29724a (patch)
tree6409c4282330e8d2a2a5c998ca2442a5f87cbe33 /drivers/net
parentcb6baca77bca0ef999203a7ed73bd123e7da062e (diff)
net: designware: Add driver remove support
In designware_eth_probe(), some additional resources are allocated (eg: mdio, phy). We should free these in the driver remove phase. Add designware_eth_remove() to clean it up. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/designware.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 6433896eec..a6c39c39ff 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -613,6 +613,17 @@ static int designware_eth_probe(struct udevice *dev)
return ret;
}
+static int designware_eth_remove(struct udevice *dev)
+{
+ struct dw_eth_dev *priv = dev_get_priv(dev);
+
+ free(priv->phydev);
+ mdio_unregister(priv->bus);
+ mdio_free(priv->bus);
+
+ return 0;
+}
+
static const struct eth_ops designware_eth_ops = {
.start = designware_eth_start,
.send = designware_eth_send,
@@ -653,6 +664,7 @@ U_BOOT_DRIVER(eth_designware) = {
.ofdata_to_platdata = designware_eth_ofdata_to_platdata,
.bind = designware_eth_bind,
.probe = designware_eth_probe,
+ .remove = designware_eth_remove,
.ops = &designware_eth_ops,
.priv_auto_alloc_size = sizeof(struct dw_eth_dev),
.platdata_auto_alloc_size = sizeof(struct eth_pdata),