summaryrefslogtreecommitdiff
path: root/drivers/iio/adc/ti-adc081c.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-09-14 06:57:52 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-09-14 06:57:52 +0200
commit1622d35453132a1acd6d650175f9f45e4bcf553e (patch)
tree063a2dfa220452590d068418c2b16b90690dae5a /drivers/iio/adc/ti-adc081c.c
parent978620cc4f5577c5139da9d8377849aeac46687a (diff)
parent856deb866d16e29bd65952e0289066f6078af773 (diff)
Merge 5.9-rc5 into staging-next
We want the staging/iio changes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/iio/adc/ti-adc081c.c')
-rw-r--r--drivers/iio/adc/ti-adc081c.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/iio/adc/ti-adc081c.c b/drivers/iio/adc/ti-adc081c.c
index 8bc04cfae465..b64718daa201 100644
--- a/drivers/iio/adc/ti-adc081c.c
+++ b/drivers/iio/adc/ti-adc081c.c
@@ -32,6 +32,12 @@ struct adc081c {
/* 8, 10 or 12 */
int bits;
+
+ /* Ensure natural alignment of buffer elements */
+ struct {
+ u16 channel;
+ s64 ts __aligned(8);
+ } scan;
};
#define REG_CONV_RES 0x00
@@ -127,14 +133,13 @@ static irqreturn_t adc081c_trigger_handler(int irq, void *p)
struct iio_poll_func *pf = p;
struct iio_dev *indio_dev = pf->indio_dev;
struct adc081c *data = iio_priv(indio_dev);
- u16 buf[8]; /* 2 bytes data + 6 bytes padding + 8 bytes timestamp */
int ret;
ret = i2c_smbus_read_word_swapped(data->i2c, REG_CONV_RES);
if (ret < 0)
goto out;
- buf[0] = ret;
- iio_push_to_buffers_with_timestamp(indio_dev, buf,
+ data->scan.channel = ret;
+ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
iio_get_time_ns(indio_dev));
out:
iio_trigger_notify_done(indio_dev->trig);