diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-09-25 11:59:04 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-09-25 11:59:04 -0400 |
commit | e2aad1d5716c5f7fa5deb4a96e6b6a4e9f24e78b (patch) | |
tree | 389fbdf161a3c28c9b2f98fdc1ccd89d474ef884 /drivers/iio/industrialio-buffer.c | |
parent | 3ffdea3feca9e2c95c2e93e217d77c9c368f747a (diff) | |
parent | 4a10c2ac2f368583138b774ca41fac4207911983 (diff) |
Merge 3.12-rc2 into staging-next.
This resolves the merge problem with two iio drivers that Stephen
Rothwell pointed out.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/iio/industrialio-buffer.c')
-rw-r--r-- | drivers/iio/industrialio-buffer.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 2361fbc74e33..e9f389b9da69 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c | |||
@@ -454,6 +454,25 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev, | |||
454 | return bytes; | 454 | return bytes; |
455 | } | 455 | } |
456 | 456 | ||
457 | void iio_disable_all_buffers(struct iio_dev *indio_dev) | ||
458 | { | ||
459 | struct iio_buffer *buffer, *_buffer; | ||
460 | |||
461 | if (list_empty(&indio_dev->buffer_list)) | ||
462 | return; | ||
463 | |||
464 | if (indio_dev->setup_ops->predisable) | ||
465 | indio_dev->setup_ops->predisable(indio_dev); | ||
466 | |||
467 | list_for_each_entry_safe(buffer, _buffer, | ||
468 | &indio_dev->buffer_list, buffer_list) | ||
469 | list_del_init(&buffer->buffer_list); | ||
470 | |||
471 | indio_dev->currentmode = INDIO_DIRECT_MODE; | ||
472 | if (indio_dev->setup_ops->postdisable) | ||
473 | indio_dev->setup_ops->postdisable(indio_dev); | ||
474 | } | ||
475 | |||
457 | int iio_update_buffers(struct iio_dev *indio_dev, | 476 | int iio_update_buffers(struct iio_dev *indio_dev, |
458 | struct iio_buffer *insert_buffer, | 477 | struct iio_buffer *insert_buffer, |
459 | struct iio_buffer *remove_buffer) | 478 | struct iio_buffer *remove_buffer) |
@@ -522,8 +541,15 @@ int iio_update_buffers(struct iio_dev *indio_dev, | |||
522 | * Note can only occur when adding a buffer. | 541 | * Note can only occur when adding a buffer. |
523 | */ | 542 | */ |
524 | list_del_init(&insert_buffer->buffer_list); | 543 | list_del_init(&insert_buffer->buffer_list); |
525 | indio_dev->active_scan_mask = old_mask; | 544 | if (old_mask) { |
526 | success = -EINVAL; | 545 | indio_dev->active_scan_mask = old_mask; |
546 | success = -EINVAL; | ||
547 | } | ||
548 | else { | ||
549 | kfree(compound_mask); | ||
550 | ret = -EINVAL; | ||
551 | goto error_ret; | ||
552 | } | ||
527 | } | 553 | } |
528 | } else { | 554 | } else { |
529 | indio_dev->active_scan_mask = compound_mask; | 555 | indio_dev->active_scan_mask = compound_mask; |