diff options
| author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2020-10-15 20:11:31 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-09-22 11:47:57 +0200 |
| commit | 386a913d4960a83cc4657ebe0c9bc462d8f5e2a1 (patch) | |
| tree | 35e11b06a85a8a69a0a251e0044bb26eadab03ed /kernel/fail_function.c | |
| parent | a52a5266080aa53dce51d58efdfd7b69b85d08fb (diff) | |
include/linux/list.h: add a macro to test if entry is pointing to the head
commit e130816164e244b692921de49771eeb28205152d upstream.
Add a macro to test if entry is pointing to the head of the list which is
useful in cases like:
list_for_each_entry(pos, &head, member) {
if (cond)
break;
}
if (list_entry_is_head(pos, &head, member))
return -ERRNO;
that allows to avoid additional variable to be added to track if loop has
not been stopped in the middle.
While here, convert list_for_each_entry*() family of macros to use a new one.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lkml.kernel.org/r/20200929134342.51489-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/fail_function.c')
0 files changed, 0 insertions, 0 deletions
