Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 304433
b: refs/heads/master
c: a64c063
h: refs/heads/master
i:
  304431: 0d84127
v: v3
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed Apr 24, 2012
1 parent a0af6e6 commit bf1e5b8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 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: 81a4fc01217c12b42af8a992dcf7fa9cc8373297
refs/heads/master: a64c0634e561c7236f8da5782c8023ec05f8fb5a
1 change: 0 additions & 1 deletion trunk/drivers/staging/iio/adc/ad7887.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ struct ad7887_state {
struct spi_device *spi;
const struct ad7887_chip_info *chip_info;
struct regulator *reg;
size_t d_size;
u16 int_vref_mv;
struct spi_transfer xfer[4];
struct spi_message msg[3];
Expand Down
23 changes: 6 additions & 17 deletions trunk/drivers/staging/iio/adc/ad7887_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,11 @@
static int ad7887_ring_preenable(struct iio_dev *indio_dev)
{
struct ad7887_state *st = iio_priv(indio_dev);
struct iio_buffer *ring = indio_dev->buffer;

st->d_size = bitmap_weight(indio_dev->active_scan_mask,
indio_dev->masklength) *
st->chip_info->channel[0].scan_type.storagebits / 8;

if (ring->scan_timestamp) {
st->d_size += sizeof(s64);

if (st->d_size % sizeof(s64))
st->d_size += sizeof(s64) - (st->d_size % sizeof(s64));
}
int ret;

if (indio_dev->buffer->access->set_bytes_per_datum)
indio_dev->buffer->access->
set_bytes_per_datum(indio_dev->buffer, st->d_size);
ret = iio_sw_buffer_preenable(indio_dev);
if (ret < 0)
return ret;

/* We know this is a single long so can 'cheat' */
switch (*indio_dev->active_scan_mask) {
Expand Down Expand Up @@ -92,7 +81,7 @@ static irqreturn_t ad7887_trigger_handler(int irq, void *p)
indio_dev->masklength) *
st->chip_info->channel[0].scan_type.storagebits / 8;

buf = kzalloc(st->d_size, GFP_KERNEL);
buf = kzalloc(indio_dev->scan_bytes, GFP_KERNEL);
if (buf == NULL)
return -ENOMEM;

Expand All @@ -104,7 +93,7 @@ static irqreturn_t ad7887_trigger_handler(int irq, void *p)

memcpy(buf, st->data, bytes);
if (ring->scan_timestamp)
memcpy(buf + st->d_size - sizeof(s64),
memcpy(buf + indio_dev->scan_bytes - sizeof(s64),
&time_ns, sizeof(time_ns));

indio_dev->buffer->access->store_to(indio_dev->buffer, buf, time_ns);
Expand Down

0 comments on commit bf1e5b8

Please sign in to comment.