Re: [PATCH 1/3] cleanup: add conditional guard helper

Peter Zijlstra
2024-10-23T10:58:03Z

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@baylibre.com>
> > > ---
> > > 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@linux.intel.com>
> Signed-off-by: Fabio M. De Francesco <fabio.m.de.francesco@linux.intel.com>
>
> David and I talked about that here:
>
> http://lore.kernel.org/f4cc471a-b602-48d8-8323-15efcd602814@baylibre.com
>
> Also feel free to add:
>
> Reviewed-by: Dan Williams <dan.j.williams@intel.com>

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.