Re: [PATCH v2 2/5] iio: chemical: sgp40: Replace manual locking with guard()

From: Andy Shevchenko

Date: Mon Nov 16 2026 - 04:07:50 EST


On Mon, Nov 16, 2026 at 10:49:51AM +0200, Jaakko Koivisto wrote:
> On Mon Nov 2, 2026 at 12:10 PM EET, Joshua Crofts wrote:
> > On Mon, 2 Nov 2026 11:12:55 +0200
> > Jaakko Koivisto <jmatko@xxxxxx> wrote:

...

> >> /* we calculate as a multiple of 16384 (2^14) */

And this comment should be placed not for guard()() obviously.

> >> - mutex_lock(&data->lock);
> >> + guard(mutex)(&data->lock);
> >
> > Blank lines around any guard() statement. You want to emphasize the fact
> > that guard is being utilized.
>
> Should this be applied also for guard() inside switch-case -blocks?
> The extra blank lines makes them look strange.

In scoped cases the blank line is needed only after the guard()() assuming it's
the first operator after the scope is opened.

> >> x = ((int)resistance_raw - data->res_calibbias) * 106;
> >> - mutex_unlock(&data->lock);

--
With Best Regards,
Andy Shevchenko