All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: 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 10:55:09 +0100	[thread overview]
Message-ID: <50EE8FFD.2000000@metafoo.de> (raw)
In-Reply-To: <alpine.DEB.2.02.1301100951060.2063@localhost6.localdomain6>

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.

- Lars

WARNING: multiple messages have this Message-ID (diff)
From: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
To: Julia Lawall <julia.lawall-L2FTfq7BK8M@public.gmane.org>
Cc: Grant Likely
	<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 1/3] spi: Add helper functions for setting up transfers
Date: Thu, 10 Jan 2013 10:55:09 +0100	[thread overview]
Message-ID: <50EE8FFD.2000000@metafoo.de> (raw)
In-Reply-To: <alpine.DEB.2.02.1301100951060.2063-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>

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.

- Lars

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

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-09 17:31 [PATCH 1/3] spi: Add helper functions for setting up transfers Lars-Peter Clausen
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   ` Lars-Peter Clausen
2013-01-09 17:31 ` [PATCH 3/3] staging:iio: " Lars-Peter Clausen
2013-01-09 17:31   ` Lars-Peter Clausen
2013-01-09 19:20 ` [PATCH 1/3] spi: Add helper functions for setting up transfers Jonathan Cameron
2013-01-09 19:20   ` Jonathan Cameron
2013-01-09 20:56   ` Lars-Peter Clausen
     [not found]     ` <50EDD96A.5080900-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
2013-01-09 21:36       ` Jonathan Cameron
2013-01-09 21:36         ` Jonathan Cameron
2013-01-10  8:53 ` Julia Lawall
2013-01-10  8:53   ` Julia Lawall
2013-01-10  9:55   ` Lars-Peter Clausen [this message]
2013-01-10  9:55     ` Lars-Peter Clausen
2013-01-10 10:28     ` Julia Lawall
2013-01-10 10:28       ` Julia Lawall
2013-01-27  3:33 ` Mark Brown
2013-01-27  3:33   ` Mark Brown
2013-02-05 14:07   ` Grant Likely
2013-02-05 14:07     ` Grant Likely
2013-02-06 19:20     ` Jonathan Cameron
2013-02-06 19:20       ` Jonathan Cameron
2013-02-09 11:14       ` Jonathan Cameron
2013-02-09 11:14         ` Jonathan Cameron
2013-02-09 10:59     ` 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=50EE8FFD.2000000@metafoo.de \
    --to=lars@metafoo.de \
    --cc=grant.likely@secretlab.ca \
    --cc=jic23@cam.ac.uk \
    --cc=julia.lawall@lip6.fr \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.