Messages in this thread | | | Date | Mon, 15 Apr 2019 12:51:59 +0200 | From | Peter Zijlstra <> | Subject | Re: [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.
| |