mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Julia Lawall <julia.lawall@lip6.fr>,
	Grant Likely <grant.likely@secretlab.ca>,
	spi-devel-general@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, Jonathan Cameron <jic23@cam.ac.uk>,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH 1/3] spi: Add helper functions for setting up transfers
Date: Thu, 10 Jan 2013 11:28:32 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.02.1301101125520.2063@localhost6.localdomain6> (raw)
In-Reply-To: <50EE8FFD.2000000@metafoo.de>

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

  reply	other threads:[~2013-01-10 10:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-09 17:31 Lars-Peter Clausen
2013-01-09 17:31 ` [PATCH 2/3] iio: Use spi_sync_transfer() Lars-Peter Clausen
2013-01-09 17:31 ` [PATCH 3/3] staging:iio: " Lars-Peter Clausen
2013-01-09 19:20 ` [PATCH 1/3] spi: Add helper functions for setting up transfers Jonathan Cameron
2013-01-09 20:56   ` Lars-Peter Clausen
2013-01-09 21:36     ` Jonathan Cameron
2013-01-10  8:53 ` Julia Lawall
2013-01-10  9:55   ` Lars-Peter Clausen
2013-01-10 10:28     ` Julia Lawall [this message]
2013-01-27  3:33 ` Mark Brown
2013-02-05 14:07   ` Grant Likely
2013-02-06 19:20     ` Jonathan Cameron
2013-02-09 11:14       ` Jonathan Cameron
2013-02-09 10:59     ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.02.1301101125520.2063@localhost6.localdomain6 \
    --to=julia.lawall@lip6.fr \
    --cc=grant.likely@secretlab.ca \
    --cc=jic23@cam.ac.uk \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spi-devel-general@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®