lkml.org 
[lkml]   [2023]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] gpio: sim: simplify code with cleanup helpers
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


\
 
 \ /
  Last update: 2023-08-17 11:26    [W:0.176 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site