On Sun, Apr 27, 2014 at 1:16 PM, Alexandre Courbot <gnurou@xxxxxxxxx> wrote: > On Sun, Apr 27, 2014 at 7:46 PM, Javier Martinez Canillas > <javier@xxxxxxxxxxxx> wrote: >> Hello Alexandre, >> >> Thanks a lot for your feedback. >> >> On Sun, Apr 27, 2014 at 12:16 PM, Alexandre Courbot <gnurou@xxxxxxxxx> wrote: >>> On Sun, Apr 27, 2014 at 9:00 AM, Javier Martinez Canillas >>> <javier@xxxxxxxxxxxx> wrote: >>>> Hello Linus and Alexandre, >>>> >>>> While learning coccinelle towards doing the big gpio_chip/gpio_chip_ops >>>> split refactoring I wrote this trivial semantic patch that replaces a >>>> manual bit shift by using the BIT macro from <linux/bitops.h> >>>> >>>> @hasbitops@ >>>> @@ >>>> >>>> #include <linux/bitops.h> >>>> >>>> @depends on hasbitops@ >>>> expression E; >>>> @@ >>>> >>>> - 1 << E >>>> + BIT(E) >>>> >>>> @depends on hasbitops@ >>>> expression E; >>>> @@ >>>> >>>> - BIT((E)) >>>> + BIT(E) >>>> >>>> When applying to the drivers/gpio subdirectory I got >>>> the following clean up patches for some GPIO drivers. >>> >>> I personally find "1 << n" easier to read than a macro, but you are >>> right that the macro is less error-prone. Nice use of Coccinelle btw, >>> I should really spend the time to learn it. >>> >>> Reviewed-by: Alexandre Courbot <acourbot@xxxxxxxxxx> >> >> Yes I agree that the readability is a matter of personal taste. Do you >> want me to send a v2 with a better wording on the commit message? > > No, I think it's good as it is. Nice usage of Coccinelle btw. I really > should spend some time learning how to use it. Thanks, now that I understand the basics I will try to write the semantic patch for the struct gpio_chip refactoring. I expect that to be a little trickier :-) Best regards, Javier -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html