Merge tag 'staging-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[linux-drm-fsl-dcu.git] / drivers / iio / adc / ti_am335x_adc.c
index b730864731e8b8b11aa8bbfe0bfb913bcfa2bc0b..2e5cc4409f78884e82f309c729febabe3ff7f982 100644 (file)
@@ -86,19 +86,18 @@ static void tiadc_step_config(struct iio_dev *indio_dev)
 {
        struct tiadc_device *adc_dev = iio_priv(indio_dev);
        unsigned int stepconfig;
-       int i, steps;
+       int i, steps = 0;
 
        /*
         * There are 16 configurable steps and 8 analog input
         * lines available which are shared between Touchscreen and ADC.
         *
-        * Steps backwards i.e. from 16 towards 0 are used by ADC
+        * Steps forwards i.e. from 0 towards 16 are used by ADC
         * depending on number of input lines needed.
         * Channel would represent which analog input
         * needs to be given to ADC to digitalize data.
         */
 
-       steps = TOTAL_STEPS - adc_dev->channels;
        if (iio_buffer_enabled(indio_dev))
                stepconfig = STEPCONFIG_AVG_16 | STEPCONFIG_FIFO1
                                        | STEPCONFIG_MODE_SWCNT;
@@ -250,7 +249,7 @@ static int tiadc_iio_buffered_hardware_setup(struct iio_dev *indio_dev,
        struct iio_buffer *buffer;
        int ret;
 
-       buffer = iio_kfifo_allocate(indio_dev);
+       buffer = iio_kfifo_allocate();
        if (!buffer)
                return -ENOMEM;
 
@@ -264,16 +263,8 @@ static int tiadc_iio_buffered_hardware_setup(struct iio_dev *indio_dev,
        indio_dev->setup_ops = setup_ops;
        indio_dev->modes |= INDIO_BUFFER_HARDWARE;
 
-       ret = iio_buffer_register(indio_dev,
-                                 indio_dev->channels,
-                                 indio_dev->num_channels);
-       if (ret)
-               goto error_free_irq;
-
        return 0;
 
-error_free_irq:
-       free_irq(irq, indio_dev);
 error_kfifo_free:
        iio_kfifo_free(indio_dev->buffer);
        return ret;
@@ -285,7 +276,6 @@ static void tiadc_iio_buffered_hardware_remove(struct iio_dev *indio_dev)
 
        free_irq(adc_dev->mfd_tscadc->irq, indio_dev);
        iio_kfifo_free(indio_dev->buffer);
-       iio_buffer_unregister(indio_dev);
 }