From patchwork Mon Jun 22 09:37:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11618663 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 596BD912 for ; Mon, 22 Jun 2020 18:42:06 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 254172073E for ; Mon, 22 Jun 2020 18:42:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CK9aSyUg"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="nHZDq84v" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 254172073E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1VWpVFNi7cET/A2Cn6ThiGKZpjseXVAwZIHobD8nrUo=; b=CK9aSyUg8z8KVR6QuCuTBKRa2 vHUQNLZ4V8AyvMJbGMYF9LlQaAyCmbgCFiwcFnMivYig0NZbqIYbYr1UcbHRcj1hCsDP/uaHiGI3u WEQyvj/TZatwUzSVbXv/8TSkHXz4Hke5NBf3zoRAL48YCmb10ZalfZfXB7Hqon1gR8iwWSIkx1aAV 0xjYzThzigr4sxx7B/fgXRubkqCsM35T9bNfWauWwgPdbw4U1Tub0sENy80Pen4rtB1QEnoJuiwwU z+rt31lHLZ9JKseKBYimimc707Iw/UO6Bnhl4H+P8WW7bFzUeAVNfD3lnd/Iy9+YlxswQFGpqN/g/ VdqSDTxjA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnRMf-000781-Qb; Mon, 22 Jun 2020 18:40:17 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnIxT-0007hM-MR for linux-arm-kernel@lists.infradead.org; Mon, 22 Jun 2020 09:41:44 +0000 Received: by mail-wm1-x343.google.com with SMTP id g10so14197532wmh.4 for ; Mon, 22 Jun 2020 02:41:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l2sxOAERFa0J25cQccVz8/lQJT3JNRbkHzrHyMtlOx8=; b=nHZDq84vKrJqy5xXpj2+rJ5h5VIM3n4oN76Uizc9jBhIW16xOrH3B0Km9mgWsk8Lu6 yvA1XNXVkC07+Pg/8MKlE82O8Zr8pe+ZvkBUKPDwUpNwKEh7ddGCtrK03jbkSOhkA97n 64Op9mOQmTRVdF209L3WgAXdk3JQpz6prmFcnirM5Mh85gqh4wj4HfX8Dj95q3jZ4lEF /r+V+9jWRk4x4oJaqpBir5uBrXH2h5nhtFaRbptwV37IBb0FqLh8jpU7Qs3q7UwE/NC6 FhTF3jLXUrGYuZgpSgC5QM7D/g7YPowxLmIGSyrPG0S+JZ6ohlL8NFMJuPMP9exEStSR efPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l2sxOAERFa0J25cQccVz8/lQJT3JNRbkHzrHyMtlOx8=; b=r8kGBTUh8p7TuX3K7Qfv2nKDBW9qdxTxhfvcjDl69LvJ25gVDb2KZVEECt2nRYRO9R HXA8o1FWNK6d1vRxKHbg9ibSZnIdhC4vw6TyorhNgQvozxWXE2VSfCBrCxQgPevjz3x9 GreIjn4n2nANb5moGU8dEz3gVFquFyf+sue30qBp1nWcSjnrDABOptOPA2cwGDJBPYpk bgA0SruOJjDvfC7iocFEu21iQlKqauVtxQQYTl7A/Bfpmifvavwm2iy57pgsx9u4MObH wxAG8I0JLzbZ7+ObBz3EcwkbbwvBcoKuIq6MgFGYiT7+0fu6PZYzdqyUaqqibBcFVVBm I0fA== X-Gm-Message-State: AOAM531tnkAH1LxLNXcNFMLyP3FDb1naAAzif2p68B5d+NqGWlNqfH/2 3alDpwieogmpuiss4DkvwtZMrA== X-Google-Smtp-Source: ABdhPJzJR6KO8zeK/627bqE1LbuigMS0KsI1hp+YnRpdEX+tkt6lyQYjVo/pPkpTRjLvTnpZhm+r2Q== X-Received: by 2002:a7b:c156:: with SMTP id z22mr16903035wmi.43.1592818901772; Mon, 22 Jun 2020 02:41:41 -0700 (PDT) Received: from localhost.localdomain (lfbn-nic-1-65-232.w2-15.abo.wanadoo.fr. [2.15.156.232]) by smtp.gmail.com with ESMTPSA id j24sm14392652wrd.43.2020.06.22.02.41.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 02:41:41 -0700 (PDT) From: Bartosz Golaszewski To: Andrew Lunn , Florian Fainelli , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Rob Herring , Matthias Brugger , Microchip Linux Driver Support , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , Vivien Didelot , Tom Lendacky , Yisen Zhuang , Salil Mehta , Jassi Brar , Ilias Apalodimas , Iyappan Subramanian , Keyur Chudgar , Quan Nguyen , Frank Rowand , Philipp Zabel , Liam Girdwood , Mark Brown Subject: [PATCH 11/15] net: phy: drop get_phy_device() Date: Mon, 22 Jun 2020 11:37:40 +0200 Message-Id: <20200622093744.13685-12-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200622093744.13685-1-brgl@bgdev.pl> References: <20200622093744.13685-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:343 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Stephane Le Provost , Bartosz Golaszewski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Fabien Parent , linux-mediatek@lists.infradead.org, Andrew Perepech , Pedro Tsai , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Bartosz Golaszewski get_phy_device() has now become just a wrapper for phy_device_create() with the phy_id argument set to PHY_ID_NONE. Let's remove this function treewide and replace it with opencoded phy_device_create(). This has the advantage of being more explicit about the PHY not having the ID set when being created. Signed-off-by: Bartosz Golaszewski --- drivers/net/dsa/ocelot/felix_vsc9959.c | 3 ++- drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 5 +++-- drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 2 +- drivers/net/ethernet/socionext/netsec.c | 3 ++- drivers/net/phy/fixed_phy.c | 2 +- drivers/net/phy/mdio-xgene.c | 2 +- drivers/net/phy/mdio_bus.c | 2 +- drivers/net/phy/phy_device.c | 14 -------------- drivers/net/phy/sfp.c | 2 +- drivers/of/of_mdio.c | 11 +++++++---- include/linux/phy.h | 7 ------- 11 files changed, 19 insertions(+), 34 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 1dd9e348152d..40c868382e03 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1183,7 +1183,8 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot) if (ocelot_port->phy_mode == PHY_INTERFACE_MODE_USXGMII) is_c45 = true; - pcs = get_phy_device(felix->imdio, port, is_c45); + pcs = phy_device_create(felix->imdio, port, + PHY_ID_NONE, is_c45); if (IS_ERR(pcs)) continue; diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c index 46c3c1ca38d6..1117ed468abf 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c @@ -1017,8 +1017,9 @@ static int xgbe_phy_find_phy_device(struct xgbe_prv_data *pdata) } /* Create and connect to the PHY device */ - phydev = get_phy_device(phy_data->mii, phy_data->mdio_addr, - (phy_data->phydev_mode == XGBE_MDIO_MODE_CL45)); + phydev = phy_device_create(phy_data->mii, phy_data->mdio_addr, + PHY_ID_NONE, + phy_data->phydev_mode == XGBE_MDIO_MODE_CL45); if (IS_ERR(phydev)) { netdev_err(pdata->netdev, "get_phy_device failed\n"); return -ENODEV; diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c index 9a907947ba19..75fa6a855727 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c @@ -703,7 +703,7 @@ hns_mac_register_phydev(struct mii_bus *mdio, struct hns_mac_cb *mac_cb, else return -ENODATA; - phy = get_phy_device(mdio, addr, is_c45); + phy = phy_device_create(mdio, addr, PHY_ID_NONE, is_c45); if (!phy || IS_ERR(phy)) return -EIO; diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c index 328bc38848bb..48c405d81000 100644 --- a/drivers/net/ethernet/socionext/netsec.c +++ b/drivers/net/ethernet/socionext/netsec.c @@ -1935,7 +1935,8 @@ static int netsec_register_mdio(struct netsec_priv *priv, u32 phy_addr) return ret; } - priv->phydev = get_phy_device(bus, phy_addr, false); + priv->phydev = phy_device_create(bus, phy_addr, + PHY_ID_NONE, false); if (IS_ERR(priv->phydev)) { ret = PTR_ERR(priv->phydev); dev_err(priv->dev, "get_phy_device err(%d)\n", ret); diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c index c4641b1704d6..9019f0035ef0 100644 --- a/drivers/net/phy/fixed_phy.c +++ b/drivers/net/phy/fixed_phy.c @@ -254,7 +254,7 @@ static struct phy_device *__fixed_phy_register(unsigned int irq, return ERR_PTR(ret); } - phy = get_phy_device(fmb->mii_bus, phy_addr, false); + phy = phy_device_create(fmb->mii_bus, phy_addr, PHY_ID_NONE, false); if (IS_ERR(phy)) { fixed_phy_del(phy_addr); return ERR_PTR(-EINVAL); diff --git a/drivers/net/phy/mdio-xgene.c b/drivers/net/phy/mdio-xgene.c index 34990eaa3298..6698e7caaf78 100644 --- a/drivers/net/phy/mdio-xgene.c +++ b/drivers/net/phy/mdio-xgene.c @@ -264,7 +264,7 @@ struct phy_device *xgene_enet_phy_register(struct mii_bus *bus, int phy_addr) { struct phy_device *phy_dev; - phy_dev = get_phy_device(bus, phy_addr, false); + phy_dev = phy_device_create(bus, phy_addr, PHY_ID_NONE, false); if (!phy_dev || IS_ERR(phy_dev)) return NULL; diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 296cf9771483..53e2fb0be7b9 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -742,7 +742,7 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr) struct phy_device *phydev; int err; - phydev = get_phy_device(bus, addr, false); + phydev = phy_device_create(bus, addr, PHY_ID_NONE, false); if (IS_ERR(phydev)) return phydev; diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index ad7c4cd9d357..58923826838b 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -817,20 +817,6 @@ static int phy_device_read_id(struct phy_device *phydev) phydev->is_c45, &phydev->c45_ids); } -/** - * get_phy_device - create a phy_device withoug PHY ID - * @bus: the target MII bus - * @addr: PHY address on the MII bus - * @is_c45: If true the PHY uses the 802.3 clause 45 protocol - * - * Allocates a new phy_device for @addr on the @bus. - */ -struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45) -{ - return phy_device_create(bus, addr, PHY_ID_NONE, is_c45); -} -EXPORT_SYMBOL(get_phy_device); - /** * phy_device_register - Register the phy device on the MDIO bus * @phydev: phy_device structure to be added to the MDIO bus diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index 73c2969f11a4..0b165d928762 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -1431,7 +1431,7 @@ static int sfp_sm_probe_phy(struct sfp *sfp, bool is_c45) struct phy_device *phy; int err; - phy = get_phy_device(sfp->i2c_mii, SFP_PHY_ADDR, is_c45); + phy = phy_device_create(sfp->i2c_mii, SFP_PHY_ADDR, PHY_ID_NONE, is_c45); if (phy == ERR_PTR(-ENODEV)) return PTR_ERR(phy); if (IS_ERR(phy)) { diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 63843037673c..af576d056e45 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -120,10 +120,13 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, is_c45 = of_device_is_compatible(child, "ethernet-phy-ieee802.3-c45"); - if (!is_c45 && !of_get_phy_id(child, &phy_id)) - phy = phy_device_create(mdio, addr, phy_id, 0); - else - phy = get_phy_device(mdio, addr, is_c45); + if (!is_c45) { + rc = of_get_phy_id(child, &phy_id); + if (rc) + phy_id = PHY_ID_NONE; + } + + phy = phy_device_create(mdio, addr, phy_id, is_c45); if (IS_ERR(phy)) { if (mii_ts) unregister_mii_timestamper(mii_ts); diff --git a/include/linux/phy.h b/include/linux/phy.h index 662919c1dd27..01d24a934ad1 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1215,16 +1215,9 @@ int phy_modify_paged(struct phy_device *phydev, int page, u32 regnum, struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, bool is_c45); #if IS_ENABLED(CONFIG_PHYLIB) -struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45); int phy_device_register(struct phy_device *phy); void phy_device_free(struct phy_device *phydev); #else -static inline -struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45) -{ - return NULL; -} - static inline int phy_device_register(struct phy_device *phy) { return 0;