Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 304426
b: refs/heads/master
c: 6b3b58e
h: refs/heads/master
v: v3
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed Apr 24, 2012
1 parent f8567f3 commit 657ded0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 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: a714af276f5002b44e97a2d6d03f85bdae627c41
refs/heads/master: 6b3b58ed15cdc27b1ded4487d74c1b7ae04aa162
28 changes: 20 additions & 8 deletions trunk/drivers/staging/iio/industrialio-buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,29 +508,41 @@ static const unsigned long *iio_scan_mask_match(const unsigned long *av_masks,
return NULL;
}

int iio_sw_buffer_preenable(struct iio_dev *indio_dev)
static int iio_compute_scan_bytes(struct iio_dev *indio_dev, const long *mask,
bool timestamp)
{
struct iio_buffer *buffer = indio_dev->buffer;
const struct iio_chan_spec *ch;
unsigned bytes = 0;
int length, i;
dev_dbg(&indio_dev->dev, "%s\n", __func__);

/* How much space will the demuxed element take? */
for_each_set_bit(i, buffer->scan_mask,
for_each_set_bit(i, mask,
indio_dev->masklength) {
ch = iio_find_channel_from_si(indio_dev, i);
length = ch->scan_type.storagebits/8;
length = ch->scan_type.storagebits / 8;
bytes = ALIGN(bytes, length);
bytes += length;
}
if (buffer->scan_timestamp) {
if (timestamp) {
ch = iio_find_channel_from_si(indio_dev,
buffer->scan_index_timestamp);
length = ch->scan_type.storagebits/8;
indio_dev
->buffer->scan_index_timestamp);
length = ch->scan_type.storagebits / 8;
bytes = ALIGN(bytes, length);
bytes += length;
}
return bytes;
}

int iio_sw_buffer_preenable(struct iio_dev *indio_dev)
{
struct iio_buffer *buffer = indio_dev->buffer;
unsigned bytes;
dev_dbg(&indio_dev->dev, "%s\n", __func__);

/* How much space will the demuxed element take? */
bytes = iio_compute_scan_bytes(indio_dev, buffer->scan_mask,
buffer->scan_timestamp);
buffer->access->set_bytes_per_datum(buffer, bytes);

/* What scan mask do we actually have ?*/
Expand Down

0 comments on commit 657ded0

Please sign in to comment.