* [PATCH] stagin iio adt7410: use local platformdata if none is specified
@ 2012-07-03 9:27 Sascha Hauer
2012-07-03 10:43 ` Zhang, Sonic
0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2012-07-03 9:27 UTC (permalink / raw)
To: linux-iio; +Cc: Jonathan Cameron, Sonic Zhang, Sascha Hauer
The adt7410 expects information about an irq in platform_data.
The driver can work without an irq, so make platform_data optional
by specifying a dummy platform_data if the device has none.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
This should have been part of the other series for the adt7410 I just sent,
but I overlooked this patch.
drivers/staging/iio/adc/adt7410.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/staging/iio/adc/adt7410.c b/drivers/staging/iio/adc/adt7410.c
index 917b692..d7d9ad9 100644
--- a/drivers/staging/iio/adc/adt7410.c
+++ b/drivers/staging/iio/adc/adt7410.c
@@ -720,6 +720,7 @@ static int __devinit adt7410_probe(struct i2c_client *client,
struct iio_dev *indio_dev;
int ret = 0;
unsigned long *adt7410_platform_data = client->dev.platform_data;
+ unsigned long local_pdata[] = {0, 0};
indio_dev = iio_device_alloc(sizeof(*chip));
if (indio_dev == NULL) {
@@ -737,6 +738,9 @@ static int __devinit adt7410_probe(struct i2c_client *client,
indio_dev->info = &adt7410_info;
indio_dev->modes = INDIO_DIRECT_MODE;
+ if (!adt7410_platform_data)
+ adt7410_platform_data = local_pdata;
+
/* CT critcal temperature event. line 0 */
if (client->irq) {
ret = request_threaded_irq(client->irq,
--
1.7.10
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH] stagin iio adt7410: use local platformdata if none is specified
2012-07-03 9:27 [PATCH] stagin iio adt7410: use local platformdata if none is specified Sascha Hauer
@ 2012-07-03 10:43 ` Zhang, Sonic
2012-07-08 9:31 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Zhang, Sonic @ 2012-07-03 10:43 UTC (permalink / raw)
To: Sascha Hauer, linux-iio@vger.kernel.org; +Cc: Jonathan Cameron
Acked-by: Sonic Zhang <sonic.zhang@analog.com>
>-----Original Message-----
>From: Sascha Hauer [mailto:s.hauer@pengutronix.de]
>Sent: Tuesday, July 03, 2012 5:28 PM
>To: linux-iio@vger.kernel.org
>Cc: Jonathan Cameron; Zhang, Sonic; Sascha Hauer
>Subject: [PATCH] stagin iio adt7410: use local platformdata if none is spe=
cified
>
>The adt7410 expects information about an irq in platform_data.
>The driver can work without an irq, so make platform_data optional
>by specifying a dummy platform_data if the device has none.
>
>Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
>---
>
>This should have been part of the other series for the adt7410 I just sent=
,
>but I overlooked this patch.
>
> drivers/staging/iio/adc/adt7410.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
>diff --git a/drivers/staging/iio/adc/adt7410.c b/drivers/staging/iio/adc/a=
dt7410.c
>index 917b692..d7d9ad9 100644
>--- a/drivers/staging/iio/adc/adt7410.c
>+++ b/drivers/staging/iio/adc/adt7410.c
>@@ -720,6 +720,7 @@ static int __devinit adt7410_probe(struct i2c_client *=
client,
> struct iio_dev *indio_dev;
> int ret =3D 0;
> unsigned long *adt7410_platform_data =3D client->dev.platform_data;
>+ unsigned long local_pdata[] =3D {0, 0};
>
> indio_dev =3D iio_device_alloc(sizeof(*chip));
> if (indio_dev =3D=3D NULL) {
>@@ -737,6 +738,9 @@ static int __devinit adt7410_probe(struct i2c_client *=
client,
> indio_dev->info =3D &adt7410_info;
> indio_dev->modes =3D INDIO_DIRECT_MODE;
>
>+ if (!adt7410_platform_data)
>+ adt7410_platform_data =3D local_pdata;
>+
> /* CT critcal temperature event. line 0 */
> if (client->irq) {
> ret =3D request_threaded_irq(client->irq,
>--
>1.7.10
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] stagin iio adt7410: use local platformdata if none is specified
2012-07-03 10:43 ` Zhang, Sonic
@ 2012-07-08 9:31 ` Jonathan Cameron
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2012-07-08 9:31 UTC (permalink / raw)
To: Zhang, Sonic; +Cc: Sascha Hauer, linux-iio@vger.kernel.org, Jonathan Cameron
On 07/03/2012 11:43 AM, Zhang, Sonic wrote:
> Acked-by: Sonic Zhang <sonic.zhang@analog.com>
>
>> -----Original Message-----
>> From: Sascha Hauer [mailto:s.hauer@pengutronix.de]
>> Sent: Tuesday, July 03, 2012 5:28 PM
>> To: linux-iio@vger.kernel.org
>> Cc: Jonathan Cameron; Zhang, Sonic; Sascha Hauer
>> Subject: [PATCH] stagin iio adt7410: use local platformdata if none is specified
>>
>> The adt7410 expects information about an irq in platform_data.
>> The driver can work without an irq, so make platform_data optional
>> by specifying a dummy platform_data if the device has none.
>>
In theory irq 0 is a valid interrupt on some platforms. Doubt it would
ever be used for this, but there is still a plausible issue around this
platform data. Anyhow, this is definitely an improvement so merged.
>> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
>> ---
>>
>> This should have been part of the other series for the adt7410 I just sent,
>> but I overlooked this patch.
>>
>> drivers/staging/iio/adc/adt7410.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/staging/iio/adc/adt7410.c b/drivers/staging/iio/adc/adt7410.c
>> index 917b692..d7d9ad9 100644
>> --- a/drivers/staging/iio/adc/adt7410.c
>> +++ b/drivers/staging/iio/adc/adt7410.c
>> @@ -720,6 +720,7 @@ static int __devinit adt7410_probe(struct i2c_client *client,
>> struct iio_dev *indio_dev;
>> int ret = 0;
>> unsigned long *adt7410_platform_data = client->dev.platform_data;
>> + unsigned long local_pdata[] = {0, 0};
>>
>> indio_dev = iio_device_alloc(sizeof(*chip));
>> if (indio_dev == NULL) {
>> @@ -737,6 +738,9 @@ static int __devinit adt7410_probe(struct i2c_client *client,
>> indio_dev->info = &adt7410_info;
>> indio_dev->modes = INDIO_DIRECT_MODE;
>>
>> + if (!adt7410_platform_data)
>> + adt7410_platform_data = local_pdata;
>> +
>> /* CT critcal temperature event. line 0 */
>> if (client->irq) {
>> ret = request_threaded_irq(client->irq,
>> --
>> 1.7.10
>>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-07-08 9:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-03 9:27 [PATCH] stagin iio adt7410: use local platformdata if none is specified Sascha Hauer
2012-07-03 10:43 ` Zhang, Sonic
2012-07-08 9:31 ` Jonathan Cameron
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).