[PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call

Julia Lawall julia at diku.dk
Sun Mar 20 17:42:42 EDT 2011


On Sun, 20 Mar 2011, Wolfram Sang wrote:

> On Sun, Mar 20, 2011 at 09:51:32PM +0100, Julia Lawall wrote:
> > I guess that the !GPIOLIB issue is related to a configuration option, that 
> > can't very easily be detected from looking at the C file alone?
> 
> Yes, that is a configuration option at the moment. It shouldn't be IMO, that's
> what my patch is addressing.
> 
> > Ignoring that issue, the following semantic patch addresses the common 
> 
> Sigh, here goes my chance to play with coccinelle again ;)

Well, there are still 300 or so cases that my rules don't catch :)

> > case where there is no error checking for the input or output call, but 
> > there may be error checking for the gpio_request call.  This transforms 
> > over 500 occurrences.
> 
> In my book, converting the ones which do not check errors at all is not worth
> the trouble. Proper error-checking should be the main benefit, not one saved
> line. So, this is mindwork. If gpio_request is checked, merging seems sensible
> (but should be audited).

OK.  One could put rules like:

@@
expression E1,E2;
@@

-      gpio_request(E1,E2);
+      BAD_CALL(gpio_request_one(E1,GPIOF_IN,E2));
       ... when != E1
-      gpio_direction_input(E1);

to more easily find those cases.  There are 265 of them.

julia



More information about the linux-arm-kernel mailing list