From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 172AEC2F3BE for ; Mon, 21 Jan 2019 14:10:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E2FB120861 for ; Mon, 21 Jan 2019 14:10:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731737AbfAUOKP (ORCPT ); Mon, 21 Jan 2019 09:10:15 -0500 Received: from honk.sigxcpu.org ([24.134.29.49]:34934 "EHLO honk.sigxcpu.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729964AbfAUOKO (ORCPT ); Mon, 21 Jan 2019 09:10:14 -0500 X-Greylist: delayed 555 seconds by postgrey-1.27 at vger.kernel.org; Mon, 21 Jan 2019 09:10:13 EST Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 6F33BFB03; Mon, 21 Jan 2019 15:00:57 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id c74qXB47gjrA; Mon, 21 Jan 2019 15:00:55 +0100 (CET) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id 4F9CD48DCA; Mon, 21 Jan 2019 15:00:55 +0100 (CET) Date: Mon, 21 Jan 2019 15:00:55 +0100 From: Guido =?iso-8859-1?Q?G=FCnther?= To: Heiner Kallweit , Andrew Lunn , Florian Fainelli , "David S. Miller" , netdev@vger.kernel.org Subject: [PATCH] RFC: Revert "net: phy: check return code when requesting PHY driver module" Message-ID: <20190121140055.GA7037@bogon.m.sigxcpu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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