diff options
author | Arnd Bergmann <arnd@arndb.de> | 2012-09-28 17:36:00 -0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2012-10-19 11:19:07 -0400 |
commit | 65cb587d7058441c8c910e8766ee86538c7274d8 (patch) | |
tree | 334b98fc8fac395e7430fca7d4029efd1312868a | |
parent | 48edf8eb53daf98b1fc4498ac54b27c08b955248 (diff) |
staging/iio/lis3l02dq: fix building without irq_to_gpio
The driver has not been building for some time after the
irq_to_gpio function has been removed from the kernel.
The only board in the upstream kernel that provides
this device is the "Stargate 2", which is also maintained
by Jonathan Cameron. Rather than working around the problem
by adding new platform data for this driver, this patch
uses the of_gpio framework to get to the gpio number.
However, the stargate2 code does not (yet) use DT based
probing, so it is still broken, but at least building
allyesconfig works again.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r-- | drivers/staging/iio/accel/lis3l02dq.h | 1 | ||||
-rw-r--r-- | drivers/staging/iio/accel/lis3l02dq_core.c | 10 | ||||
-rw-r--r-- | drivers/staging/iio/accel/lis3l02dq_ring.c | 2 |
3 files changed, 8 insertions, 5 deletions
diff --git a/drivers/staging/iio/accel/lis3l02dq.h b/drivers/staging/iio/accel/lis3l02dq.h index f9bcd41f718..2bac7221837 100644 --- a/drivers/staging/iio/accel/lis3l02dq.h +++ b/drivers/staging/iio/accel/lis3l02dq.h | |||
@@ -158,6 +158,7 @@ struct lis3l02dq_state { | |||
158 | struct spi_device *us; | 158 | struct spi_device *us; |
159 | struct iio_trigger *trig; | 159 | struct iio_trigger *trig; |
160 | struct mutex buf_lock; | 160 | struct mutex buf_lock; |
161 | int gpio; | ||
161 | bool trigger_on; | 162 | bool trigger_on; |
162 | 163 | ||
163 | u8 tx[LIS3L02DQ_MAX_RX] ____cacheline_aligned; | 164 | u8 tx[LIS3L02DQ_MAX_RX] ____cacheline_aligned; |
diff --git a/drivers/staging/iio/accel/lis3l02dq_core.c b/drivers/staging/iio/accel/lis3l02dq_core.c index 21b0469f8bc..d13c7e98978 100644 --- a/drivers/staging/iio/accel/lis3l02dq_core.c +++ b/drivers/staging/iio/accel/lis3l02dq_core.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
16 | #include <linux/irq.h> | 16 | #include <linux/irq.h> |
17 | #include <linux/gpio.h> | 17 | #include <linux/gpio.h> |
18 | #include <linux/of_gpio.h> | ||
18 | #include <linux/mutex.h> | 19 | #include <linux/mutex.h> |
19 | #include <linux/device.h> | 20 | #include <linux/device.h> |
20 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
@@ -690,6 +691,7 @@ static int __devinit lis3l02dq_probe(struct spi_device *spi) | |||
690 | spi_set_drvdata(spi, indio_dev); | 691 | spi_set_drvdata(spi, indio_dev); |
691 | 692 | ||
692 | st->us = spi; | 693 | st->us = spi; |
694 | st->gpio = of_get_gpio(spi->dev.of_node, 0); | ||
693 | mutex_init(&st->buf_lock); | 695 | mutex_init(&st->buf_lock); |
694 | indio_dev->name = spi->dev.driver->name; | 696 | indio_dev->name = spi->dev.driver->name; |
695 | indio_dev->dev.parent = &spi->dev; | 697 | indio_dev->dev.parent = &spi->dev; |
@@ -711,7 +713,7 @@ static int __devinit lis3l02dq_probe(struct spi_device *spi) | |||
711 | goto error_unreg_buffer_funcs; | 713 | goto error_unreg_buffer_funcs; |
712 | } | 714 | } |
713 | 715 | ||
714 | if (spi->irq && gpio_is_valid(irq_to_gpio(spi->irq)) > 0) { | 716 | if (spi->irq) { |
715 | ret = request_threaded_irq(st->us->irq, | 717 | ret = request_threaded_irq(st->us->irq, |
716 | &lis3l02dq_th, | 718 | &lis3l02dq_th, |
717 | &lis3l02dq_event_handler, | 719 | &lis3l02dq_event_handler, |
@@ -738,10 +740,10 @@ static int __devinit lis3l02dq_probe(struct spi_device *spi) | |||
738 | return 0; | 740 | return 0; |
739 | 741 | ||
740 | error_remove_trigger: | 742 | error_remove_trigger: |
741 | if (spi->irq && gpio_is_valid(irq_to_gpio(spi->irq))) | 743 | if (spi->irq) |
742 | lis3l02dq_remove_trigger(indio_dev); | 744 | lis3l02dq_remove_trigger(indio_dev); |
743 | error_free_interrupt: | 745 | error_free_interrupt: |
744 | if (spi->irq && gpio_is_valid(irq_to_gpio(spi->irq)) > 0) | 746 | if (spi->irq) |
745 | free_irq(st->us->irq, indio_dev); | 747 | free_irq(st->us->irq, indio_dev); |
746 | error_uninitialize_buffer: | 748 | error_uninitialize_buffer: |
747 | iio_buffer_unregister(indio_dev); | 749 | iio_buffer_unregister(indio_dev); |
@@ -790,7 +792,7 @@ static int __devexit lis3l02dq_remove(struct spi_device *spi) | |||
790 | lis3l02dq_disable_all_events(indio_dev); | 792 | lis3l02dq_disable_all_events(indio_dev); |
791 | lis3l02dq_stop_device(indio_dev); | 793 | lis3l02dq_stop_device(indio_dev); |
792 | 794 | ||
793 | if (spi->irq && gpio_is_valid(irq_to_gpio(spi->irq)) > 0) | 795 | if (spi->irq) |
794 | free_irq(st->us->irq, indio_dev); | 796 | free_irq(st->us->irq, indio_dev); |
795 | 797 | ||
796 | lis3l02dq_remove_trigger(indio_dev); | 798 | lis3l02dq_remove_trigger(indio_dev); |
diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c index fa4190d9624..13c0b4bd5ba 100644 --- a/drivers/staging/iio/accel/lis3l02dq_ring.c +++ b/drivers/staging/iio/accel/lis3l02dq_ring.c | |||
@@ -263,7 +263,7 @@ static int lis3l02dq_trig_try_reen(struct iio_trigger *trig) | |||
263 | /* If gpio still high (or high again) | 263 | /* If gpio still high (or high again) |
264 | * In theory possible we will need to do this several times */ | 264 | * In theory possible we will need to do this several times */ |
265 | for (i = 0; i < 5; i++) | 265 | for (i = 0; i < 5; i++) |
266 | if (gpio_get_value(irq_to_gpio(st->us->irq))) | 266 | if (gpio_get_value(st->gpio)) |
267 | lis3l02dq_read_all(indio_dev, NULL); | 267 | lis3l02dq_read_all(indio_dev, NULL); |
268 | else | 268 | else |
269 | break; | 269 | break; |