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

Wolfram Sang w.sang at pengutronix.de
Tue Mar 15 06:29:22 EDT 2011


On Tue, Mar 15, 2011 at 11:19:53AM +0100, Julia Lawall wrote:
> On Tue, 15 Mar 2011, Uwe Kleine-König wrote:
> 
> > On Tue, Mar 15, 2011 at 10:41:37AM +0100, Julia Lawall wrote:
> > > I tried the following
> > > 
> > > @@
> > > expression E1,E2;
> > > @@
> > > 
> > >       gpio_direction_output(E1,E2);
> > >       ...
> > > -     gpio_set_value(E1,E2);
> > > 
> > > and found occurrences in 15 files.  In some cases there seems to be some 
> > > delay before the call to gpio_set_value.  Does that have any impacton 
> > > whether it is needed?
> > gpio_direction_output(E1,E2) implies gpio_set_value(E1,E2), so unless
> > there is a gpio_set_value(E1,!E2) before gpio_set_value(E1,E2) is a
> > noop.
> > 
> > I still don't know how to work with coccinelle, so if you point me to a
> > concrete location I can be more specific.
> 
> OK.  I have changed the semantic patch to the following:
> 
> @@
> expression E1,E2,E3;
> @@
> 
>       gpio_direction_output(E1,E2);
>       ... when != gpio_set_value(E1,E3)
> -     gpio_set_value(E1,E2);
> 
> Now it doesn't do all the cases where there is an earlier set ofr some 
> other value.  The patch I obtain is below.  This only concerns 5 files.  
> I haven't checked the result at all.

It should also be checked if gpio_request_one is the better solution.

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110315/cf54587d/attachment.sig>


More information about the linux-arm-kernel mailing list