Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 317877
b: refs/heads/master
c: 8163663
h: refs/heads/master
i:
  317875: 6426ee9
v: v3
  • Loading branch information
Lars-Peter Clausen authored and Jonathan Cameron committed Jul 9, 2012
1 parent cda8ee7 commit 1167560
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 939546d1a9f47ed169554c711e1e05965b84ffe1
refs/heads/master: 81636632057cc1bece2531220dd5803036f95ea9
16 changes: 16 additions & 0 deletions trunk/drivers/iio/industrialio-buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,22 @@ int iio_sw_buffer_preenable(struct iio_dev *indio_dev)
}
EXPORT_SYMBOL(iio_sw_buffer_preenable);

/**
* iio_validate_scan_mask_onehot() - Validates that exactly one channel is selected
* @indio_dev: the iio device
* @mask: scan mask to be checked
*
* Return true if exactly one bit is set in the scan mask, false otherwise. It
* can be used for devices where only one channel can be active for sampling at
* a time.
*/
bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev,
const unsigned long *mask)
{
return bitmap_weight(mask, indio_dev->masklength) == 1;
}
EXPORT_SYMBOL_GPL(iio_validate_scan_mask_onehot);

static bool iio_validate_scan_mask(struct iio_dev *indio_dev,
const unsigned long *mask)
{
Expand Down
3 changes: 3 additions & 0 deletions trunk/include/linux/iio/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ ssize_t iio_buffer_show_enable(struct device *dev,

int iio_sw_buffer_preenable(struct iio_dev *indio_dev);

bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev,
const unsigned long *mask);

#else /* CONFIG_IIO_BUFFER */

static inline int iio_buffer_register(struct iio_dev *indio_dev,
Expand Down

0 comments on commit 1167560

Please sign in to comment.