public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: David Lechner <dlechner@baylibre.com>
To: Rajveer Chaudhari <rajveer.chaudhari.linux@gmail.com>,
	jic23@kernel.org, nuno.sa@analog.com, andy@kernel.org,
	waqar.hameed@axis.com, linusw@kernel.org,
	sakari.ailus@linux.intel.com, harshit.m.mogalapalli@oracle.com,
	antoniu.miclaus@analog.com, andrew.ijano@gmail.com
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 8/8] iio: accel: sca3000: convert to guard(mutex)
Date: Sat, 14 Mar 2026 14:45:44 -0500	[thread overview]
Message-ID: <bc6c21a0-e324-471a-917b-bf0c3d34d504@baylibre.com> (raw)
In-Reply-To: <20260314170609.26827-9-rajveer.chaudhari.linux@gmail.com>

On 3/14/26 12:06 PM, Rajveer Chaudhari wrote:
> Replace manual mutex_lock/mutex_unlock pair with guard(mutex) in
> sca3000_print_rev(), sca3000_ring_int_process(),
> sca3000_read_event_config(), __sca3000_hw_ring_state_set(),
> sca3000_hw_ring_preenable(), sca3000_hw_ring_postdisable(),
> sca3000_clean_setup(), sca3000_stop_all_interrupts().
> This ensures the mutex is released on all return paths and
> allows returning directly without a goto label.
> 
> Signed-off-by: Rajveer Chaudhari <rajveer.chaudhari.linux@gmail.com>
> ---

...

> @@ -1132,24 +1131,18 @@ static int sca3000_read_event_config(struct iio_dev *indio_dev,
>  		 */
>  		if ((st->rx[0] & SCA3000_REG_MODE_MODE_MASK)
>  		    != SCA3000_REG_MODE_MEAS_MODE_MOT_DET) {

can drop this { now.

> -			ret = 0;
> -		} else {
> -			ret = sca3000_read_ctrl_reg(st,
> -						SCA3000_REG_CTRL_SEL_MD_CTRL);
> -			if (ret < 0)
> -				goto error_ret;
> -			/* only supporting logical or's for now */
> -			ret = !!(ret & sca3000_addresses[chan->address][2]);
> +			return 0;
>  		}
> -		break;
> +
> +		ret = sca3000_read_ctrl_reg(st,
> +					SCA3000_REG_CTRL_SEL_MD_CTRL);
> +		if (ret < 0)
> +			return ret;
> +		/* only supporting logical or's for now */
> +		return !!(ret & sca3000_addresses[chan->address][2]);
>  	default:
> -		ret = -EINVAL;
> +		return -EINVAL;
>  	}
> -
> -error_ret:
> -	mutex_unlock(&st->lock);
> -
> -	return ret;
>  }
>  

  reply	other threads:[~2026-03-14 19:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-14 17:06 [PATCH v4 0/8] iio: accel: convert to guard(mutex) Rajveer Chaudhari
2026-03-14 17:06 ` [PATCH v4 1/8] iio: accel: bmc150: sort headers alphabetically Rajveer Chaudhari
2026-03-14 19:41   ` David Lechner
2026-03-14 17:06 ` [PATCH v4 2/8] iio: accel: bmc150: convert to guard(mutex) Rajveer Chaudhari
2026-03-15 23:15   ` Linus Walleij
2026-03-14 17:06 ` [PATCH v4 3/8] iio: accel: mma8452: sort headers alphabetically Rajveer Chaudhari
2026-03-14 17:06 ` [PATCH v4 4/8] iio: accel: mma8452: convert to guard(mutex) Rajveer Chaudhari
2026-03-14 17:06 ` [PATCH v4 5/8] iio: accel: mma9551: sort headers alphabetically Rajveer Chaudhari
2026-03-14 17:06 ` [PATCH v4 6/8] iio: accel: mma9551: convert to guard(mutex) Rajveer Chaudhari
2026-03-14 17:06 ` [PATCH v4 7/8] iio: accel: sca3000: sort headers alphabetically Rajveer Chaudhari
2026-03-14 17:06 ` [PATCH v4 8/8] iio: accel: sca3000: convert to guard(mutex) Rajveer Chaudhari
2026-03-14 19:45   ` David Lechner [this message]
2026-03-15 19:13   ` Jonathan Cameron
2026-03-15 19:05 ` [PATCH v4 0/8] iio: accel: " Jonathan Cameron

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=bc6c21a0-e324-471a-917b-bf0c3d34d504@baylibre.com \
    --to=dlechner@baylibre.com \
    --cc=andrew.ijano@gmail.com \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=harshit.m.mogalapalli@oracle.com \
    --cc=jic23@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=rajveer.chaudhari.linux@gmail.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=waqar.hameed@axis.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