[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1301101125520.2063@localhost6.localdomain6>
Date: Thu, 10 Jan 2013 11:28:32 +0100 (CET)
From: Julia Lawall <julia.lawall@...6.fr>
To: Lars-Peter Clausen <lars@...afoo.de>
cc: Julia Lawall <julia.lawall@...6.fr>,
Grant Likely <grant.likely@...retlab.ca>,
spi-devel-general@...ts.sourceforge.net,
linux-kernel@...r.kernel.org, Jonathan Cameron <jic23@....ac.uk>,
linux-iio@...r.kernel.org
Subject: Re: [PATCH 1/3] spi: Add helper functions for setting up transfers
On Thu, 10 Jan 2013, Lars-Peter Clausen wrote:
> On 01/10/2013 09:53 AM, Julia Lawall wrote:
> >> +@r1@
> >> +identifier fn;
> >> +identifier xfers;
> >> +@@
> >> +fn(...)
> >> +{
> >> + ...
> >> +(
> >> + struct spi_transfer xfers[...];
> >> +|
> >> + struct spi_transfer xfers[];
> >> +)
> >> + ...
> >> +}
> >
> > Can it happen that there would be more than one spi_transfer or spi_message
> > variable per function? This semantic patch will only treat the case where
> > there is only one, because the ... before an after the variable declaration
> > won't match another declaration of the same form.
> >
> > julia
>
> I guess it could happen, but I would consider it to be very rare. There are
> a few examples of multiple transfers in the kernel. But most of them look like
>
> struct spi_message msg;
> struct spi_transfer xfer_foo;
> struct spi_transfer xfer_bar;
>
> ...
> spi_message_add_tail(&xfer_foo, &msg);
> spi_message_add_tail(&xfer_bar, &msg);
>
> So the transformation can't be applied here anyway.
>
> Do you have an idea how to change the rule to work with multiple
> transfers/messages per function? If it would make the cocci file more
> complex I wouldn't bother to take care of it, since it basically has no
> practical use.
Probably the simplest thing is to put when any on all of the ...s
It might get slower, though.
Alternatively you could have a rule at the end that prints a warning for
any cases that are not transformed.
julia
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists