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: Jonathan Cameron <jic23@cam.ac.uk>,
	linux-iio@vger.kernel.org, drivers@analog.com
Subject: Re: [PATCH 07/22] staging:iio:ad7793: Remove unused platform_data from device state struct
Date: Tue, 14 Aug 2012 21:19:43 +0100	[thread overview]
Message-ID: <502AB2DF.3080301@kernel.org> (raw)
In-Reply-To: <502AA96C.3090105@kernel.org>

On 08/14/2012 08:39 PM, Jonathan Cameron wrote:
> On 08/10/2012 05:36 PM, Lars-Peter Clausen wrote:
>> The platform data for the device is only used from within the drivers probe
>> callback, so there is no need to keep it around in the devices state struct.
>>
>> While we are at it mark the platform data struct as const.
>>
There a couple of obvious bugs in this patch....

My plan with these is to first send a series to Greg with the
fixes in it (not including this which is merely a cleanup?)
Once that shows up in his trees I'll do a second pull request with
this + the sigma delta cleanups.
It is probably the cleanest approach and we aren't pressed for time
at the moment.  To show what will be in there I will push out
a new branch to kernel.org shortly togreg-postfixes.

Lars-Peter, please verify that my fixup of this is correct
(all I've done is build tested it).


>> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
>> ---
>>  drivers/staging/iio/adc/ad7793.c |   14 ++++++--------
>>  1 file changed, 6 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/staging/iio/adc/ad7793.c b/drivers/staging/iio/adc/ad7793.c
>> index 112e2b7..0ba598e 100644
>> --- a/drivers/staging/iio/adc/ad7793.c
>> +++ b/drivers/staging/iio/adc/ad7793.c
>> @@ -44,7 +44,6 @@ struct ad7793_state {
>>  	struct iio_trigger		*trig;
>>  	const struct ad7793_chip_info	*chip_info;
>>  	struct regulator		*reg;
>> -	struct ad7793_platform_data	*pdata;
>>  	wait_queue_head_t		wq_data_avail;
>>  	bool				done;
>>  	bool				irq_dis;
>> @@ -253,7 +252,8 @@ out:
>>  	return ret;
>>  }
>>  
>> -static int ad7793_setup(struct ad7793_state *st)
>> +static int ad7793_setup(struct ad7793_state *st
>> +	const struct ad7793_platform_data *pdata)
> Really odd.  There's a missing comma between the arguments here...
> I'll fixup.
>>  {
>>  	int i, ret = -1;
>>  	unsigned long long scale_uv;
>> @@ -277,9 +277,9 @@ static int ad7793_setup(struct ad7793_state *st)
>>  		goto out;
>>  	}
>>  
>> -	st->mode  = (st->pdata->mode & ~AD7793_MODE_SEL(-1)) |
>> +	st->mode  = (pdata->mode & ~AD7793_MODE_SEL(-1)) |
>>  			AD7793_MODE_SEL(AD7793_MODE_IDLE);
>> -	st->conf  = st->pdata->conf & ~AD7793_CONF_CHAN(-1);
>> +	st->conf  = pdata->conf & ~AD7793_CONF_CHAN(-1);
>>  
>>  	ret = ad7793_write_reg(st, AD7793_REG_MODE, sizeof(st->mode), st->mode);
>>  	if (ret)
>> @@ -882,7 +882,7 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
>>  
>>  static int __devinit ad7793_probe(struct spi_device *spi)
>>  {
>> -	struct ad7793_platform_data *pdata = spi->dev.platform_data;
>> +	const struct ad7793_platform_data *pdata = spi->dev.platform_data;
>>  	struct ad7793_state *st;
>>  	struct iio_dev *indio_dev;
>>  	int ret, voltage_uv = 0;
>> @@ -915,8 +915,6 @@ static int __devinit ad7793_probe(struct spi_device *spi)
>>  	st->chip_info =
>>  		&ad7793_chip_info_tbl[spi_get_device_id(spi)->driver_data];
>>  
>> -	st->pdata = pdata;
>> -
>>  	if (pdata && pdata->vref_mv)
>>  		st->int_vref_mv = pdata->vref_mv;
>>  	else if (voltage_uv)
>> @@ -944,7 +942,7 @@ static int __devinit ad7793_probe(struct spi_device *spi)
>>  	if (ret)
>>  		goto error_unreg_ring;
>>  
>> -	ret = ad7793_setup(st);
>> +	ret = ad7793_setup(st, pdata);
>>  	if (ret)
>>  		goto error_remove_trigger;
>>  
>>

  reply	other threads:[~2012-08-14 20:19 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-10 16:36 [PATCH 01/22] staging:iio:ad7793: Add missing break in switch statement Lars-Peter Clausen
2012-08-10 16:36 ` [PATCH 02/22] staging:iio:ad7793: Mark channels as unsigned Lars-Peter Clausen
2012-08-10 16:36 ` [PATCH 03/22] staging:iio:ad7793: Report channel offset Lars-Peter Clausen
2012-08-10 16:36 ` [PATCH 04/22] staging:iio:ad7793: Fix temperature scale and offset Lars-Peter Clausen
2012-08-10 16:36 ` [PATCH 05/22] staging:iio:ad7793: Follow new IIO naming spec Lars-Peter Clausen
2012-08-10 16:36 ` [PATCH 06/22] staging:iio:ad7793: Fix internal reference value Lars-Peter Clausen
2012-08-10 16:36 ` [PATCH 07/22] staging:iio:ad7793: Remove unused platform_data from device state struct Lars-Peter Clausen
2012-08-14 19:39   ` Jonathan Cameron
2012-08-14 20:19     ` Jonathan Cameron [this message]
2012-08-15  9:03       ` Lars-Peter Clausen
2012-08-15  9:28         ` Jonathan Cameron
     [not found]     ` <502B6688.6000904@metafoo.de>
2012-09-03 16:39       ` Lars-Peter Clausen
2012-09-03 20:09         ` Jonathan Cameron
2012-08-10 16:36 ` [PATCH 08/22] staging:iio:ad7192: Add missing break in switch statement Lars-Peter Clausen
2012-08-10 16:36 ` [PATCH 09/22] staging:iio:ad7192: Fix setting ACX Lars-Peter Clausen
2012-08-10 16:36 ` [PATCH 10/22] staging:iio:ad7192: Mark channels as unsigned Lars-Peter Clausen
2012-08-10 16:36 ` [PATCH 11/22] staging:iio:ad7192: Report channel offset Lars-Peter Clausen
2012-08-10 16:36 ` [PATCH 12/22] staging:iio:ad7192: Report offset and scale for temperature channel Lars-Peter Clausen
2012-08-10 16:36 ` [PATCH 13/22] staging:iio:ad7192: Remove unused platform_data from device state struct Lars-Peter Clausen
2012-08-10 16:36 ` [PATCH 14/22] staging:iio:ad7780: Mark channels as unsigned Lars-Peter Clausen
2012-08-10 16:36 ` [PATCH 15/22] iio: Introduce iio_device_{set,get}_drvdata() Lars-Peter Clausen
2012-08-10 16:36 ` [PATCH 16/22] iio:adc: Add common code for ADI Sigma Delta devices Lars-Peter Clausen
2012-08-14 12:03   ` Jonathan Cameron
2012-08-14 20:19   ` Jonathan Cameron
2012-08-10 16:36 ` [PATCH 17/22] staging:iio:ad7780: Use common Sigma Delta library Lars-Peter Clausen
2012-08-14 12:05   ` Jonathan Cameron
2012-08-10 16:36 ` [PATCH 18/22] staging:iio:ad7793: " Lars-Peter Clausen
2012-08-10 16:36 ` [PATCH 19/22] staging:iio:ad7192: " Lars-Peter Clausen
2012-08-27 17:07   ` Jonathan Cameron
2012-09-03  8:13     ` Lars-Peter Clausen
2012-08-10 16:36 ` [PATCH 20/22] staging:iio:ad7793: Add support for ad7794/ad7795 Lars-Peter Clausen
2012-08-10 16:36 ` [PATCH 21/22] staging:iio:ad7793: Add ad7785 support Lars-Peter Clausen
2012-08-10 16:36 ` [PATCH 22/22] staging:iio:adc: Add AD7791 driver Lars-Peter Clausen
2012-08-11  8:41   ` Peter Meerwald
2012-08-11 17:37     ` Lars-Peter Clausen
2012-08-13 13:12   ` Lars-Peter Clausen
2012-08-14 20:18     ` 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=502AB2DF.3080301@kernel.org \
    --to=jic23@kernel.org \
    --cc=drivers@analog.com \
    --cc=jic23@cam.ac.uk \
    --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).