Re: [PATCH 1/3] cleanup: add conditional guard helper
From: Peter Zijlstra
Date: Wed Oct 23 2024 - 06:58:11 EST
On Fri, Oct 18, 2024 at 12:29:27PM -0700, Dan Williams wrote:
> Peter Zijlstra wrote:
> > On Tue, Oct 01, 2024 at 05:30:18PM -0500, David Lechner wrote:
> > > Add a new if_not_cond_guard() macro to cleanup.h for handling
> > > conditional guards such as mutext_trylock().
> > >
> > > This is more ergonomic than scoped_cond_guard() for most use cases.
> > > Instead of hiding the error handling statement in the macro args, it
> > > works like a normal if statement and allow the error path to be indented
> > > while the normal code flow path is not indented. And it avoid unwanted
> > > side-effect from hidden for loop in scoped_cond_guard().
> > >
> > > Signed-off-by: David Lechner <dlechner@xxxxxxxxxxxx>
> > > ---
> > > include/linux/cleanup.h | 11 +++++++++++
> > > 1 file changed, 11 insertions(+)
> > >
> [..]
> > I've queued these two patches:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git locking/core
> >
> > But lacking if_not_guard() users, the robot isn't really going to give
> > me much feedback there, I suppose...
>
> Looks good. If that branch is rebase-able it would be nice to add some
> credit tags to "cleanup: Add conditional guard helper":
>
> Co-developed-by: Fabio M. De Francesco <fabio.m.de.francesco@xxxxxxxxxxxxxxx>
> Signed-off-by: Fabio M. De Francesco <fabio.m.de.francesco@xxxxxxxxxxxxxxx>
>
> David and I talked about that here:
>
> http://lore.kernel.org/f4cc471a-b602-48d8-8323-15efcd602814@xxxxxxxxxxxx
>
> Also feel free to add:
>
> Reviewed-by: Dan Williams <dan.j.williams@xxxxxxxxx>
I rebased because I had to magic in the v4 from Przemek, and I added the
above tags to the if_not_guard() thing.
I've also pushed out a locking/test branch that includes the iio
conversion for the robots.
Once I push to tip/locking/core (people will get robot mail) the commits
should be stable and can be used in other branches if so desired.