lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240906084841.19248-1-yingzuxin@vivo.com>
Date: Fri,  6 Sep 2024 16:48:31 +0800
From: ying zuxin <yingzuxin@...o.com>
To: Herve Codina <herve.codina@...tlin.com>,
	Liam Girdwood <lgirdwood@...il.com>,
	Mark Brown <broonie@...nel.org>,
	Jaroslav Kysela <perex@...ex.cz>,
	Takashi Iwai <tiwai@...e.com>,
	alsa-devel@...a-project.org (moderated list:INFINEON PEB2466 ASoC CODEC),
	linux-sound@...r.kernel.org (open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...),
	linux-kernel@...r.kernel.org (open list)
Cc: opensource.kernel@...o.com,
	yang.yang@...o.com,
	ying zuxin <11154159@...o.com>
Subject: [PATCH] ASoC: codecs: Use devm_clk_get_enabled() helpers

From: ying zuxin <11154159@...o.com>

The devm_clk_get_enabled() helpers:
    - call devm_clk_get()
    - call clk_prepare_enable() and register what is needed in order to
     call clk_disable_unprepare() when needed, as a managed resource.

This simplifies the code and avoids the calls to clk_disable_unprepare().

Signed-off-by: ying zuxin <11154159@...o.com>
---
 sound/soc/codecs/peb2466.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/sound/soc/codecs/peb2466.c b/sound/soc/codecs/peb2466.c
index 76ee7e3f4d9b..b67cfad4fc32 100644
--- a/sound/soc/codecs/peb2466.c
+++ b/sound/soc/codecs/peb2466.c
@@ -1975,12 +1975,9 @@ static int peb2466_spi_probe(struct spi_device *spi)
 	if (IS_ERR(peb2466->reset_gpio))
 		return PTR_ERR(peb2466->reset_gpio);
 
-	peb2466->mclk = devm_clk_get(&peb2466->spi->dev, "mclk");
+	peb2466->mclk = devm_clk_get_enabled(&peb2466->spi->dev, "mclk");
 	if (IS_ERR(peb2466->mclk))
 		return PTR_ERR(peb2466->mclk);
-	ret = clk_prepare_enable(peb2466->mclk);
-	if (ret)
-		return ret;
 
 	if (peb2466->reset_gpio) {
 		gpiod_set_value_cansleep(peb2466->reset_gpio, 1);
@@ -2031,17 +2028,9 @@ static int peb2466_spi_probe(struct spi_device *spi)
 	return 0;
 
 failed:
-	clk_disable_unprepare(peb2466->mclk);
 	return ret;
 }
 
-static void peb2466_spi_remove(struct spi_device *spi)
-{
-	struct peb2466 *peb2466 = spi_get_drvdata(spi);
-
-	clk_disable_unprepare(peb2466->mclk);
-}
-
 static const struct of_device_id peb2466_of_match[] = {
 	{ .compatible = "infineon,peb2466", },
 	{ }
@@ -2061,7 +2050,6 @@ static struct spi_driver peb2466_spi_driver = {
 	},
 	.id_table = peb2466_id_table,
 	.probe  = peb2466_spi_probe,
-	.remove = peb2466_spi_remove,
 };
 
 module_spi_driver(peb2466_spi_driver);
-- 
2.39.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ