[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201214091616.13545-16-Sergey.Semin@baikalelectronics.ru>
Date: Mon, 14 Dec 2020 12:16:05 +0300
From: Serge Semin <Sergey.Semin@...kalelectronics.ru>
To: Rob Herring <robh+dt@...nel.org>,
Giuseppe Cavallaro <peppe.cavallaro@...com>,
Alexandre Torgue <alexandre.torgue@...com>,
Jose Abreu <joabreu@...opsys.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Johan Hovold <johan@...nel.org>,
Maxime Ripard <mripard@...nel.org>,
Joao Pinto <jpinto@...opsys.com>,
Lars Persson <larper@...s.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>
CC: Serge Semin <Sergey.Semin@...kalelectronics.ru>,
Serge Semin <fancer.lancer@...il.com>,
Alexey Malahov <Alexey.Malahov@...kalelectronics.ru>,
Pavel Parkhomenko <Pavel.Parkhomenko@...kalelectronics.ru>,
Vyacheslav Mitrofanov
<Vyacheslav.Mitrofanov@...kalelectronics.ru>,
<netdev@...r.kernel.org>,
<linux-stm32@...md-mailman.stormreply.com>,
<linux-arm-kernel@...ts.infradead.org>,
<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH 15/25] net: stmmac: Use optional clock request method to get pclk
Let's replace the manual implementation of the optional "pclk"
functionality with using devm_clk_get_optional(). By doing so we'll
improve the code maintainability, and fix a hidden bug which will cause
problems if the "pclk" clock has been actually passed to the device, but
the clock framework failed to request it.
Signed-off-by: Serge Semin <Sergey.Semin@...kalelectronics.ru>
---
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index e79b3e3351a9..3809b00d3077 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -579,15 +579,13 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
clk_prepare_enable(plat->stmmac_clk);
- plat->pclk = devm_clk_get(&pdev->dev, "pclk");
+ plat->pclk = devm_clk_get_optional(&pdev->dev, "pclk");
if (IS_ERR(plat->pclk)) {
- if (PTR_ERR(plat->pclk) == -EPROBE_DEFER) {
- rc = PTR_ERR(plat->pclk);
- goto error_pclk_get;
- }
-
- plat->pclk = NULL;
+ rc = PTR_ERR(plat->pclk);
+ dev_err_probe(&pdev->dev, rc, "Cannot get CSR clock\n");
+ goto error_pclk_get;
}
+
clk_prepare_enable(plat->pclk);
/* Fall-back to main clock in case of no PTP ref is passed */
--
2.29.2
Powered by blists - more mailing lists