aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/iio_simple_dummy_buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/iio/iio_simple_dummy_buffer.c')
-rw-r--r--drivers/staging/iio/iio_simple_dummy_buffer.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/staging/iio/iio_simple_dummy_buffer.c b/drivers/staging/iio/iio_simple_dummy_buffer.c
index fdfc8739095a..bd628de472a9 100644
--- a/drivers/staging/iio/iio_simple_dummy_buffer.c
+++ b/drivers/staging/iio/iio_simple_dummy_buffer.c
@@ -52,7 +52,7 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p)
data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL);
if (data == NULL)
- return -ENOMEM;
+ goto done;
if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength)) {
/*
@@ -67,31 +67,31 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p)
* software culled hardware scans:
* occasionally a driver may process the nearest hardware
* scan to avoid storing elements that are not desired. This
- * is the fidliest option by far.
- * Here lets pretend we have random access. And the values are
+ * is the fiddliest option by far.
+ * Here let's pretend we have random access. And the values are
* in the constant table fakedata.
*/
int i, j;
for (i = 0, j = 0;
i < bitmap_weight(indio_dev->active_scan_mask,
indio_dev->masklength);
- i++) {
+ i++, j++) {
j = find_next_bit(buffer->scan_mask,
- indio_dev->masklength, j + 1);
- /* random access read form the 'device' */
+ indio_dev->masklength, j);
+ /* random access read from the 'device' */
data[i] = fakedata[j];
len += 2;
}
}
- /* Store a timestampe at an 8 byte boundary */
+ /* Store the timestamp at an 8 byte aligned offset */
if (indio_dev->scan_timestamp)
- *(s64 *)(((phys_addr_t)data + len
- + sizeof(s64) - 1) & ~(sizeof(s64) - 1))
+ *(s64 *)((u8 *)data + ALIGN(len, sizeof(s64)))
= iio_get_time_ns();
buffer->access->store_to(buffer, (u8 *)data, pf->timestamp);
kfree(data);
+done:
/*
* Tell the core we are done with this trigger and ready for the
* next one.