From nobody Sat Feb 7 15:26:37 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B7E5C7EE23 for ; Mon, 12 Jun 2023 09:31:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230078AbjFLJbD (ORCPT ); Mon, 12 Jun 2023 05:31:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234867AbjFLJ3u (ORCPT ); Mon, 12 Jun 2023 05:29:50 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06CB31BF0 for ; Mon, 12 Jun 2023 02:24:39 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3f81b449357so7729625e9.0 for ; Mon, 12 Jun 2023 02:24:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1686561877; x=1689153877; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dcof+ioLKEeKphF7CJyWNZmTAfrhrHTZK64Fi/9bNaI=; b=Dg7TMce7jAT0NsV+wlnPsos/ZyuSZyDJqhpW/BBbn9Ka1QrBfiXgqZTaar1M9RU4L5 b0/hgLiiaAe+rn1FdxEy7/FLD6PjGJPKwsHiJSy5XLR3CKoVPnRnJftTuKbyjwSHEqLa vYL/OpcY7rEXgXARYIo14jlZxUfWbR5CSWwZ2xL269j3cAoqSSCCVXtt98PBVs1f4AJ/ WnZL1Ba1NhJH1alP0S8Hg7FklHXutu80MK1fcTSL92Zz3DE2NQ32qzBIV2acbD0o0xYE 3+X7E2SPeEjQYMX4NknRZkL9zF6/7Pvv9gsYdvH8L+GpnsUcew18D7WL5UTxSRjX2aJi /ABw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686561877; x=1689153877; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dcof+ioLKEeKphF7CJyWNZmTAfrhrHTZK64Fi/9bNaI=; b=ZFeCEJPzjkzYQCtBFrX42kIZdOxCcwcMTfFrBFp/0164L1drTRoP5xWKnGBKX8UH8m UQqTM7jhQ3i/fM09FD+JC/tRG8RSvZvH7mbFGQhfujjoqN1d2qkOGZPh/e6a2wQvbPKX RGCLrrotW/R2naUbNsw7Lw6JNKqC0apKeV1TZU1oU0wksj6UncbicxOZpxDQxnrIaJLV M5PMfL+cc4AmHKDX8YzGg9cN6LQtbh0Km0NO7JUy9e0n2ac88BXGFHzJYVHOjlsuwTRv NLaXDjcXMo295xGrwUhipL0Trh2kKR0+fT8oIF+bFEf8MVKhBbD7ebObtk+nclGlE+rO zkYg== X-Gm-Message-State: AC+VfDz8wKJTLslfnAeUFwhzZeU0fLfrxTi/BSBxIxcOM5N8NGaQJhzu MSF1CfQ3RMeeU0DdcoBaBearMw== X-Google-Smtp-Source: ACHHUZ5PLbX5RWrds3RXFRl4jn09YQCnlI+UoBhYMMMiq3Fz+M1wg2MWodS3yyBlSYaMCUR+2oFIbw== X-Received: by 2002:a05:600c:aca:b0:3f7:f614:9970 with SMTP id c10-20020a05600c0aca00b003f7f6149970mr6683496wmr.34.1686561877559; Mon, 12 Jun 2023 02:24:37 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:a222:bbe9:c688:33ae]) by smtp.gmail.com with ESMTPSA id p14-20020a7bcc8e000000b003f727764b10sm10892044wma.4.2023.06.12.02.24.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jun 2023 02:24:37 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Kishon Vijay Abraham I , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Bartosz Golaszewski Subject: [PATCH 08/26] net: stmmac: dwmac-qcom-ethqos: use a helper variable for &pdev->dev Date: Mon, 12 Jun 2023 11:23:37 +0200 Message-Id: <20230612092355.87937-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230612092355.87937-1-brgl@bgdev.pl> References: <20230612092355.87937-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski Shrink code and avoid line breaks by using a helper variable for &pdev->dev. Signed-off-by: Bartosz Golaszewski --- .../stmicro/stmmac/dwmac-qcom-ethqos.c | 48 ++++++++++--------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/driv= ers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 28d2514a8795..e19d142630d3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -123,25 +123,26 @@ static void rgmii_updatel(struct qcom_ethqos *ethqos, static void rgmii_dump(void *priv) { struct qcom_ethqos *ethqos =3D priv; + struct device *dev =3D ðqos->pdev->dev; =20 - dev_dbg(ðqos->pdev->dev, "Rgmii register dump\n"); - dev_dbg(ðqos->pdev->dev, "RGMII_IO_MACRO_CONFIG: %x\n", + dev_dbg(dev, "Rgmii register dump\n"); + dev_dbg(dev, "RGMII_IO_MACRO_CONFIG: %x\n", rgmii_readl(ethqos, RGMII_IO_MACRO_CONFIG)); - dev_dbg(ðqos->pdev->dev, "SDCC_HC_REG_DLL_CONFIG: %x\n", + dev_dbg(dev, "SDCC_HC_REG_DLL_CONFIG: %x\n", rgmii_readl(ethqos, SDCC_HC_REG_DLL_CONFIG)); - dev_dbg(ðqos->pdev->dev, "SDCC_HC_REG_DDR_CONFIG: %x\n", + dev_dbg(dev, "SDCC_HC_REG_DDR_CONFIG: %x\n", rgmii_readl(ethqos, SDCC_HC_REG_DDR_CONFIG)); - dev_dbg(ðqos->pdev->dev, "SDCC_HC_REG_DLL_CONFIG2: %x\n", + dev_dbg(dev, "SDCC_HC_REG_DLL_CONFIG2: %x\n", rgmii_readl(ethqos, SDCC_HC_REG_DLL_CONFIG2)); - dev_dbg(ðqos->pdev->dev, "SDC4_STATUS: %x\n", + dev_dbg(dev, "SDC4_STATUS: %x\n", rgmii_readl(ethqos, SDC4_STATUS)); - dev_dbg(ðqos->pdev->dev, "SDCC_USR_CTL: %x\n", + dev_dbg(dev, "SDCC_USR_CTL: %x\n", rgmii_readl(ethqos, SDCC_USR_CTL)); - dev_dbg(ðqos->pdev->dev, "RGMII_IO_MACRO_CONFIG2: %x\n", + dev_dbg(dev, "RGMII_IO_MACRO_CONFIG2: %x\n", rgmii_readl(ethqos, RGMII_IO_MACRO_CONFIG2)); - dev_dbg(ðqos->pdev->dev, "RGMII_IO_MACRO_DEBUG1: %x\n", + dev_dbg(dev, "RGMII_IO_MACRO_DEBUG1: %x\n", rgmii_readl(ethqos, RGMII_IO_MACRO_DEBUG1)); - dev_dbg(ðqos->pdev->dev, "EMAC_SYSTEM_LOW_POWER_DEBUG: %x\n", + dev_dbg(dev, "EMAC_SYSTEM_LOW_POWER_DEBUG: %x\n", rgmii_readl(ethqos, EMAC_SYSTEM_LOW_POWER_DEBUG)); } =20 @@ -242,6 +243,7 @@ static const struct ethqos_emac_driver_data emac_v3_0_0= _data =3D { =20 static int ethqos_dll_configure(struct qcom_ethqos *ethqos) { + struct device *dev =3D ðqos->pdev->dev; unsigned int val; int retry =3D 1000; =20 @@ -279,7 +281,7 @@ static int ethqos_dll_configure(struct qcom_ethqos *eth= qos) retry--; } while (retry > 0); if (!retry) - dev_err(ðqos->pdev->dev, "Clear CK_OUT_EN timedout\n"); + dev_err(dev, "Clear CK_OUT_EN timedout\n"); =20 /* Set CK_OUT_EN */ rgmii_updatel(ethqos, SDCC_DLL_CONFIG_CK_OUT_EN, @@ -296,7 +298,7 @@ static int ethqos_dll_configure(struct qcom_ethqos *eth= qos) retry--; } while (retry > 0); if (!retry) - dev_err(ðqos->pdev->dev, "Set CK_OUT_EN timedout\n"); + dev_err(dev, "Set CK_OUT_EN timedout\n"); =20 /* Set DDR_CAL_EN */ rgmii_updatel(ethqos, SDCC_DLL_CONFIG2_DDR_CAL_EN, @@ -322,12 +324,13 @@ static int ethqos_dll_configure(struct qcom_ethqos *e= thqos) =20 static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos) { + struct device *dev =3D ðqos->pdev->dev; int phase_shift; int phy_mode; int loopback; =20 /* Determine if the PHY adds a 2 ns TX delay or the MAC handles it */ - phy_mode =3D device_get_phy_mode(ðqos->pdev->dev); + phy_mode =3D device_get_phy_mode(dev); if (phy_mode =3D=3D PHY_INTERFACE_MODE_RGMII_ID || phy_mode =3D=3D PHY_INTERFACE_MODE_RGMII_TXID) phase_shift =3D 0; @@ -468,7 +471,7 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *= ethqos) loopback, RGMII_IO_MACRO_CONFIG); break; default: - dev_err(ðqos->pdev->dev, + dev_err(dev, "Invalid speed %d\n", ethqos->speed); return -EINVAL; } @@ -478,6 +481,7 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *= ethqos) =20 static int ethqos_configure(struct qcom_ethqos *ethqos) { + struct device *dev =3D ðqos->pdev->dev; volatile unsigned int dll_lock; unsigned int i, retry =3D 1000; =20 @@ -540,8 +544,7 @@ static int ethqos_configure(struct qcom_ethqos *ethqos) retry--; } while (retry > 0); if (!retry) - dev_err(ðqos->pdev->dev, - "Timeout while waiting for DLL lock\n"); + dev_err(dev, "Timeout while waiting for DLL lock\n"); } =20 if (ethqos->speed =3D=3D SPEED_1000) @@ -597,6 +600,7 @@ static int qcom_ethqos_probe(struct platform_device *pd= ev) const struct ethqos_emac_driver_data *data; struct plat_stmmacenet_data *plat_dat; struct stmmac_resources stmmac_res; + struct device *dev =3D &pdev->dev; struct qcom_ethqos *ethqos; int ret; =20 @@ -606,13 +610,13 @@ static int qcom_ethqos_probe(struct platform_device *= pdev) =20 plat_dat =3D stmmac_probe_config_dt(pdev, stmmac_res.mac); if (IS_ERR(plat_dat)) { - dev_err(&pdev->dev, "dt configuration failed\n"); + dev_err(dev, "dt configuration failed\n"); return PTR_ERR(plat_dat); } =20 plat_dat->clks_config =3D ethqos_clks_config; =20 - ethqos =3D devm_kzalloc(&pdev->dev, sizeof(*ethqos), GFP_KERNEL); + ethqos =3D devm_kzalloc(dev, sizeof(*ethqos), GFP_KERNEL); if (!ethqos) { ret =3D -ENOMEM; goto out_config_dt; @@ -625,13 +629,13 @@ static int qcom_ethqos_probe(struct platform_device *= pdev) goto out_config_dt; } =20 - data =3D of_device_get_match_data(&pdev->dev); + data =3D of_device_get_match_data(dev); ethqos->por =3D data->por; ethqos->num_por =3D data->num_por; ethqos->rgmii_config_loopback_en =3D data->rgmii_config_loopback_en; ethqos->has_emac3 =3D data->has_emac3; =20 - ethqos->rgmii_clk =3D devm_clk_get(&pdev->dev, "rgmii"); + ethqos->rgmii_clk =3D devm_clk_get(dev, "rgmii"); if (IS_ERR(ethqos->rgmii_clk)) { ret =3D PTR_ERR(ethqos->rgmii_clk); goto out_config_dt; @@ -641,7 +645,7 @@ static int qcom_ethqos_probe(struct platform_device *pd= ev) if (ret) goto out_config_dt; =20 - ret =3D devm_add_action_or_reset(&pdev->dev, ethqos_clks_disable, ethqos); + ret =3D devm_add_action_or_reset(dev, ethqos_clks_disable, ethqos); if (ret) goto out_config_dt; =20 @@ -660,7 +664,7 @@ static int qcom_ethqos_probe(struct platform_device *pd= ev) if (of_device_is_compatible(np, "qcom,qcs404-ethqos")) plat_dat->rx_clk_runs_in_lpi =3D 1; =20 - ret =3D stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); + ret =3D stmmac_dvr_probe(dev, plat_dat, &stmmac_res); if (ret) goto out_config_dt; =20 --=20 2.39.2