linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH 13/15] staging:iio:ad7746: Do not store the transfer buffer on the stack
Date: Sun, 22 Dec 2013 17:22:26 +0000	[thread overview]
Message-ID: <52B71FD2.6040004@kernel.org> (raw)
In-Reply-To: <5299C868.7060306@kernel.org>

On 11/30/13 11:13, Jonathan Cameron wrote:
> On 11/25/13 12:42, Lars-Peter Clausen wrote:
>> Some I2C controllers might not be able to handle transfer buffers that are
>> stored on stack.
>>
>> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> Applied to the togreg branch of iio.git
> 
> Thanks,
Hi Lars,

I let this one through without quite enough scrutiny.  It's a valid cleanup, but the statement
that some i2c controllers migh tnot be able to handle transfer buffers that are stored on the
stack is missleading, seeing as the relevant i2c calls do an explicit memcpy - (curriously to
another buffer that is also on the stack...)  I guess this might change in future.  In the pull
request I've mentioned that it isn't a problem right now.

So I should have picked up on the commit message content!

oops.

I'm not rebasing for a missleading bit of comment though so hopefully no one upstream will care
too much!
>> ---
>>  drivers/staging/iio/cdc/ad7746.c | 14 +++++++-------
>>  1 file changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
>> index 01e15e2..cbb1588 100644
>> --- a/drivers/staging/iio/cdc/ad7746.c
>> +++ b/drivers/staging/iio/cdc/ad7746.c
>> @@ -105,6 +105,11 @@ struct ad7746_chip_info {
>>  	u8	vt_setup;
>>  	u8	capdac[2][2];
>>  	s8	capdac_set;
>> +
>> +	union {
>> +		__be32 d32;
>> +		u8 d8[4];
>> +	} data ____cacheline_aligned;
>>  };
>>  
>>  enum ad7746_chan {
>> @@ -566,11 +571,6 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,
>>  	int ret, delay;
>>  	u8 regval, reg;
>>  
>> -	union {
>> -		__be32 d32;
>> -		u8 d8[4];
>> -	} data;
>> -
>>  	mutex_lock(&indio_dev->mlock);
>>  
>>  	switch (mask) {
>> @@ -591,12 +591,12 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,
>>  		/* Now read the actual register */
>>  
>>  		ret = i2c_smbus_read_i2c_block_data(chip->client,
>> -			chan->address >> 8, 3, &data.d8[1]);
>> +			chan->address >> 8, 3, &chip->data.d8[1]);
>>  
>>  		if (ret < 0)
>>  			goto out;
>>  
>> -		*val = (be32_to_cpu(data.d32) & 0xFFFFFF) - 0x800000;
>> +		*val = (be32_to_cpu(chip->data.d32) & 0xFFFFFF) - 0x800000;
>>  
>>  		switch (chan->type) {
>>  		case IIO_TEMP:
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2013-12-22 17:22 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-25 12:41 [PATCH 01/15] iio:ad5504: Mark transfer buffers as __be16 Lars-Peter Clausen
2013-11-25 12:41 ` [PATCH 02/15] iio:ad5504: Do not store transfer buffers on the stack Lars-Peter Clausen
2013-11-30 11:07   ` Jonathan Cameron
2013-11-25 12:41 ` [PATCH 03/15] iio:ad5421: Mark transfer buffer as __be32 Lars-Peter Clausen
2013-11-30 11:07   ` Jonathan Cameron
2013-11-25 12:41 ` [PATCH 04/15] iio:ad5686: " Lars-Peter Clausen
2013-11-30 11:07   ` Jonathan Cameron
2013-11-25 12:41 ` [PATCH 05/15] iio:ad5755: " Lars-Peter Clausen
2013-11-30 11:08   ` Jonathan Cameron
2013-11-25 12:41 ` [PATCH 06/15] iio:ad5791: Mark transfer buffers " Lars-Peter Clausen
2013-11-30 11:08   ` Jonathan Cameron
2013-11-25 12:41 ` [PATCH 07/15] iio:ad5791: Do not store transfer buffers on the stack Lars-Peter Clausen
2013-11-30 11:09   ` Jonathan Cameron
2013-12-22 17:36     ` Jonathan Cameron
2013-12-22 17:40       ` Lars-Peter Clausen
2013-12-22 17:43         ` Jonathan Cameron
2013-11-25 12:42 ` [PATCH 08/15] iio:ad7266: Mark transfer buffer as __be16 Lars-Peter Clausen
2013-11-30 11:10   ` Jonathan Cameron
2013-11-25 12:42 ` [PATCH 09/15] iio:vcnl4000: " Lars-Peter Clausen
2013-11-30 11:11   ` Jonathan Cameron
2013-11-25 12:42 ` [PATCH 10/15] staging:iio:ad7280a: Mark transfer buffer as __be32 Lars-Peter Clausen
2013-11-30 11:12   ` Jonathan Cameron
2013-11-25 12:42 ` [PATCH 11/15] staging:iio:ad7280a: Do not store transfer buffer on the stack Lars-Peter Clausen
2013-11-30 11:12   ` Jonathan Cameron
2013-11-25 12:42 ` [PATCH 12/15] staging:iio:ad7746: Mark transfer buffer as __be32 Lars-Peter Clausen
2013-11-30 11:13   ` Jonathan Cameron
2013-11-25 12:42 ` [PATCH 13/15] staging:iio:ad7746: Do not store the transfer buffer on the stack Lars-Peter Clausen
2013-11-30 11:13   ` Jonathan Cameron
2013-12-22 17:22     ` Jonathan Cameron [this message]
2013-11-25 12:42 ` [PATCH 14/15] staging:iio:ad9832: Mark transfer buffers as __be16 Lars-Peter Clausen
2013-11-30 11:14   ` Jonathan Cameron
2013-12-03 10:27     ` Lars-Peter Clausen
2013-12-03 14:56       ` Jonathan Cameron
2013-12-03 20:09         ` Jonathan Cameron
2013-12-03 20:11           ` Lars-Peter Clausen
2013-11-25 12:42 ` [PATCH 15/15] staging:iio:ad9834: Mark transfer buffers as __b16 Lars-Peter Clausen
2013-11-30 11:14   ` Jonathan Cameron
2013-11-30 11:03 ` [PATCH 01/15] iio:ad5504: Mark transfer buffers as __be16 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=52B71FD2.6040004@kernel.org \
    --to=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).