From: Lars-Peter Clausen <lars@metafoo.de>
To: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Jonathan Cameron <jic23@cam.ac.uk>, linux-iio@vger.kernel.org
Subject: Re: [v2 2/9] iio:adc:at91: Use new triggered buffer setup helper
Date: Fri, 15 Jun 2012 18:32:25 +0200 [thread overview]
Message-ID: <4FDB6399.8080209@metafoo.de> (raw)
In-Reply-To: <1339145332-26811-2-git-send-email-lars@metafoo.de>
On 06/08/2012 10:48 AM, Lars-Peter Clausen wrote:
> Use the new triggered buffer setup helper function to allocate and register
> buffer and pollfunc.
>
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Acked-by: Jonathan Cameron <jic23@kernel.org>
Hi Maxime,
Can you take a look at this patch and say whether you are OK with it? I've
only compile tested it since I don't have the hardware, but I don't expect
any problems since the conversion is straight forward and a similar
conversion has been done for other drivers as well, which worked fine so far.
Thanks,
- Lars
> ---
> drivers/iio/adc/Kconfig | 3 +--
> drivers/iio/adc/at91_adc.c | 51 ++++----------------------------------------
> 2 files changed, 5 insertions(+), 49 deletions(-)
>
> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> index 9a0df81..4f7f584 100644
> --- a/drivers/iio/adc/Kconfig
> +++ b/drivers/iio/adc/Kconfig
> @@ -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.
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index f18a95d..6a08469 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -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>
>
> @@ -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,
next prev parent reply other threads:[~2012-06-15 16:32 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-08 8:48 [v2 1/9] staging:iio: Add helper function for initializing triggered buffers Lars-Peter Clausen
2012-06-08 8:48 ` [v2 2/9] iio:adc:at91: Use new triggered buffer setup helper Lars-Peter Clausen
2012-06-15 16:32 ` Lars-Peter Clausen [this message]
2012-06-18 7:56 ` Maxime Ripard
2012-06-18 8:23 ` Lars-Peter Clausen
2012-06-18 8:38 ` Jonathan Cameron
2012-06-18 12:07 ` Maxime Ripard
2012-06-08 8:48 ` [v2 3/9] staging:iio:adc:ad7192: Use new triggered buffer setup helper function Lars-Peter Clausen
2012-06-08 8:48 ` [v2 4/9] staging:iio:adc:ad7298: " Lars-Peter Clausen
2012-06-18 9:45 ` Lars-Peter Clausen
2012-06-18 11:06 ` Jonathan Cameron
2012-06-08 8:48 ` [v2 5/9] staging:iio:adc:ad7476: " Lars-Peter Clausen
2012-06-08 8:48 ` [v2 6/9] staging:iio:adc:ad7606: " Lars-Peter Clausen
2012-06-08 8:48 ` [v2 7/9] staging:iio:adc:ad7793: " Lars-Peter Clausen
2012-06-08 8:48 ` [v2 8/9] staging:iio:adc:ad7887: " Lars-Peter Clausen
2012-06-08 8:48 ` [v2 9/9] staging:iio:adc:ad799x: " Lars-Peter Clausen
2012-06-08 11:36 ` [v2 1/9] staging:iio: Add helper function for initializing triggered buffers Jonathan Cameron
2012-06-08 12:13 ` [PATCG v3 " Lars-Peter Clausen
2012-06-08 12:11 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FDB6399.8080209@metafoo.de \
--to=lars@metafoo.de \
--cc=jic23@cam.ac.uk \
--cc=linux-iio@vger.kernel.org \
--cc=maxime.ripard@free-electrons.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).