public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Sean Nyekjaer" <sean@geanix.com>,
	"Jean-Baptiste Maneyrol" <jean-baptiste.maneyrol@tdk.com>,
	rafael@kernel.org, "David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org,
	"Jean-Baptiste Maneyrol" <jmaneyrol@invensense.com>,
	"Jonathan Cameron" <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH v4 5/5] iio: imu: inv_icm42600: use guard() to release mutexes
Date: Wed, 10 Sep 2025 19:36:41 +0100	[thread overview]
Message-ID: <20250910193641.7c982d46@jic23-huawei> (raw)
In-Reply-To: <aMAoWPAvOmOfgfaR@smile.fi.intel.com>

On Tue, 9 Sep 2025 16:15:04 +0300
Andy Shevchenko <andriy.shevchenko@intel.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;


  reply	other threads:[~2025-09-10 18:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-09  7:11 [PATCH v4 0/5] iio: imu: inv_icm42600: pm_runtime fixes + various changes Sean Nyekjaer
2025-09-09  7:11 ` [PATCH v4 1/5] iio: imu: inv_icm42600: Simplify pm_runtime setup Sean Nyekjaer
2025-09-09  7:11 ` [PATCH v4 2/5] iio: imu: inv_icm42600: Drop redundant pm_runtime reinitialization in resume Sean Nyekjaer
2025-09-09  7:11 ` [PATCH v4 3/5] iio: imu: inv_icm42600: Avoid configuring if already pm_runtime suspended Sean Nyekjaer
2025-09-09  7:11 ` [PATCH v4 4/5] iio: imu: inv_icm42600: Use devm_regulator_get_enable() for vdd regulator Sean Nyekjaer
2025-09-09  7:11 ` [PATCH v4 5/5] iio: imu: inv_icm42600: use guard() to release mutexes Sean Nyekjaer
2025-09-09 11:39   ` Andy Shevchenko
2025-09-09 11:53     ` Sean Nyekjaer
2025-09-09 13:15       ` Andy Shevchenko
2025-09-10 18:36         ` Jonathan Cameron [this message]
2025-09-09 14:03   ` David Lechner

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=20250910193641.7c982d46@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jean-baptiste.maneyrol@tdk.com \
    --cc=jmaneyrol@invensense.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=rafael@kernel.org \
    --cc=sean@geanix.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