netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Guido Günther" <agx@sigxcpu.org>
To: Heiner Kallweit <hkallweit1@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org
Subject: [PATCH] RFC: Revert "net: phy: check return code when requesting PHY driver module"
Date: Mon, 21 Jan 2019 15:00:55 +0100	[thread overview]
Message-ID: <20190121140055.GA7037@bogon.m.sigxcpu.org> (raw)

This unbreaks ethernet on e.g. the NXP imx8mq-evk using the fec driver.
Otherwise it fails like:

[    3.702671] device: '30be0000.ethernet-1': device_add
[    3.707783] PM: Adding info for No Bus:30be0000.ethernet-1
[    3.713329] libphy: fec_enet_mii_bus: probed
[    3.717815] mdio_bus 30be0000.ethernet-1:01: error -2 loading PHY driver module for ID 0x004dd074
[    3.726747] PM: Removing info for No Bus:30be0000.ethernet-1
[    3.732460] device: 'pps0': device_unregister
[    3.736911] PM: Removing info for No Bus:pps0
[    3.741317] device: 'ptp0': device_unregister
[    3.745761] PM: Removing info for No Bus:ptp0
[    3.750160] device: 'ptp0': device_create_release
[    3.755024] fec 30be0000.ethernet: Dropping the link to regulator.2
[    3.761359] fec: probe of 30be0000.ethernet failed with error -2

This reverts commit 13d0ab6750b20957ac1466da4e44dc0af746ff28.
---
On linux-next as somewhen starting at 2018-01-18 fec initialization
broke due to 13d0ab6750b20957ac1466da4e44dc0af746ff28. It welcome any
feedback how to fix this properly without eliminating the purpose of
the initial patch.

 drivers/net/phy/phy_device.c | 35 +++++------------------------------
 1 file changed, 5 insertions(+), 30 deletions(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index b61db0a5ba3a..636303e50173 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -558,31 +558,12 @@ static const struct device_type mdio_bus_phy_type = {
 	.pm = MDIO_BUS_PHY_PM_OPS,
 };
 
-static int phy_request_driver_module(struct phy_device *dev, int phy_id)
-{
-	int ret;
-
-	ret = request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT,
-			     MDIO_ID_ARGS(phy_id));
-	/* we only check for failures in executing the usermode binary,
-	 * not whether a PHY driver module exists for the PHY ID
-	 */
-	if (IS_ENABLED(CONFIG_MODULES) && ret < 0) {
-		phydev_err(dev, "error %d loading PHY driver module for ID 0x%08x\n",
-			   ret, phy_id);
-		return ret;
-	}
-
-	return 0;
-}
-
 struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
 				     bool is_c45,
 				     struct phy_c45_device_ids *c45_ids)
 {
 	struct phy_device *dev;
 	struct mdio_device *mdiodev;
-	int ret = 0;
 
 	/* We allocate the device, and initialize the default values */
 	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
@@ -639,21 +620,15 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
 			if (!(c45_ids->devices_in_package & (1 << i)))
 				continue;
 
-			ret = phy_request_driver_module(dev,
-						c45_ids->device_ids[i]);
-			if (ret)
-				break;
+			request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT,
+				       MDIO_ID_ARGS(c45_ids->device_ids[i]));
 		}
 	} else {
-		ret = phy_request_driver_module(dev, phy_id);
+		request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT,
+			       MDIO_ID_ARGS(phy_id));
 	}
 
-	if (!ret) {
-		device_initialize(&mdiodev->dev);
-	} else {
-		kfree(dev);
-		dev = ERR_PTR(ret);
-	}
+	device_initialize(&mdiodev->dev);
 
 	return dev;
 }
-- 
2.20.1

             reply	other threads:[~2019-01-21 14:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-21 14:00 Guido Günther [this message]
2019-01-21 16:26 ` [PATCH] RFC: Revert "net: phy: check return code when requesting PHY driver module" Andrew Lunn
2019-01-21 17:57   ` Guido Günther

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=20190121140055.GA7037@bogon.m.sigxcpu.org \
    --to=agx@sigxcpu.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@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).