mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 3/5] net: phy: Add missing phy_unregister_device
Date: Tue, 28 Apr 2015 13:05:35 +0200	[thread overview]
Message-ID: <1430219137-8294-4-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1430219137-8294-1-git-send-email-s.hauer@pengutronix.de>

The counterpart of phy_register_device is missing. Add it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/net/phy/phy.c | 11 +++++++++++
 include/linux/phy.h   |  1 +
 2 files changed, 12 insertions(+)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index f3dffca..edf5d03 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -272,6 +272,17 @@ int phy_register_device(struct phy_device *phydev)
 	return ret;
 }
 
+void phy_unregister_device(struct phy_device *phydev)
+{
+	if (!phydev->registered)
+		return;
+
+	phydev->bus->phy_map[phydev->addr] = NULL;
+
+	unregister_device(&phydev->dev);
+	phydev->registered = 0;
+}
+
 static struct phy_device *of_mdio_find_phy(struct eth_device *edev)
 {
 	struct device_d *dev;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index c0fd4ff..9a451a6 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -266,6 +266,7 @@ int phy_init(void);
 int phy_init_hw(struct phy_device *phydev);
 
 int phy_register_device(struct phy_device* dev);
+void phy_unregister_device(struct phy_device *phydev);
 
 /**
  * phy_read - Convenience function for reading a given PHY register
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2015-04-28 11:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-28 11:05 AM335x fixes Sascha Hauer
2015-04-28 11:05 ` [PATCH 1/5] usb: musb: dsps: Do not use priv pointer Sascha Hauer
2015-04-28 11:05 ` [PATCH 2/5] usb: musb: set controller->priv pointer Sascha Hauer
2015-04-28 11:05 ` Sascha Hauer [this message]
2015-04-28 11:05 ` [PATCH 4/5] eth: halt active ethernet device on unregister Sascha Hauer
2015-04-28 11:05 ` [PATCH 5/5] net: cpsw: unregister device on remove callback Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430219137-8294-4-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox