diff options
author | David Lechner <dlechner@baylibre.com> | 2024-10-01 17:30:18 -0500 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2024-10-25 10:01:51 +0200 |
commit | 36c2cf88808d47e926d11b98734f154fe4a9f50f (patch) | |
tree | 0d2ecf68e8d6c112bebcb5a9ae7fc9e445312a5b /arch/x86/include/asm | |
parent | fcc22ac5baf06dd17193de44b60dbceea6461983 (diff) | |
download | linux-36c2cf88808d47e926d11b98734f154fe4a9f50f.tar.gz linux-36c2cf88808d47e926d11b98734f154fe4a9f50f.tar.bz2 linux-36c2cf88808d47e926d11b98734f154fe4a9f50f.zip |
cleanup: Add conditional guard helper
Add a new if_not_guard() macro to cleanup.h for handling
conditional guards such as mutext_trylock().
This is more ergonomic than scoped_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_guard().
Signed-off-by: David Lechner <dlechner@baylibre.com>
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>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Link: https://lkml.kernel.org/r/20241001-cleanup-if_not_cond_guard-v1-1-7753810b0f7a@baylibre.com
Diffstat (limited to 'arch/x86/include/asm')
0 files changed, 0 insertions, 0 deletions