Re: [PATCH] sysctl.c: Change a .proc_handler = proc_dointvec to &proc_dointvec,

From: Eric W. Biederman
Date: Sun Nov 15 2009 - 05:04:36 EST


Ingo Molnar <mingo@xxxxxxx> writes:

> * Joe Perches <joe@xxxxxxxxxxx> wrote:
>
>> On Sun, 2009-11-15 at 09:11 +0100, Ingo Molnar wrote:
>> > * Am??rico Wang <xiyou.wangcong@xxxxxxxxx> wrote:
>> > > On Sat, Nov 14, 2009 at 05:52:05PM -0800, Joe Perches wrote:
>> > > >Seems to be a typo.
>> > > Acked-by: WANG Cong <xiyou.wangcong@xxxxxxxxx>
>> > (Cc:-ed Eric who is running the sysctl tree these days)
>> > Almost everywhere in the kernel we use the shorter version, so all of
>> > sysctl.c should eventually change to that variant.
>>
>> It's closer to 50/50, but it's 1 vs 133 in that file.
>>
>> $ grep -Pr --include=*.[ch] '\.proc_handler\s*=\s*&\s*\w+' * | wc -l
>> 339
>>
>> $ grep -Pr --include=*.[ch] '\.proc_handler\s*=\s*[^&]\s*\w+' * | wc -l
>> 432
>
> I did not mean this specific initialization method of proc_handler, i
> meant pointers to functions in general.


There was an argument put forward by Alexy (I think) a while ago. That
argued for the form without the address of operator.

The reason being that without it you can do:
#define proc_dointvec NULL

in a header when sysctl support it compiled out. Using address of
you wind up with stub functions in sysctl.c to handle the case when
sysctl is compiled out.

It isn't a strong case but since not using & is also shorter and
as Ingo pointed out more common I think no & wins.

Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/