From patchwork Fri Dec 4 19:28:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 337764 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp704542jai; Fri, 4 Dec 2020 11:30:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0xlnzcePn773raQZN2gVN+oKvtHid+83GTur7TNBaPwXuqTNL46Voa+5QmZkq162SVxqD X-Received: by 2002:a05:6402:88c:: with SMTP id e12mr8938003edy.88.1607110210647; Fri, 04 Dec 2020 11:30:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607110210; cv=none; d=google.com; s=arc-20160816; b=kuf0Ln65GcAKiCYzrWptk60tCzCUBPtIyWCo45fqN5CWTM49PuAX+t+H860VcS8hqq ccT7YYF79ZECHC9V5WD1wNGH2W/Pb/rpiMlW9vKo8t5Yn4jqeQ1mVopz+5HpdlMLL4T6 NpQVL4vxlfRvML1wz+SYPbkjwR8FgQqoS96Gp5a/UTEVMoCkfmN5Sbd13RECyYq8MowJ vegjlV8XalpaL7Qt9Wi3SORtVsQilwyvQakFVD75d5zGO/G48c+8mzPl2N9TCTiu5BHR c0VI4aFnplQ0WjSxxDOoqcY19Hj5aeYs2wrwB/7vTJDW4q1Vj+vt/0nWR0GwVSKhMT34 1oIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=cuf50eWD8BhVCzFby5AHPrrD/1StoCq+D5Ia+NANwOI=; b=aPjQubefEOlw/FB05KMKwFQnUZTZDjvda3gXSvfMvCN7wwYRqobdYPb5/hCLc0Zgjj IYs4g1e4KgnEsfoCioevduPYrr388EN/jYgVWJfTlbNXRL0r2jkyaILeVvcdrFKKyNVJ cFNgE9BsqKrBxNBAD7ba8JYxW9fvNsSkNF+er1kMXs6n3GD+pofsz+To21gcASrhdHlX GiAUA2rK5rtG8q0LOQ3LciZ7ji/RbanT/8CJcPGAuLqMdIoCx4SRmKcf+oN8BROQj8US +a+ZxyEnBg5a22rGKJwoP1VteKPU7hXCWDHr6V3kmiJFmZ05T5HrHXHJA2rrkJa40XaS i5bA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g2si3543439edn.508.2020.12.04.11.30.10; Fri, 04 Dec 2020 11:30:10 -0800 (PST) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730209AbgLDT34 (ORCPT + 8 others); Fri, 4 Dec 2020 14:29:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:57964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725923AbgLDT34 (ORCPT ); Fri, 4 Dec 2020 14:29:56 -0500 From: Arnd Bergmann Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: Claudiu Manoil , "David S. Miller" , Jakub Kicinski , Russell King , Ioana Ciornei Cc: Arnd Bergmann , Po Liu , Leon Romanovsky , Alex Marginean , Michael Walle , Vladimir Oltean , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [v2] enetc: fix build warning Date: Fri, 4 Dec 2020 20:28:59 +0100 Message-Id: <20201204192910.2306023-1-arnd@kernel.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann When CONFIG_OF is disabled, there is a harmless warning about an unused variable: enetc_pf.c: In function 'enetc_phylink_create': enetc_pf.c:981:17: error: unused variable 'dev' [-Werror=unused-variable] Slightly rearrange the code to pass around the of_node as a function argument, which avoids the problem without hurting readability. Fixes: 71b77a7a27a3 ("enetc: Migrate to PHYLINK and PCS_LYNX") Signed-off-by: Arnd Bergmann --- v2: move added variable declaration up --- .../net/ethernet/freescale/enetc/enetc_pf.c | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) -- 2.27.0 diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c index ecdc2af8c292..ed8fcb8b486e 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -851,13 +851,12 @@ static bool enetc_port_has_pcs(struct enetc_pf *pf) pf->if_mode == PHY_INTERFACE_MODE_USXGMII); } -static int enetc_mdiobus_create(struct enetc_pf *pf) +static int enetc_mdiobus_create(struct enetc_pf *pf, struct device_node *node) { - struct device *dev = &pf->si->pdev->dev; struct device_node *mdio_np; int err; - mdio_np = of_get_child_by_name(dev->of_node, "mdio"); + mdio_np = of_get_child_by_name(node, "mdio"); if (mdio_np) { err = enetc_mdio_probe(pf, mdio_np); @@ -969,18 +968,17 @@ static const struct phylink_mac_ops enetc_mac_phylink_ops = { .mac_link_down = enetc_pl_mac_link_down, }; -static int enetc_phylink_create(struct enetc_ndev_priv *priv) +static int enetc_phylink_create(struct enetc_ndev_priv *priv, + struct device_node *node) { struct enetc_pf *pf = enetc_si_priv(priv->si); - struct device *dev = &pf->si->pdev->dev; struct phylink *phylink; int err; pf->phylink_config.dev = &priv->ndev->dev; pf->phylink_config.type = PHYLINK_NETDEV; - phylink = phylink_create(&pf->phylink_config, - of_fwnode_handle(dev->of_node), + phylink = phylink_create(&pf->phylink_config, of_fwnode_handle(node), pf->if_mode, &enetc_mac_phylink_ops); if (IS_ERR(phylink)) { err = PTR_ERR(phylink); @@ -1001,13 +999,14 @@ static void enetc_phylink_destroy(struct enetc_ndev_priv *priv) static int enetc_pf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { + struct device_node *node = pdev->dev.of_node; struct enetc_ndev_priv *priv; struct net_device *ndev; struct enetc_si *si; struct enetc_pf *pf; int err; - if (pdev->dev.of_node && !of_device_is_available(pdev->dev.of_node)) { + if (node && !of_device_is_available(node)) { dev_info(&pdev->dev, "device is disabled, skipping\n"); return -ENODEV; } @@ -1058,12 +1057,12 @@ static int enetc_pf_probe(struct pci_dev *pdev, goto err_alloc_msix; } - if (!of_get_phy_mode(pdev->dev.of_node, &pf->if_mode)) { - err = enetc_mdiobus_create(pf); + if (!of_get_phy_mode(node, &pf->if_mode)) { + err = enetc_mdiobus_create(pf, node); if (err) goto err_mdiobus_create; - err = enetc_phylink_create(priv); + err = enetc_phylink_create(priv, node); if (err) goto err_phylink_create; }