On Tue, 19 Mar 2024 01:29:21 +0100 Vasileios Amoiridis <vassilisamir@xxxxxxxxx> wrote: > Introduce the new linux/cleanup.h with the guard(mutex) functionality > in the {read/write}_raw() functions > > Suggested-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> > Suggested-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > Signed-off-by: Vasileios Amoiridis <vassilisamir@xxxxxxxxx> > --- > drivers/iio/pressure/bmp280-core.c | 125 +++++++++++++---------------- > 1 file changed, 58 insertions(+), 67 deletions(-) > > diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c > index 871b2214121b..f7a13ff6f26c 100644 > --- a/drivers/iio/pressure/bmp280-core.c > +++ b/drivers/iio/pressure/bmp280-core.c > @@ -460,77 +460,74 @@ static int bmp280_read_humid(struct bmp280_data *data, int *val, int *val2) > return IIO_VAL_INT; > } > > -static int bmp280_read_raw(struct iio_dev *indio_dev, > - struct iio_chan_spec const *chan, > - int *val, int *val2, long mask) > +static int bmp280_read_raw_guarded(struct iio_dev *indio_dev, Why do we need the guarded naming? It always took the lock, no change just because we are doing that in a neater fashion. I don't see a reason for that name. Better to use something like _impl, or _internal as the prefix. I don't want to see people calling every function that uses guard _guarded(). > + struct iio_chan_spec const *chan, > + int *val, int *val2, long mask) Otherwise, I didn't find anything beyond what Andy already pointed out. So looks good in general. Jonathan