Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[firefly-linux-kernel-4.4.55.git] / drivers / staging / iio / adc / ad7816.c
index 4e954d25bd6ed7eae7f7ebcd58eee9f183ece2bb..c8e15664652856a331938398bffc597b4a8f0b14 100644 (file)
@@ -38,7 +38,6 @@
 #define AD7816_TEMP_FLOAT_OFFSET       2
 #define AD7816_TEMP_FLOAT_MASK         0x3
 
-
 /*
  * struct ad7816_chip_info - chip specific information
  */
@@ -48,7 +47,7 @@ struct ad7816_chip_info {
        u16 rdwr_pin;
        u16 convert_pin;
        u16 busy_pin;
-       u8  oti_data[AD7816_CS_MAX+1];
+       u8  oti_data[AD7816_CS_MAX + 1];
        u8  channel_id; /* 0 always be temperature */
        u8  mode;
 };
@@ -60,6 +59,7 @@ static int ad7816_spi_read(struct ad7816_chip_info *chip, u16 *data)
 {
        struct spi_device *spi_dev = chip->spi_dev;
        int ret = 0;
+       __be16 buf;
 
        gpio_set_value(chip->rdwr_pin, 1);
        gpio_set_value(chip->rdwr_pin, 0);
@@ -70,7 +70,6 @@ static int ad7816_spi_read(struct ad7816_chip_info *chip, u16 *data)
        }
        gpio_set_value(chip->rdwr_pin, 1);
 
-
        if (chip->mode == AD7816_PD) { /* operating mode 2 */
                gpio_set_value(chip->convert_pin, 1);
                gpio_set_value(chip->convert_pin, 0);
@@ -84,13 +83,13 @@ static int ad7816_spi_read(struct ad7816_chip_info *chip, u16 *data)
 
        gpio_set_value(chip->rdwr_pin, 0);
        gpio_set_value(chip->rdwr_pin, 1);
-       ret = spi_read(spi_dev, (u8 *)data, sizeof(*data));
+       ret = spi_read(spi_dev, &buf, sizeof(*data));
        if (ret < 0) {
                dev_err(&spi_dev->dev, "SPI data read error\n");
                return ret;
        }
 
-       *data = be16_to_cpu(*data);
+       *data = be16_to_cpu(buf);
 
        return ret;
 }
@@ -203,7 +202,6 @@ static IIO_DEVICE_ATTR(channel, S_IRUGO | S_IWUSR,
                ad7816_store_channel,
                0);
 
-
 static ssize_t ad7816_show_value(struct device *dev,
                                 struct device_attribute *attr,
                                 char *buf)
@@ -434,7 +432,6 @@ MODULE_DEVICE_TABLE(spi, ad7816_id);
 static struct spi_driver ad7816_driver = {
        .driver = {
                .name = "ad7816",
-               .owner = THIS_MODULE,
        },
        .probe = ad7816_probe,
        .id_table = ad7816_id,