Message ID | 20210121114954.64156-2-nuno.sa@analog.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fix/Improve sync clock mode handling | expand |
On Thu, 21 Jan 2021 12:49:51 +0100 Nuno Sá <nuno.sa@analog.com> wrote: > Add some helpers to lock and unlock the device. > > Signed-off-by: Nuno Sá <nuno.sa@analog.com> Hi Nuno For a patch like this I'd also expect to see it immediately used in all relevant places in the driver. I don't want a mixture going forwards of this vs direct access to the lock. No need to separate that into two patches for such a simple case just introduce this and put it to use. There aren't that many call sites anyway from a quick grep. Thanks, Jonathan > --- > include/linux/iio/imu/adis.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h > index 04e96d688ba9..f9b728d490b1 100644 > --- a/include/linux/iio/imu/adis.h > +++ b/include/linux/iio/imu/adis.h > @@ -428,6 +428,16 @@ static inline int adis_initial_startup(struct adis *adis) > return ret; > } > > +static inline void adis_dev_lock(struct adis *adis) > +{ > + mutex_lock(&adis->state_lock); > +} > + > +static inline void adis_dev_unlock(struct adis *adis) > +{ > + mutex_unlock(&adis->state_lock); > +} > + > int adis_single_conversion(struct iio_dev *indio_dev, > const struct iio_chan_spec *chan, unsigned int error_mask, > int *val);
> From: Jonathan Cameron <jic23@kernel.org> > Sent: Sunday, January 24, 2021 2:30 PM > To: Sa, Nuno <Nuno.Sa@analog.com> > Cc: devicetree@vger.kernel.org; linux-iio@vger.kernel.org; Rob > Herring <robh+dt@kernel.org>; Peter Meerwald-Stadler > <pmeerw@pmeerw.net>; Lars-Peter Clausen <lars@metafoo.de>; > Hennerich, Michael <Michael.Hennerich@analog.com>; Ardelean, > Alexandru <alexandru.Ardelean@analog.com> > Subject: Re: [PATCH 1/4] iio: adis: add helpers for locking > > > On Thu, 21 Jan 2021 12:49:51 +0100 > Nuno Sá <nuno.sa@analog.com> wrote: > > > Add some helpers to lock and unlock the device. > > > > Signed-off-by: Nuno Sá <nuno.sa@analog.com> > > Hi Nuno > Hi Jonathan, > For a patch like this I'd also expect to see it immediately used in > all relevant places in the driver. I don't want a mixture > going forwards of this vs direct access to the lock. Fully agreed... > No need to separate that into two patches for such a simple case > just introduce this and put it to use. There aren't that > many call sites anyway from a quick grep. > Ok, will do that in v2. - Nuno Sá
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h index 04e96d688ba9..f9b728d490b1 100644 --- a/include/linux/iio/imu/adis.h +++ b/include/linux/iio/imu/adis.h @@ -428,6 +428,16 @@ static inline int adis_initial_startup(struct adis *adis) return ret; } +static inline void adis_dev_lock(struct adis *adis) +{ + mutex_lock(&adis->state_lock); +} + +static inline void adis_dev_unlock(struct adis *adis) +{ + mutex_unlock(&adis->state_lock); +} + int adis_single_conversion(struct iio_dev *indio_dev, const struct iio_chan_spec *chan, unsigned int error_mask, int *val);
Add some helpers to lock and unlock the device. Signed-off-by: Nuno Sá <nuno.sa@analog.com> --- include/linux/iio/imu/adis.h | 10 ++++++++++ 1 file changed, 10 insertions(+)