mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iio: adc: sun20i-gpadc: Use devm_reset_control_get_exclusive_deasserted() in sun20i_gpadc_probe()
@ 2026-11-14 17:08 Markus Elfring
  2026-11-14 17:19 ` Jernej Škrabec
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2026-11-14 17:08 UTC (permalink / raw)
  To: linux-sunxi, linux-iio, linux-arm-kernel, Andy Shevchenko,
	Bjorn Helgaas, Chen-Yu Tsai, David Lechner, Giorgi Tchankvetadze,
	Jernej Skrabec, Jonathan Cameron, Michal Piekos, Nuno Sá,
	Philipp Zabel, Samuel Holland, Uwe Kleine-König
  Cc: LKML, kernel-janitors, Felix Gu

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 14 Nov 2026 17:55:16 +0100

Use devm_reset_control_get_exclusive_deasserted() to replace the
explicit reset acquisition, deassertion, and cleanup action registered
with devm_add_action_or_reset().
Simplify reset handling and remove the custom reset assertion callback
while preserving reset assertion during cleanup.

The source code was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/iio/adc/sun20i-gpadc-iio.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/iio/adc/sun20i-gpadc-iio.c b/drivers/iio/adc/sun20i-gpadc-iio.c
index baa7661db13b..070d061572c6 100644
--- a/drivers/iio/adc/sun20i-gpadc-iio.c
+++ b/drivers/iio/adc/sun20i-gpadc-iio.c
@@ -157,13 +157,6 @@ static const struct iio_info sun20i_gpadc_iio_info = {
 	.fwnode_xlate = sun20i_gpadc_fwnode_xlate,
 };
 
-static void sun20i_gpadc_reset_assert(void *data)
-{
-	struct reset_control *rst = data;
-
-	reset_control_assert(rst);
-}
-
 static const struct iio_chan_spec sun20i_gpadc_chan_template = {
 	.type = IIO_VOLTAGE,
 	.indexed = 1,
@@ -225,17 +218,10 @@ static int sun20i_gpadc_probe(struct platform_device *pdev)
 	if (ret == 0)
 		return dev_err_probe(dev, -ENODEV, "needs at least one clocks\n");
 
-	rst = devm_reset_control_get_exclusive(dev, NULL);
+	rst = devm_reset_control_get_exclusive_deasserted(dev, NULL);
 	if (IS_ERR(rst))
-		return dev_err_probe(dev, PTR_ERR(rst), "failed to get reset control\n");
-
-	ret = reset_control_deassert(rst);
-	if (ret)
-		return dev_err_probe(dev, ret, "failed to deassert reset\n");
-
-	ret = devm_add_action_or_reset(dev, sun20i_gpadc_reset_assert, rst);
-	if (ret)
-		return ret;
+		return dev_err_probe(dev, PTR_ERR(rst),
+				     "failed to get and deassert reset\n");
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
-- 
2.56.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-14 17:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-14 17:08 [PATCH] iio: adc: sun20i-gpadc: Use devm_reset_control_get_exclusive_deasserted() in sun20i_gpadc_probe() Markus Elfring
2026-11-14 17:19 ` Jernej Škrabec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®