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

Dan Williams
2024-10-18T19:29:34Z

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>

Thanks, Peter!