Skip to content

Commit

Permalink
staging:iio:adt7410: use local platformdata if none is specified
Browse files Browse the repository at this point in the history
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>
Acked-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Sascha Hauer authored and Jonathan Cameron committed Jul 8, 2012
1 parent d297b9b commit c732a24
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/staging/iio/adc/adt7410.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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,
Expand Down

0 comments on commit c732a24

Please sign in to comment.