Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Lars-Peter Clausen and committed by
Jonathan Cameron
112b0b79 d4adb07c

+7 -7
+7 -7
drivers/staging/iio/cdc/ad7746.c
··· 105 105 u8 vt_setup; 106 106 u8 capdac[2][2]; 107 107 s8 capdac_set; 108 + 109 + union { 110 + __be32 d32; 111 + u8 d8[4]; 112 + } data ____cacheline_aligned; 108 113 }; 109 114 110 115 enum ad7746_chan { ··· 571 566 int ret, delay; 572 567 u8 regval, reg; 573 568 574 - union { 575 - __be32 d32; 576 - u8 d8[4]; 577 - } data; 578 - 579 569 mutex_lock(&indio_dev->mlock); 580 570 581 571 switch (mask) { ··· 591 591 /* Now read the actual register */ 592 592 593 593 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]); 595 595 596 596 if (ret < 0) 597 597 goto out; 598 598 599 - *val = (be32_to_cpu(data.d32) & 0xFFFFFF) - 0x800000; 599 + *val = (be32_to_cpu(chip->data.d32) & 0xFFFFFF) - 0x800000; 600 600 601 601 switch (chan->type) { 602 602 case IIO_TEMP: