]> Pileus Git - ~andy/linux/commitdiff
staging: iio: adc: ad7476 more list review feedback by Jonathan Cameron
authorMichael Hennerich <michael.hennerich@analog.com>
Mon, 11 Oct 2010 16:05:56 +0000 (18:05 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 12 Oct 2010 15:59:32 +0000 (08:59 -0700)
Print in_scale in decimal format.
Kconfig list the names of the parts in full, to ease seraching.
Use st->spi in the call as it is only used the once.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/iio/adc/Kconfig
drivers/staging/iio/adc/ad7476_core.c

index 71713eed8abb498d7fdd36a2ab2e39f75eed6917..81a7d45ec228db185480df9e7070b137f2dc8c6d 100644 (file)
@@ -51,8 +51,9 @@ config AD7476
        tristate "Analog Devices AD7475/6/7/8 AD7466/7/8 and AD7495 ADC driver"
        depends on SPI
        help
-         Say yes here to build support for Analog Devices AD7475/6/7/8,
-         AD7466/7/8 and AD7495 ADC driver.
+         Say yes here to build support for Analog Devices
+         AD7475, AD7476, AD7477, AD7478, AD7466, AD7467, AD7468, AD7495
+         SPI analog to digital convertors (ADC).
          If unsure, say N (but it's safe to say "Y").
 
          To compile this driver as a module, choose M here: the
index bbd72a6ef144beff948383a3520c6ead68857b27..deb68c8a6e180c6dea01a11313ef932a9b54170c 100644 (file)
 
 static int ad7476_scan_direct(struct ad7476_state *st)
 {
-       struct spi_device *spi = st->spi;
        int ret;
 
-       ret = spi_sync(spi, &st->msg);
+       ret = spi_sync(st->spi, &st->msg);
        if (ret)
                return ret;
 
@@ -67,13 +66,9 @@ static ssize_t ad7476_show_scale(struct device *dev,
        struct iio_dev *dev_info = dev_get_drvdata(dev);
        struct ad7476_state *st = iio_dev_get_devdata(dev_info);
        /* Corresponds to Vref / 2^(bits) */
+       unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits;
 
-       if ((1 << (st->chip_info->bits + 1)) > st->int_vref_mv)
-               return sprintf(buf, "%d/2^%d\n",
-                              st->int_vref_mv, st->chip_info->bits);
-       else
-               return sprintf(buf, "%d\n",
-                              st->int_vref_mv >> st->chip_info->bits);
+       return sprintf(buf, "%d.%d\n", scale_uv / 1000, scale_uv % 1000);
 }
 static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad7476_show_scale, NULL, 0);