From: Nuno Sa via B4 Relay <devnull+nuno.sa.analog.com@kernel.org>
To: linux-iio@vger.kernel.org
Cc: Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Jonathan Cameron <jic23@kernel.org>,
David Lechner <dlechner@baylibre.com>
Subject: [PATCH v3 1/2] iio: adc: adi-axi-adc: don't allow concurrent enable/disable calls
Date: Fri, 31 May 2024 11:41:54 +0200 [thread overview]
Message-ID: <20240531-dev-axi-adc-drp-v3-1-e3fa79447c67@analog.com> (raw)
In-Reply-To: <20240531-dev-axi-adc-drp-v3-0-e3fa79447c67@analog.com>
From: Nuno Sa <nuno.sa@analog.com>
Add proper mutex guards as we should not be able to disable
the core in the middle of enabling it.
Note there's no need to rush in backporting this as the only user of the
backend does not do anything crazy..
Fixes: 794ef0e57854 ("iio: adc: adi-axi-adc: move to backend framework")
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
---
drivers/iio/adc/adi-axi-adc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c
index 0cf0d81358fd..bf51d619ebbc 100644
--- a/drivers/iio/adc/adi-axi-adc.c
+++ b/drivers/iio/adc/adi-axi-adc.c
@@ -85,6 +85,7 @@ static int axi_adc_enable(struct iio_backend *back)
struct adi_axi_adc_state *st = iio_backend_get_priv(back);
int ret;
+ guard(mutex)(&st->lock);
ret = regmap_set_bits(st->regmap, ADI_AXI_REG_RSTN,
ADI_AXI_REG_RSTN_MMCM_RSTN);
if (ret)
@@ -99,6 +100,7 @@ static void axi_adc_disable(struct iio_backend *back)
{
struct adi_axi_adc_state *st = iio_backend_get_priv(back);
+ guard(mutex)(&st->lock);
regmap_write(st->regmap, ADI_AXI_REG_RSTN, 0);
}
--
2.45.1
next prev parent reply other threads:[~2024-05-31 9:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-31 9:41 [PATCH v3 0/2] iio: adc: adi-axi-adc: make sure DRP is locked on enable Nuno Sa via B4 Relay
2024-05-31 9:41 ` Nuno Sa via B4 Relay [this message]
2024-05-31 9:41 ` [PATCH v3 2/2] " Nuno Sa via B4 Relay
2024-06-02 9:13 ` [PATCH v3 0/2] " 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=20240531-dev-axi-adc-drp-v3-1-e3fa79447c67@analog.com \
--to=devnull+nuno.sa.analog.com@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=nuno.sa@analog.com \
/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