[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230612183839.zcn5glnhptptmbt4@halaney-x13s>
Date: Mon, 12 Jun 2023 13:38:39 -0500
From: Andrew Halaney <ahalaney@...hat.com>
To: Bartosz Golaszewski <brgl@...ev.pl>
Cc: Vinod Koul <vkoul@...nel.org>,
Bhupesh Sharma <bhupesh.sharma@...aro.org>,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Kishon Vijay Abraham I <kishon@...nel.org>,
Giuseppe Cavallaro <peppe.cavallaro@...com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>, netdev@...r.kernel.org,
linux-arm-msm@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-phy@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org,
linux-stm32@...md-mailman.stormreply.com,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH 08/26] net: stmmac: dwmac-qcom-ethqos: use a helper
variable for &pdev->dev
On Mon, Jun 12, 2023 at 11:23:37AM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
>
> Shrink code and avoid line breaks by using a helper variable for
> &pdev->dev.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
> ---
> .../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/drivers/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 = priv;
> + struct device *dev = ðqos->pdev->dev;
>
> - 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));
> }
>
> @@ -242,6 +243,7 @@ static const struct ethqos_emac_driver_data emac_v3_0_0_data = {
>
> static int ethqos_dll_configure(struct qcom_ethqos *ethqos)
> {
> + struct device *dev = ðqos->pdev->dev;
> unsigned int val;
> int retry = 1000;
>
> @@ -279,7 +281,7 @@ static int ethqos_dll_configure(struct qcom_ethqos *ethqos)
> 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");
>
> /* 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 *ethqos)
> 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");
>
> /* 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 *ethqos)
>
> static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos)
> {
> + struct device *dev = ðqos->pdev->dev;
> int phase_shift;
> int phy_mode;
> int loopback;
>
> /* Determine if the PHY adds a 2 ns TX delay or the MAC handles it */
> - phy_mode = device_get_phy_mode(ðqos->pdev->dev);
> + phy_mode = device_get_phy_mode(dev);
> if (phy_mode == PHY_INTERFACE_MODE_RGMII_ID ||
> phy_mode == PHY_INTERFACE_MODE_RGMII_TXID)
> phase_shift = 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);
nit: You could put this on the prior line now
With that in place, feel free to add:
Reviewed-by: Andrew Halaney <ahalaney@...hat.com>
Powered by blists - more mailing lists