Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 325353
b: refs/heads/master
c: 93e33d7
h: refs/heads/master
i:
  325351: 18d7113
v: v3
  • Loading branch information
Lars-Peter Clausen authored and Jonathan Cameron committed Sep 13, 2012
1 parent a73b2d2 commit 458e19d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fcc7800b652e55420b85d1c885f39e8a230ace59
refs/heads/master: 93e33d703030fe0348c1ff9d8f40bc6c2d82dc30
5 changes: 4 additions & 1 deletion trunk/drivers/staging/iio/adc/ad7476.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ struct ad7476_state {
/*
* DMA (thus cache coherency maintenance) requires the
* transfer buffers to live in their own cache lines.
* Make the buffer large enough for one 16 bit sample and one 64 bit
* aligned 64 bit timestamp.
*/
unsigned char data[2] ____cacheline_aligned;
unsigned char data[ALIGN(2, sizeof(s64)) + sizeof(s64)]
____cacheline_aligned;
};

enum ad7476_supported_device_ids {
Expand Down
14 changes: 3 additions & 11 deletions trunk/drivers/staging/iio/adc/ad7476_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,20 @@ static irqreturn_t ad7476_trigger_handler(int irq, void *p)
struct iio_dev *indio_dev = pf->indio_dev;
struct ad7476_state *st = iio_priv(indio_dev);
s64 time_ns;
__u8 *rxbuf;
int b_sent;

rxbuf = kzalloc(indio_dev->scan_bytes, GFP_KERNEL);
if (rxbuf == NULL)
goto done;

b_sent = spi_read(st->spi, rxbuf,
st->chip_info->channel[0].scan_type.storagebits / 8);
b_sent = spi_sync(st->spi, &st->msg);
if (b_sent < 0)
goto done;

time_ns = iio_get_time_ns();

if (indio_dev->scan_timestamp)
memcpy(rxbuf + indio_dev->scan_bytes - sizeof(s64),
&time_ns, sizeof(time_ns));
((s64 *)st->data)[1] = time_ns;

iio_push_to_buffer(indio_dev->buffer, rxbuf);
iio_push_to_buffer(indio_dev->buffer, st->data);
done:
iio_trigger_notify_done(indio_dev->trig);
kfree(rxbuf);

return IRQ_HANDLED;
}
Expand Down

0 comments on commit 458e19d

Please sign in to comment.