From: Felipe Ribeiro de Souza <felipers@ime.usp.br>
To: andy@kernel.org, dlechner@baylibre.com, jic23@kernel.org,
nuno.sa@analog.com, paul@crapouillou.net
Cc: Felipe Ribeiro de Souza <felipers@ime.usp.br>,
Lucas Ivars Cadima Ciziks <lucas@ciziks.com>,
linux-iio@vger.kernel.org, linux-mips@vger.kernel.org
Subject: [PATCH v5 1/3] iio: adc: ingenic-adc: rename ingenic_adc_enable_unlocked() function
Date: Tue, 5 May 2026 23:24:28 -0300 [thread overview]
Message-ID: <20260506022454.128169-2-felipers@ime.usp.br> (raw)
In-Reply-To: <20260506022454.128169-1-felipers@ime.usp.br>
Rename ingenic_adc_enable_unlocked() to __ingenic_adc_enable() to
better reflect that this helper must be called with the lock held.
Signed-off-by: Felipe Ribeiro de Souza <felipers@ime.usp.br>
Co-developed-by: Lucas Ivars Cadima Ciziks <lucas@ciziks.com>
Signed-off-by: Lucas Ivars Cadima Ciziks <lucas@ciziks.com>
---
v2:
- Adjust order of #include.
- Replace guard() in ingenic_adc_read_chan_info_raw() by scoped_guard()
to preserve original behavior.
v3:
- Split out ingenic_adc_read_chan_info_raw() logic to helper function.
v4:
- Adjust code style for better readability.
v5:
- Rename ingenic_adc_enable_unlocked() to __ingenic_adc_enable() and
ingenic_adc_read_chan_locked() to __ingenic_adc_read_chan() to keep
the convention about the locked functions name.
- Move the mutex lock back to ingenic_adc_read_chan_info_raw().
---
drivers/iio/adc/ingenic-adc.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/adc/ingenic-adc.c b/drivers/iio/adc/ingenic-adc.c
index 1e802c8779a4c..231ff8d584c2d 100644
--- a/drivers/iio/adc/ingenic-adc.c
+++ b/drivers/iio/adc/ingenic-adc.c
@@ -181,9 +181,8 @@ static void ingenic_adc_set_config(struct ingenic_adc *adc,
mutex_unlock(&adc->lock);
}
-static void ingenic_adc_enable_unlocked(struct ingenic_adc *adc,
- int engine,
- bool enabled)
+static void __ingenic_adc_enable(struct ingenic_adc *adc, int engine,
+ bool enabled)
{
u8 val;
@@ -202,7 +201,7 @@ static void ingenic_adc_enable(struct ingenic_adc *adc,
bool enabled)
{
mutex_lock(&adc->lock);
- ingenic_adc_enable_unlocked(adc, engine, enabled);
+ __ingenic_adc_enable(adc, engine, enabled);
mutex_unlock(&adc->lock);
}
@@ -222,11 +221,11 @@ static int ingenic_adc_capture(struct ingenic_adc *adc,
cfg = readl(adc->base + JZ_ADC_REG_CFG);
writel(cfg & ~JZ_ADC_REG_CFG_CMD_SEL, adc->base + JZ_ADC_REG_CFG);
- ingenic_adc_enable_unlocked(adc, engine, true);
+ __ingenic_adc_enable(adc, engine, true);
ret = readb_poll_timeout(adc->base + JZ_ADC_REG_ENABLE, val,
!(val & BIT(engine)), 250, 1000);
if (ret)
- ingenic_adc_enable_unlocked(adc, engine, false);
+ __ingenic_adc_enable(adc, engine, false);
writel(cfg, adc->base + JZ_ADC_REG_CFG);
mutex_unlock(&adc->lock);
--
2.43.0
next prev parent reply other threads:[~2026-05-06 2:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 2:24 [PATCH v5 0/3] iio: adc: ingenic-adc: use guard()() to handle synchronisation and refactor lock-held helpers Felipe Ribeiro de Souza
2026-05-06 2:24 ` Felipe Ribeiro de Souza [this message]
2026-05-06 2:24 ` [PATCH v5 2/3] iio: adc: ingenic-adc: refactor ingenic_adc_read_chan_info_raw() Felipe Ribeiro de Souza
2026-05-06 2:24 ` [PATCH v5 3/3] iio: adc: ingenic-adc: use guard()() and scoped_guard() to handle synchronisation Felipe Ribeiro de Souza
2026-05-06 9:19 ` Andy Shevchenko
2026-05-06 9:20 ` [PATCH v5 0/3] iio: adc: ingenic-adc: use guard()() to handle synchronisation and refactor lock-held helpers Andy Shevchenko
2026-05-06 18:12 ` Jonathan Cameron
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=20260506022454.128169-2-felipers@ime.usp.br \
--to=felipers@ime.usp.br \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=lucas@ciziks.com \
--cc=nuno.sa@analog.com \
--cc=paul@crapouillou.net \
/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