linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Kent Gibson <warthog618@gmail.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH v3] gpio: sim: simplify code with cleanup helpers
Date: Thu, 17 Aug 2023 12:25:05 +0300	[thread overview]
Message-ID: <ZN3ncVjDn9ZXHOS5@smile.fi.intel.com> (raw)
In-Reply-To: <CAMRc=McqdnBBSe1QhyNEFCs3E+Qb_K-z1dT+B8+n2KvWajj5hA@mail.gmail.com>

On Tue, Aug 15, 2023 at 09:09:55PM +0200, Bartosz Golaszewski wrote:
> On Tue, Aug 15, 2023 at 12:31 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Sat, Aug 12, 2023 at 08:36:35PM +0200, Bartosz Golaszewski wrote:

...

> > > -     mutex_lock(&chip->lock);
> > > -     __assign_bit(offset, chip->value_map, value);
> > > -     mutex_unlock(&chip->lock);
> > > +     scoped_guard(mutex, &chip->lock)
> > > +             __assign_bit(offset, chip->value_map, value);
> >
> > But this can also be guarded.
> >
> >         guard(mutex)(&chip->lock);
> >
> >         __assign_bit(offset, chip->value_map, value);
> 
> Come on, this is total bikeshedding! I could produce ten arguments in
> favor of the scoped variant.
> 
> Linus acked even the previous version and Peter says it looks right. I
> will queue it unless some *real* issues come up.

I still think this will be, besides being shorter and nicer to read,
more consistent with other simple use of "guard(); return ..." cases.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2023-08-17  9:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-12 18:36 [PATCH v3] gpio: sim: simplify code with cleanup helpers Bartosz Golaszewski
2023-08-15 10:30 ` Andy Shevchenko
2023-08-15 19:09   ` Bartosz Golaszewski
2023-08-17  9:25     ` Andy Shevchenko [this message]
2023-08-17 12:15       ` Bartosz Golaszewski
2023-08-18  7:50 ` Bartosz Golaszewski

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=ZN3ncVjDn9ZXHOS5@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=warthog618@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;
as well as URLs for NNTP newsgroup(s).