[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250910193641.7c982d46@jic23-huawei>
Date: Wed, 10 Sep 2025 19:36:41 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: Sean Nyekjaer <sean@...nix.com>, Jean-Baptiste Maneyrol
<jean-baptiste.maneyrol@....com>, rafael@...nel.org, David Lechner
<dlechner@...libre.com>, Nuno Sá <nuno.sa@...log.com>, Andy
Shevchenko <andy@...nel.org>, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org, Jean-Baptiste
Maneyrol <jmaneyrol@...ensense.com>, Jonathan Cameron
<Jonathan.Cameron@...wei.com>
Subject: Re: [PATCH v4 5/5] iio: imu: inv_icm42600: use guard() to release
mutexes
On Tue, 9 Sep 2025 16:15:04 +0300
Andy Shevchenko <andriy.shevchenko@...el.com> wrote:
> On Tue, Sep 09, 2025 at 11:53:02AM +0000, Sean Nyekjaer wrote:
> > On Tue, Sep 09, 2025 at 02:39:12PM +0100, Andy Shevchenko wrote:
> > > On Tue, Sep 09, 2025 at 09:11:11AM +0200, Sean Nyekjaer wrote:
>
> ...
>
> > > > /* exit if FIFO is already on */
> > > > if (st->fifo.on) {
> > > > - ret = 0;
> > > > - goto out_on;
> > >
> > > Probably you wanted the same comment here
> > >
> > > /* increase FIFO on counter */
> > >
> > > > + st->fifo.on++;
> > > > + return 0;
> > > > }
>
> ...
>
> > > > /* exit if there are several sensors using the FIFO */
> > > > if (st->fifo.on > 1) {
> > > > - ret = 0;
> > > > - goto out_off;
> > >
> > > In the similar way
> > >
> >
> > Considered it. But isn't it obvious whats happening?
>
> With the same equality existing ones may be killed. Some of consistency at least :-)
>
> > I will be happy to add them...
>
> > > /* decrease FIFO on counter */
> > >
> > > > + st->fifo.on--;
> > > > + return 0;
> > > > }
>
Applied with this tweak. Thanks
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c
index 15391961bf96..ada968be954d 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c
@@ -300,7 +300,6 @@ static int inv_icm42600_buffer_postenable(struct iio_dev *indio_dev)
guard(mutex)(&st->lock);
- /* exit if FIFO is already on */
if (st->fifo.on) {
st->fifo.on++;
return 0;
@@ -329,7 +328,6 @@ static int inv_icm42600_buffer_postenable(struct iio_dev *indio_dev)
if (ret)
return ret;
- /* increase FIFO on counter */
st->fifo.on++;
return 0;
@@ -342,7 +340,6 @@ static int inv_icm42600_buffer_predisable(struct iio_dev *indio_dev)
guard(mutex)(&st->lock);
- /* exit if there are several sensors using the FIFO */
if (st->fifo.on > 1) {
st->fifo.on--;
return 0;
@@ -366,7 +363,6 @@ static int inv_icm42600_buffer_predisable(struct iio_dev *indio_dev)
if (ret)
return ret;
- /* decrease FIFO on counter */
st->fifo.on--;
return 0;
Powered by blists - more mailing lists