2007-09-20 12:57:12

by Tetsuo Handa

[permalink] [raw]
Subject: error from checkpatch.pl version 0.10

Hello.

I checked my patch using checkpatch.pl version 0.10
and I got the following error.

ERROR: need consistent spacing around '*' (ctx:WxV)
#2334: FILE: security/tomoyo/common.c:2306:
+static unsigned int tmy_poll(struct file *file, poll_table *wait)
^

What action should I take?
Ignore this error because "poll_table" is used everywhere?
Replace "poll_table" with "struct poll_table_struct" according to
definition of "poll_table"?

typedef struct poll_table_struct {
poll_queue_proc qproc;
} poll_table;

Regards.


2007-09-20 13:47:18

by Satyam Sharma

[permalink] [raw]
Subject: Re: error from checkpatch.pl version 0.10



On Thu, 20 Sep 2007, Tetsuo Handa wrote:
>
> I checked my patch using checkpatch.pl version 0.10
> and I got the following error.
>
> ERROR: need consistent spacing around '*' (ctx:WxV)
> #2334: FILE: security/tomoyo/common.c:2306:
> +static unsigned int tmy_poll(struct file *file, poll_table *wait)
> ^

Looks like a checkpatch.pl bug to me -- that was nothing to warn about.


> What action should I take?
> Ignore this error because "poll_table" is used everywhere?
> Replace "poll_table" with "struct poll_table_struct" according to
> definition of "poll_table"?

Yeah, this would be better to do anyway (and rename poll_table_struct
to just poll_table).

> typedef struct poll_table_struct {
> poll_queue_proc qproc;
> } poll_table;

So:

struct poll_table {
poll_queue_proc qproc;
};

In general the kernel's codingstyle consensus is to avoid adding typedefs.

2007-09-20 14:30:21

by Tetsuo Handa

[permalink] [raw]
Subject: Re: error from checkpatch.pl version 0.10

Hello.

Satyam Sharma wrote:
> Looks like a checkpatch.pl bug to me -- that was nothing to warn about.
I see. I'll wait for next version.

> struct poll_table {
> poll_queue_proc qproc;
> };
poll_table is defined in include/linux/poll.h .
To change this, we have to do "sed -i -e 's:poll_table:struct poll_table:g'"
against all in-tree files atomically.
Also there would be many out-of-tree files using poll_table.
I think it's too difficult to change.

Thank you.

2007-09-20 15:53:38

by Andy Whitcroft

[permalink] [raw]
Subject: Re: error from checkpatch.pl version 0.10

On Thu, Sep 20, 2007 at 07:19:59PM +0530, Satyam Sharma wrote:
>
>
> On Thu, 20 Sep 2007, Tetsuo Handa wrote:
> >
> > I checked my patch using checkpatch.pl version 0.10
> > and I got the following error.
> >
> > ERROR: need consistent spacing around '*' (ctx:WxV)
> > #2334: FILE: security/tomoyo/common.c:2306:
> > +static unsigned int tmy_poll(struct file *file, poll_table *wait)
> > ^
>
> Looks like a checkpatch.pl bug to me -- that was nothing to warn about.

Hmm yeah this is a false positive, its hard to detect correctly. Some
fool decided to use * as both a unary and binary operator and made life
very hard indeed. Most kernel defined types end _t to aid recognition.
This one does no. I may special case it. Either way ignore its
moaning!

> > What action should I take?
> > Ignore this error because "poll_table" is used everywhere?
> > Replace "poll_table" with "struct poll_table_struct" according to
> > definition of "poll_table"?
>
> Yeah, this would be better to do anyway (and rename poll_table_struct
> to just poll_table).
>
> > typedef struct poll_table_struct {
> > poll_queue_proc qproc;
> > } poll_table;
>
> So:
>
> struct poll_table {
> poll_queue_proc qproc;
> };
>
> In general the kernel's codingstyle consensus is to avoid adding typedefs.

-apw

2007-09-21 13:09:49

by Jan Engelhardt

[permalink] [raw]
Subject: Re: error from checkpatch.pl version 0.10


On Sep 20 2007 16:53, Andy Whitcroft wrote:
>> > ERROR: need consistent spacing around '*' (ctx:WxV)
>> > #2334: FILE: security/tomoyo/common.c:2306:
>> > +static unsigned int tmy_poll(struct file *file, poll_table *wait)
>> > ^
>>
>> Looks like a checkpatch.pl bug to me -- that was nothing to warn about.
>
>Hmm yeah this is a false positive, its hard to detect correctly. Some
>fool decided to use * as both a unary and binary operator and made life
>very hard indeed.

The C parser has no problem with it :p
It is simple: there cannot be a binary * operator in the argument list.