Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 317420
b: refs/heads/master
c: 90032e4
h: refs/heads/master
v: v3
  • Loading branch information
Lars-Peter Clausen authored and Greg Kroah-Hartman committed Jun 19, 2012
1 parent 7f6ea4e commit 6c33532
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 50 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: 23f2d735a932c7833d2d00da5e3ecdf4a6836210
refs/heads/master: 90032e4e9cc40e2933259190b670d70ddd149e68
3 changes: 1 addition & 2 deletions trunk/drivers/iio/adc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ config AT91_ADC
tristate "Atmel AT91 ADC"
depends on ARCH_AT91
select IIO_BUFFER
select IIO_KFIFO_BUF
select IIO_TRIGGER
select IIO_TRIGGERED_BUFFER
select SYSFS
help
Say yes here to build support for Atmel AT91 ADC.
Expand Down
51 changes: 4 additions & 47 deletions trunk/drivers/iio/adc/at91_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

#include <linux/iio/iio.h>
#include <linux/iio/buffer.h>
#include <linux/iio/kfifo_buf.h>
#include <linux/iio/trigger.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>

#include <mach/at91_adc.h>

Expand Down Expand Up @@ -318,58 +318,15 @@ static void at91_adc_trigger_remove(struct iio_dev *idev)
}
}

static const struct iio_buffer_setup_ops at91_adc_buffer_ops = {
.preenable = &iio_sw_buffer_preenable,
.postenable = &iio_triggered_buffer_postenable,
.predisable = &iio_triggered_buffer_predisable,
};

static int at91_adc_buffer_init(struct iio_dev *idev)
{
int ret;

idev->buffer = iio_kfifo_allocate(idev);
if (!idev->buffer) {
ret = -ENOMEM;
goto error_ret;
}

idev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
&at91_adc_trigger_handler,
IRQF_ONESHOT,
idev,
"%s-consumer%d",
idev->name,
idev->id);
if (idev->pollfunc == NULL) {
ret = -ENOMEM;
goto error_pollfunc;
}

idev->setup_ops = &at91_adc_buffer_ops;
idev->modes |= INDIO_BUFFER_TRIGGERED;

ret = iio_buffer_register(idev,
idev->channels,
idev->num_channels);
if (ret)
goto error_register;

return 0;

error_register:
iio_dealloc_pollfunc(idev->pollfunc);
error_pollfunc:
iio_kfifo_free(idev->buffer);
error_ret:
return ret;
return iio_triggered_buffer_setup(idev, &iio_pollfunc_store_time,
&at91_adc_trigger_handler, NULL);
}

static void at91_adc_buffer_remove(struct iio_dev *idev)
{
iio_buffer_unregister(idev);
iio_dealloc_pollfunc(idev->pollfunc);
iio_kfifo_free(idev->buffer);
iio_triggered_buffer_cleanup(idev);
}

static int at91_adc_read_raw(struct iio_dev *idev,
Expand Down

0 comments on commit 6c33532

Please sign in to comment.