Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: linux-sunxi@lists.linux.dev, linux-iio@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	"Andy Shevchenko" <andy@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Chen-Yu Tsai" <wens@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Giorgi Tchankvetadze" <giorgitchankvetadze1997@gmail.com>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Michal Piekos" <michal.piekos@mmpsystems.pl>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Samuel Holland" <samuel@sholland.org>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org, Felix Gu <ustc.gu@gmail.com>
Subject: [PATCH] iio: adc: sun20i-gpadc: Use devm_reset_control_get_exclusive_deasserted() in sun20i_gpadc_probe()
Date: Sat, 14 Nov 2026 18:08:10 +0100	[thread overview]
Message-ID: <368d548f-2b86-4da5-857a-6ee9473a8d0e@web.de> (raw)

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



             reply	other threads:[~2026-11-14 17:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 17:08 Markus Elfring [this message]
2026-11-14 17:19 ` [PATCH] iio: adc: sun20i-gpadc: Use devm_reset_control_get_exclusive_deasserted() in sun20i_gpadc_probe() Jernej Škrabec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=368d548f-2b86-4da5-857a-6ee9473a8d0e@web.de \
    --to=markus.elfring@web.de \
    --cc=andy@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=dlechner@baylibre.com \
    --cc=giorgitchankvetadze1997@gmail.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jic23@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=michal.piekos@mmpsystems.pl \
    --cc=nuno.sa@analog.com \
    --cc=p.zabel@pengutronix.de \
    --cc=samuel@sholland.org \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=ustc.gu@gmail.com \
    --cc=wens@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox