lkml.org 
[lkml]   [2010]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Possible false positive from checkpatch.pl
From
Date
On Mon, 2010-07-12 at 12:52 -0500, Larry Finger wrote:
> Andy,
>
> In preparing a vendor driver for submission to staging, I am getting the
> following from checkpatch.pl:
>
> ERROR: Macros with multiple statements should be enclosed in a do - while loop
> #377: FILE: staging/rtl8712/rtl871x_mp_ioctl.h:377:
> +#define GEN_MP_IOCTL_HANDLER(sz, hdl, oid) {sz, hdl, oid},

I think you should leave off the trailing comma from the macros
and C99 might be better. Maybe something like:

(whatever the field names really are)

#define GEN_MP_IOCTL_HANDLER(sz, hdl, oid) \
{.field1 = sz, .field2 = hdl, .field3 = oid}
> ERROR: Macros with multiple statements should be enclosed in a do - while loop
> #378: FILE: staging/rtl8712/rtl871x_mp_ioctl.h:378:
> +#define EXT_MP_IOCTL_HANDLER(sz, subcode, oid) {sz, &mp_ioctl_ \
> + ## subcode ## _hdl, oid},

The line continuation is rather ugly too. Perhaps it's better as:

#define EXT_MP_IOCTL_HANDLER(sz, subcode, oid) \
{.field1 = sz, .field2 = &mp_ioctl_##subcode##_hdl, .field3 = oid}
They pass checkpatch without error.

$ cat foo.h
#define GEN_MP_IOCTL_HANDLER(sz, hdl, oid) \
{.field1 = sz, .field2 = hdl, .field3 = oid}
#define EXT_MP_IOCTL_HANDLER(sz, subcode, oid) \
{.field1 = sz, .field2 = &mp_ioctl_##subcode##_hdl, .field3 = oid}
$ ./scripts/checkpatch.pl -f foo.h
total: 0 errors, 0 warnings, 4 lines checked
foo.h has no obvious style problems and is ready for submission.



\
 
 \ /
  Last update: 2010-07-12 20:31    [from the cache]
©2003-2011 Jasper Spaans