Re: [PATCH V2 1/9] jump_label: Add for_each_label_entry helper

From: Daniel Bristot de Oliveira
Date: Wed Dec 19 2018 - 02:38:10 EST


On 12/18/18 10:19 PM, Borislav Petkov wrote:
> On Tue, Dec 18, 2018 at 05:46:30PM +0100, Daniel Bristot de Oliveira wrote:
>> This patch adds the helper:
>> for_each_label_entry(key, entry, stop)
>>
>> For the "for each jump label entry" for defined as:
>> for (; (entry < stop) && (jump_entry_key(entry) == key); entry++)
>>
>> Simplifying the reading and usage.
>
> Please avoid writing "This patch" in a commit message and also what it
> does - that should be obvious. Instead say something like:
>
> "Add a helper macro to make jump entry iteration code more readable."
>
> or so.

Right! I will change it!

> But then, IINM, this macro is being used only once. Isn't that a bit too
> much? I mean, you could just as well do:
>
> # iterate over each jump entry
> for (; (entry < stop) && (jump_entry_key(entry) == key); entry++) {
>
> and have it even more readable without introducing macro which is not
> going to be used elsewhere. Or is it going to...?

It is also used in the patch 9. But I can remove it, no problem.

Thoughts?

Thanks!

-- Daniel