mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Vaibhav Chahar <vaibhav.chahar26@gmail.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	linux-iio@vger.kernel.org,
	"Marius Cristea" <marius.cristea@microchip.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Joshua Crofts" <crofts@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] iio: adc: mcp3564: Use guard() to manage locks
Date: Wed, 25 Nov 2026 13:24:32 +0200	[thread overview]
Message-ID: <awbFcJiIp6FR-gAt@ashevche-desk.local> (raw)
In-Reply-To: <20261124204054.85634-2-vaibhav.chahar26@gmail.com>

On Wed, Nov 25, 2026 at 02:10:53AM +0530, Vaibhav Chahar wrote:
> Use guard(mutex) instead of manual mutex_lock() and mutex_unlock()
> calls to modernize the driver and improve mutex handling.

...

>  	ret = mcp3564_update_8bits(adc, MCP3564_CONFIG2_REG, MCP3564_CONFIG2_BOOST_CURRENT_MASK,
>  				   FIELD_PREP(MCP3564_CONFIG2_BOOST_CURRENT_MASK, mode));

>  

While at it, drop this unneeded blank line (same for other similar places).

> -	if (ret)
> +	if (ret) {
>  		dev_err(&indio_dev->dev, "Failed to configure CONFIG2 register\n");
> -	else
> -		adc->current_boost_mode = mode;
> +		return ret;
> +	}

...

>  	case IIO_CHAN_INFO_RAW:
>  		if (channel->output) {
> -			mutex_lock(&adc->lock);
> +			guard(mutex)(&adc->lock);

Add a blank line here, so it will be visible at a glance that guard()()
is used. Ditto for other similar places.

>  			*val = mcp3564_burnout_avail[adc->burnout_mode][0];
>  			*val2 = mcp3564_burnout_avail[adc->burnout_mode][1];
> -			mutex_unlock(&adc->lock);
>  			return IIO_VAL_INT_PLUS_MICRO;
>  		}

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-11-25 11:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 20:40 [PATCH v3 0/2] iio: adc: Use guard(mutex) " Vaibhav Chahar
2026-11-24 20:40 ` [PATCH v3 1/2] iio: adc: mcp3564: Use guard() " Vaibhav Chahar
2026-11-25 11:24   ` Andy Shevchenko [this message]
2026-11-24 20:40 ` [PATCH v3 2/2] iio: adc: palmas_gpadc: Use guard(mutex) " Vaibhav Chahar
2026-11-25 11:32   ` Andy Shevchenko

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=awbFcJiIp6FR-gAt@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=crofts@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marius.cristea@microchip.com \
    --cc=nuno.sa@analog.com \
    --cc=vaibhav.chahar26@gmail.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

all inboxes | Powered by JetHome®