lkml.org 
[lkml]   [2019]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V5 1/7] jump_label: Add for_each_label_entry helper
On Mon, Apr 01, 2019 at 10:58:13AM +0200, Daniel Bristot de Oliveira wrote:
> Add a helper macro to make jump entry iteration code more readable.
>
> Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>

> diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
> index 3e113a1fa0f1..7e91af98bbb1 100644
> --- a/include/linux/jump_label.h
> +++ b/include/linux/jump_label.h
> @@ -227,6 +227,9 @@ extern void static_key_disable(struct static_key *key);
> extern void static_key_enable_cpuslocked(struct static_key *key);
> extern void static_key_disable_cpuslocked(struct static_key *key);
>
> +#define for_each_label_entry(key, entry, stop) \
> + for (; (entry < stop) && (jump_entry_key(entry) == key); entry++)
> +

I don't really like this naming; most (all?) for_each_*() loops start
iteration and have the iteration variable as first argument.

This should maybe be called:

for_each_jump_entry_by_key_cont(entry, stop, key)

and I realize that is a horrible name too.

\
 
 \ /
  Last update: 2019-04-15 12:53    [W:0.064 / U:2.404 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site