staging: iio: ad2s1200: Replace legacy gpio API with modern API
authorDavid Veenstra <davidjulianveenstra@gmail.com>
Fri, 18 May 2018 18:21:56 +0000 (20:21 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 20 May 2018 10:57:27 +0000 (11:57 +0100)
The legacy, integer based gpio API is replaced with the modern
descriptor based API.

Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/staging/iio/resolver/ad2s1200.c

index 430cc62..b2c46a8 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/spi/spi.h>
@@ -43,8 +44,8 @@
 struct ad2s1200_state {
        struct mutex lock;
        struct spi_device *sdev;
-       int sample;
-       int rdvel;
+       struct gpio_desc *sample;
+       struct gpio_desc *rdvel;
        __be16 rx ____cacheline_aligned;
 };
 
@@ -58,12 +59,12 @@ static int ad2s1200_read_raw(struct iio_dev *indio_dev,
        int ret;
 
        mutex_lock(&st->lock);
-       gpio_set_value(st->sample, 0);
+       gpiod_set_value(st->sample, 0);
 
        /* delay (6 * AD2S1200_TSCLK + 20) nano seconds */
        udelay(1);
-       gpio_set_value(st->sample, 1);
-       gpio_set_value(st->rdvel, !!(chan->type == IIO_ANGL));
+       gpiod_set_value(st->sample, 1);
+       gpiod_set_value(st->rdvel, !!(chan->type == IIO_ANGL));
 
        ret = spi_read(st->sdev, &st->rx, 2);
        if (ret < 0) {
@@ -133,8 +134,8 @@ static int ad2s1200_probe(struct spi_device *spi)
        st = iio_priv(indio_dev);
        mutex_init(&st->lock);
        st->sdev = spi;
-       st->sample = pins[0];
-       st->rdvel = pins[1];
+       st->sample = gpio_to_desc(pins[0]);
+       st->rdvel = gpio_to_desc(pins[1]);
 
        indio_dev->dev.parent = &spi->dev;
        indio_dev->info = &ad2s1200_info;