From nobody Sun Feb 8 15:29:08 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 300F3EB64DC for ; Thu, 15 Jun 2023 12:15:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344781AbjFOMPg (ORCPT ); Thu, 15 Jun 2023 08:15:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344733AbjFOMOy (ORCPT ); Thu, 15 Jun 2023 08:14:54 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B681C269A for ; Thu, 15 Jun 2023 05:14:45 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3f8cc04c287so17457735e9.0 for ; Thu, 15 Jun 2023 05:14:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1686831284; x=1689423284; 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=cX9gh1Qiyxf8dBz8QJPkiT5qyQqbjJsIR5XZjH6yJKE=; b=4UidRm4NNnXMzbr03wDLiofz3gX/tDVsDRsFiIt2GCKZr9xu3kI3P/1iiyrEJ5Id0l EzcZmwPFk4KIx5xPw9EDsNFkzGrWlKEz2/lL9Scukx1QVBxwkHGKqQO7qqWiYFEy9gAX gMXHPGdLbhLTwfinx9c/Iihysp3xzIJADktLaJXZXyVMVMmCCzwFDqfT46YWevyF0Gw4 3jcMVKq/yipZ4k9KzmgWDKWJZ2sls3WArB4uKiSLIMYUJcuEt3HFTdyPZPiPhRZhQzd2 mrk/2WuFpO2/FFs9d9Z1XS0rK4NA+ZYPTfWUp1ynrCJugfErdrCLs3OENDmtHRFMJ9vP IuJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686831284; x=1689423284; 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=cX9gh1Qiyxf8dBz8QJPkiT5qyQqbjJsIR5XZjH6yJKE=; b=h4vid+2Y58iMxOG59UmseyQ0hdhmmRR8AMKkKtaoecsVUw9EFKAmRBRLlvA3hd4Ugz l1RAIuW0nL4jNERCs+MtqaOotCEhZUkABPaqhCEMZ+xCrXh0W2JDEDtrmIdBuBPUwt2x FCkBMIpOh7DTPOOTmzJcqT+mscB+ImrQrZmpfdIbrn/DOm4/QA8ZTflSFsk5EaYEnCX7 ZuYS1BGqlV54xFll0S4UCswx/WPp+JDjcymhFWHpkrCxlHdRVN2BJhcrzUSyC7LSIWLD D0gCBvhWMAe9dE1+Bwbgo2Bb84GAd3FQ6E393PqP4rBTLXvChaCT5VXX+8spwElJGFbN L6vg== X-Gm-Message-State: AC+VfDxUZpA9xvzsrUH0mxEtK096oHXx/D1SG1M10IBFWgMXI9EEAn1d C6Qy+dI9gyb9MbE65TcN1O5Mag== X-Google-Smtp-Source: ACHHUZ4kkzeyF5iFPaPt1a1Bfq+qLf+3zfTeM2Z6V1K2TWdpT7Rg5m3uWYN1Eu2tqs3PLNAhAI/vmw== X-Received: by 2002:a5d:668c:0:b0:311:13e6:6504 with SMTP id l12-20020a5d668c000000b0031113e66504mr1501402wru.47.1686831283884; Thu, 15 Jun 2023 05:14:43 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:2ad4:65a7:d9f3:a64e]) by smtp.gmail.com with ESMTPSA id k17-20020a5d4291000000b003047ea78b42sm20918012wrq.43.2023.06.15.05.14.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jun 2023 05:14:43 -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 , Andrew Halaney Subject: [PATCH v2 08/23] net: stmmac: dwmac-qcom-ethqos: use a helper variable for &pdev->dev Date: Thu, 15 Jun 2023 14:14:04 +0200 Message-Id: <20230615121419.175862-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230615121419.175862-1-brgl@bgdev.pl> References: <20230615121419.175862-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 Reviewed-by: Andrew Halaney --- .../stmicro/stmmac/dwmac-qcom-ethqos.c | 49 ++++++++++--------- 1 file changed, 26 insertions(+), 23 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..f0776ddea3ab 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,8 +471,7 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *= ethqos) loopback, RGMII_IO_MACRO_CONFIG); break; default: - dev_err(ðqos->pdev->dev, - "Invalid speed %d\n", ethqos->speed); + dev_err(dev, "Invalid speed %d\n", ethqos->speed); return -EINVAL; } =20 @@ -478,6 +480,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 +543,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 +599,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 +609,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 +628,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 +644,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 +663,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