Re: [PATCH 1/1] scripts/coccinelle: use BIT() macro if possible

From: Javier Martinez Canillas
Date: Sun Apr 27 2014 - 06:41:52 EST


On Sun, Apr 27, 2014 at 12:29 PM, Julia Lawall <julia.lawall@xxxxxxx> wrote:
>
>
> On Sun, 27 Apr 2014, Javier Martinez Canillas wrote:
>
>> Using the BIT() macro instead of manually shifting bits
>> makes the code less error prone and also more readable.
>>
>> Signed-off-by: Javier Martinez Canillas <javier@xxxxxxxxxxxx>
>> ---
>>
>> An example of the patches that can be obtained with this spatch:
>>
>> http://www.mail-archive.com/linux-gpio@xxxxxxxxxxxxxxx/msg02722.html
>>
>> scripts/coccinelle/api/bit.cocci | 25 +++++++++++++++++++++++++
>> 1 file changed, 25 insertions(+)
>> create mode 100644 scripts/coccinelle/api/bit.cocci
>>
>> diff --git a/scripts/coccinelle/api/bit.cocci b/scripts/coccinelle/api/bit.cocci
>> new file mode 100644
>> index 0000000..a5df73a
>> --- /dev/null
>> +++ b/scripts/coccinelle/api/bit.cocci
>> @@ -0,0 +1,25 @@
>> +// Use the macro BIT() macro if possible
>> +//
>> +// Confidence: High
>> +// Copyright (C) 2014 Javier Martinez Canillas. GPLv2.
>> +// URL: http://coccinelle.lip6.fr/
>> +// Options: --include-headers
>> +
>> +@hasbitops@
>> +@@
>> +
>> +#include <linux/bitops.h>
>
> Here you could say:
>
> @usesbit@
> @@
> BIT(...)
>
>
>> +@depends on hasbitops@
>
> and then here it would be
>
> @depends on hasbitops && usesbit@
>
> julia
>

Thanks a lot for the feedback, I'll send a v2 of the patch then.

Best regards,
Javier
--
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/