netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S . Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH net-next 3/5] net: mdio-gpio: Remove non-DT probe path
Date: Sun, 25 Feb 2018 13:51:30 +0100	[thread overview]
Message-ID: <20180225125132.25275-4-linus.walleij@linaro.org> (raw)
In-Reply-To: <20180225125132.25275-1-linus.walleij@linaro.org>

This driver can now only be created using the device tree.
Remove the platform data probe path and require OF_MDIO
in Kconfig.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/net/phy/Kconfig     |  2 +-
 drivers/net/phy/mdio-gpio.c | 21 ++++++---------------
 2 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index bdfbabb86ee0..27efc5d6fbe2 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -92,7 +92,7 @@ config MDIO_CAVIUM
 
 config MDIO_GPIO
 	tristate "GPIO lib-based bitbanged MDIO buses"
-	depends on MDIO_BITBANG && GPIOLIB
+	depends on MDIO_BITBANG && GPIOLIB && OF_MDIO
 	---help---
 	  Supports GPIO lib-based MDIO busses.
 
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
index d95bb45eb67b..96c953d086c6 100644
--- a/drivers/net/phy/mdio-gpio.c
+++ b/drivers/net/phy/mdio-gpio.c
@@ -239,16 +239,11 @@ static int mdio_gpio_probe(struct platform_device *pdev)
 	if (!bitbang)
 		return -ENOMEM;
 
-	if (pdev->dev.of_node) {
-		pdata = mdio_gpio_of_get_data(dev);
-		bus_id = of_alias_get_id(dev->of_node, "mdio-gpio");
-		if (bus_id < 0) {
-			dev_warn(dev, "failed to get alias id\n");
-			bus_id = 0;
-		}
-	} else {
-		pdata = dev_get_platdata(dev);
-		bus_id = pdev->id;
+	pdata = mdio_gpio_of_get_data(dev);
+	bus_id = of_alias_get_id(dev->of_node, "mdio-gpio");
+	if (bus_id < 0) {
+		dev_warn(dev, "failed to get alias id\n");
+		bus_id = 0;
 	}
 
 	if (!pdata)
@@ -258,11 +253,7 @@ static int mdio_gpio_probe(struct platform_device *pdev)
 	if (!new_bus)
 		return -ENODEV;
 
-	if (dev->of_node)
-		ret = of_mdiobus_register(new_bus, dev->of_node);
-	else
-		ret = mdiobus_register(new_bus);
-
+	ret = of_mdiobus_register(new_bus, dev->of_node);
 	if (ret)
 		mdio_gpio_bus_deinit(dev);
 
-- 
2.14.3

  parent reply	other threads:[~2018-02-25 12:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-25 12:51 [PATCH net-next 0/5] Modernize bitbanged GPIO MDIO Linus Walleij
2018-02-25 12:51 ` [PATCH net-next 1/5] net: mdio-gpio: Localize platform data Linus Walleij
2018-02-25 12:51 ` [PATCH net-next 2/5] net: mdio-gpio: Allocate state in probe() Linus Walleij
2018-02-25 12:51 ` Linus Walleij [this message]
2018-02-25 12:51 ` [PATCH net-next 4/5] net: mdio-gpio: Merge platform data into state Linus Walleij
2018-02-25 12:51 ` [PATCH net-next 5/5] net: mdio-gpio: Move to gpiod API Linus Walleij
2018-02-25 19:08 ` [PATCH net-next 0/5] Modernize bitbanged GPIO MDIO Andrew Lunn
2018-02-27  8:53   ` Linus Walleij
2018-02-27 14:00 ` Florian Fainelli
2018-02-27 23:10   ` Andrew Lunn
2018-02-27 23:46     ` Florian Fainelli
2018-03-02  9:44   ` Linus Walleij

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=20180225125132.25275-4-linus.walleij@linaro.org \
    --to=linus.walleij@linaro.org \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).