From: Jonathan Cameron <jic23@kernel.org>
To: Sergiu Cuciurean <sergiu.cuciurean@analog.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-iio@vger.kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
"Stefan Popa" <stefan.popa@analog.com>,
"Hartmut Knaack" <knaack.h@gmx.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Subject: Re: [PATCH] iio: dac: ad5380: Replace indio_dev->mlock with own device lock
Date: Sat, 16 May 2020 16:26:26 +0100 [thread overview]
Message-ID: <20200516162626.26d04b06@archlinux> (raw)
In-Reply-To: <20200514091312.81032-1-sergiu.cuciurean@analog.com>
On Thu, 14 May 2020 12:13:11 +0300
Sergiu Cuciurean <sergiu.cuciurean@analog.com> wrote:
> As part of the general cleanup of indio_dev->mlock, this change replaces
> it with a local lock on the device's state structure.
>
> Signed-off-by: Sergiu Cuciurean <sergiu.cuciurean@analog.com>
Applied,
Thanks,
Jonathan
> ---
> drivers/iio/dac/ad5380.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/dac/ad5380.c b/drivers/iio/dac/ad5380.c
> index 2ebe08326048..b37e5675f716 100644
> --- a/drivers/iio/dac/ad5380.c
> +++ b/drivers/iio/dac/ad5380.c
> @@ -51,6 +51,7 @@ struct ad5380_chip_info {
> * @vref_reg: vref supply regulator
> * @vref: actual reference voltage used in uA
> * @pwr_down: whether the chip is currently in power down mode
> + * @lock lock to protect the data buffer during regmap ops
> */
>
> struct ad5380_state {
> @@ -59,6 +60,7 @@ struct ad5380_state {
> struct regulator *vref_reg;
> int vref;
> bool pwr_down;
> + struct mutex lock;
> };
>
> enum ad5380_type {
> @@ -98,7 +100,7 @@ static ssize_t ad5380_write_dac_powerdown(struct iio_dev *indio_dev,
> if (ret)
> return ret;
>
> - mutex_lock(&indio_dev->mlock);
> + mutex_lock(&st->lock);
>
> if (pwr_down)
> ret = regmap_write(st->regmap, AD5380_REG_SF_PWR_DOWN, 0);
> @@ -107,7 +109,7 @@ static ssize_t ad5380_write_dac_powerdown(struct iio_dev *indio_dev,
>
> st->pwr_down = pwr_down;
>
> - mutex_unlock(&indio_dev->mlock);
> + mutex_unlock(&st->lock);
>
> return ret ? ret : len;
> }
> @@ -390,6 +392,8 @@ static int ad5380_probe(struct device *dev, struct regmap *regmap,
> indio_dev->modes = INDIO_DIRECT_MODE;
> indio_dev->num_channels = st->chip_info->num_channels;
>
> + mutex_init(&st->lock);
> +
> ret = ad5380_alloc_channels(indio_dev);
> if (ret) {
> dev_err(dev, "Failed to allocate channel spec: %d\n", ret);
prev parent reply other threads:[~2020-05-16 15:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-14 9:13 [PATCH] iio: dac: ad5380: Replace indio_dev->mlock with own device lock Sergiu Cuciurean
2020-05-16 15:26 ` Jonathan Cameron [this message]
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=20200516162626.26d04b06@archlinux \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=sergiu.cuciurean@analog.com \
--cc=stefan.popa@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;
as well as URLs for NNTP newsgroup(s).