Skip to content

Commit 112b0b7

Browse files
larsclausenjic23
authored andcommitted
staging:iio:ad7746: Do not store the transfer buffer on the stack
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>
1 parent d4adb07 commit 112b0b7

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎drivers/staging/iio/cdc/ad7746.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ struct ad7746_chip_info {
105105
u8 vt_setup;
106106
u8 capdac[2][2];
107107
s8 capdac_set;
108+
109+
union {
110+
__be32 d32;
111+
u8 d8[4];
112+
} data ____cacheline_aligned;
108113
};
109114

110115
enum ad7746_chan {
@@ -566,11 +571,6 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,
566571
int ret, delay;
567572
u8 regval, reg;
568573

569-
union {
570-
__be32 d32;
571-
u8 d8[4];
572-
} data;
573-
574574
mutex_lock(&indio_dev->mlock);
575575

576576
switch (mask) {
@@ -591,12 +591,12 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,
591591
/* Now read the actual register */
592592

593593
ret = i2c_smbus_read_i2c_block_data(chip->client,
594-
chan->address >> 8, 3, &data.d8[1]);
594+
chan->address >> 8, 3, &chip->data.d8[1]);
595595

596596
if (ret < 0)
597597
goto out;
598598

599-
*val = (be32_to_cpu(data.d32) & 0xFFFFFF) - 0x800000;
599+
*val = (be32_to_cpu(chip->data.d32) & 0xFFFFFF) - 0x800000;
600600

601601
switch (chan->type) {
602602
case IIO_TEMP:

0 commit comments

Comments
 (0)