]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging:iio:ad7746: Do not store the transfer buffer on the stack
authorLars-Peter Clausen <lars@metafoo.de>
Mon, 25 Nov 2013 12:42:00 +0000 (12:42 +0000)
committerJonathan Cameron <jic23@kernel.org>
Tue, 3 Dec 2013 20:22:28 +0000 (20:22 +0000)
Some I2C controllers might not be able to handle transfer buffers that are
stored on stack.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/staging/iio/cdc/ad7746.c

index 01e15e2f3f50d4f021d9b74cd3cd95d0c9b4b432..cbb1588d591fdb698ffd22a58db3af0293e0be27 100644 (file)
@@ -105,6 +105,11 @@ struct ad7746_chip_info {
        u8      vt_setup;
        u8      capdac[2][2];
        s8      capdac_set;
+
+       union {
+               __be32 d32;
+               u8 d8[4];
+       } data ____cacheline_aligned;
 };
 
 enum ad7746_chan {
@@ -566,11 +571,6 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,
        int ret, delay;
        u8 regval, reg;
 
-       union {
-               __be32 d32;
-               u8 d8[4];
-       } data;
-
        mutex_lock(&indio_dev->mlock);
 
        switch (mask) {
@@ -591,12 +591,12 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,
                /* Now read the actual register */
 
                ret = i2c_smbus_read_i2c_block_data(chip->client,
-                       chan->address >> 8, 3, &data.d8[1]);
+                       chan->address >> 8, 3, &chip->data.d8[1]);
 
                if (ret < 0)
                        goto out;
 
-               *val = (be32_to_cpu(data.d32) & 0xFFFFFF) - 0x800000;
+               *val = (be32_to_cpu(chip->data.d32) & 0xFFFFFF) - 0x800000;
 
                switch (chan->type) {
                case IIO_TEMP: