[PATCH] iio: adc: sun20i-gpadc: Use devm_reset_control_get_exclusive_deasserted() in sun20i_gpadc_probe()

Markus Elfring Markus.Elfring at web.de
Sat Nov 14 09:08:10 PST 2026


From: Markus Elfring <elfring at 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 at 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




More information about the linux-arm-kernel mailing list