* [PATCH] spi: atcspi200: Use helper function devm_clk_get_enabled()
@ 2026-03-10 8:53 Pei Xiao
2026-03-10 17:51 ` Mark Brown
2026-03-10 20:43 ` kernel test robot
0 siblings, 2 replies; 3+ messages in thread
From: Pei Xiao @ 2026-03-10 8:53 UTC (permalink / raw)
To: cl634, broonie, linux-spi, linux-kernel; +Cc: Pei Xiao
Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared
and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be
replaced by devm_clk_get_enabled(). Moreover, it is no longer necessary to
unprepare and disable the clocks explicitly.
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
---
drivers/spi/spi-atcspi200.c | 26 ++++++--------------------
1 file changed, 6 insertions(+), 20 deletions(-)
diff --git a/drivers/spi/spi-atcspi200.c b/drivers/spi/spi-atcspi200.c
index 2075058387f3..6d4f3ff3d602 100644
--- a/drivers/spi/spi-atcspi200.c
+++ b/drivers/spi/spi-atcspi200.c
@@ -486,11 +486,6 @@ static int atcspi_init_resources(struct platform_device *pdev,
return dev_err_probe(spi->dev, PTR_ERR(spi->regmap),
"Failed to init regmap\n");
- spi->clk = devm_clk_get(spi->dev, NULL);
- if (IS_ERR(spi->clk))
- return dev_err_probe(spi->dev, PTR_ERR(spi->clk),
- "Failed to get SPI clock\n");
-
spi->sclk_rate = ATCSPI_MAX_SPEED_HZ;
return 0;
}
@@ -528,11 +523,10 @@ static int atcspi_enable_clk(struct atcspi_dev *spi)
{
int ret;
- ret = clk_prepare_enable(spi->clk);
- if (ret)
- return dev_err_probe(spi->dev, ret,
- "Failed to enable clock\n");
-
+ spi->clk = devm_clk_get_enabled(spi->dev, NULL);
+ if (IS_ERR(spi->clk))
+ return dev_err_probe(spi->dev, PTR_ERR(spi->clk),
+ "Failed to get SPI clock\n");
spi->clk_rate = clk_get_rate(spi->clk);
if (!spi->clk_rate)
return dev_err_probe(spi->dev, -EINVAL,
@@ -582,17 +576,12 @@ static int atcspi_probe(struct platform_device *pdev)
goto free_controller;
atcspi_init_controller(pdev, spi, host, mem_res);
-
- ret = atcspi_setup(spi);
- if (ret)
- goto disable_clk;
+ atcspi_setup(spi);
ret = devm_spi_register_controller(&pdev->dev, host);
- if (ret) {
+ if (ret)
dev_err_probe(spi->dev, ret,
"Failed to register SPI controller\n");
- goto disable_clk;
- }
spi->use_dma = false;
if (ATCSPI_DMA_SUPPORT) {
@@ -607,9 +596,6 @@ static int atcspi_probe(struct platform_device *pdev)
return 0;
-disable_clk:
- clk_disable_unprepare(spi->clk);
-
free_controller:
spi_controller_put(host);
return ret;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] spi: atcspi200: Use helper function devm_clk_get_enabled()
2026-03-10 8:53 [PATCH] spi: atcspi200: Use helper function devm_clk_get_enabled() Pei Xiao
@ 2026-03-10 17:51 ` Mark Brown
2026-03-10 20:43 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-03-10 17:51 UTC (permalink / raw)
To: Pei Xiao; +Cc: cl634, linux-spi, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 450 bytes --]
On Tue, Mar 10, 2026 at 04:53:02PM +0800, Pei Xiao wrote:
> - ret = atcspi_setup(spi);
> - if (ret)
> - goto disable_clk;
> + atcspi_setup(spi);
Previously we checked the return code here, now we ignore it?
> ret = devm_spi_register_controller(&pdev->dev, host);
> - if (ret) {
> + if (ret)
> dev_err_probe(spi->dev, ret,
> "Failed to register SPI controller\n");
> - goto disable_clk;
> - }
Similarly (and more seriously) here?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] spi: atcspi200: Use helper function devm_clk_get_enabled()
2026-03-10 8:53 [PATCH] spi: atcspi200: Use helper function devm_clk_get_enabled() Pei Xiao
2026-03-10 17:51 ` Mark Brown
@ 2026-03-10 20:43 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-03-10 20:43 UTC (permalink / raw)
To: Pei Xiao, cl634, broonie, linux-spi, linux-kernel
Cc: llvm, oe-kbuild-all, Pei Xiao
Hi Pei,
kernel test robot noticed the following build warnings:
[auto build test WARNING on broonie-spi/for-next]
[also build test WARNING on linus/master v7.0-rc3 next-20260309]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Pei-Xiao/spi-atcspi200-Use-helper-function-devm_clk_get_enabled/20260310-165916
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
patch link: https://lore.kernel.org/r/9f6e31608a24f3cdbd6e1429c1e006ccf9f7d9c1.1773132237.git.xiaopei01%40kylinos.cn
patch subject: [PATCH] spi: atcspi200: Use helper function devm_clk_get_enabled()
config: riscv-randconfig-001-20260310 (https://download.01.org/0day-ci/archive/20260311/202603110449.mxLAYdGU-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260311/202603110449.mxLAYdGU-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603110449.mxLAYdGU-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/spi/spi-atcspi200.c:510:6: warning: unused variable 'ret' [-Wunused-variable]
510 | int ret;
| ^~~
1 warning generated.
vim +/ret +510 drivers/spi/spi-atcspi200.c
34e3815ea459713 CL Wang 2025-12-15 507
34e3815ea459713 CL Wang 2025-12-15 508 static int atcspi_enable_clk(struct atcspi_dev *spi)
34e3815ea459713 CL Wang 2025-12-15 509 {
34e3815ea459713 CL Wang 2025-12-15 @510 int ret;
34e3815ea459713 CL Wang 2025-12-15 511
7dd262df6a0fc29 Pei Xiao 2026-03-10 512 spi->clk = devm_clk_get_enabled(spi->dev, NULL);
7dd262df6a0fc29 Pei Xiao 2026-03-10 513 if (IS_ERR(spi->clk))
7dd262df6a0fc29 Pei Xiao 2026-03-10 514 return dev_err_probe(spi->dev, PTR_ERR(spi->clk),
7dd262df6a0fc29 Pei Xiao 2026-03-10 515 "Failed to get SPI clock\n");
34e3815ea459713 CL Wang 2025-12-15 516 spi->clk_rate = clk_get_rate(spi->clk);
34e3815ea459713 CL Wang 2025-12-15 517 if (!spi->clk_rate)
34e3815ea459713 CL Wang 2025-12-15 518 return dev_err_probe(spi->dev, -EINVAL,
34e3815ea459713 CL Wang 2025-12-15 519 "Failed to get SPI clock rate\n");
34e3815ea459713 CL Wang 2025-12-15 520
34e3815ea459713 CL Wang 2025-12-15 521 return 0;
34e3815ea459713 CL Wang 2025-12-15 522 }
34e3815ea459713 CL Wang 2025-12-15 523
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-10 20:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10 8:53 [PATCH] spi: atcspi200: Use helper function devm_clk_get_enabled() Pei Xiao
2026-03-10 17:51 ` Mark Brown
2026-03-10 20:43 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox