linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Daniel Baluta <daniel.baluta@gmail.com>,
	Lars-Peter Clausen <lars@metafoo.de>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: [PATCH 05/11] staging:iio:dummy: Register same channels for device and buffer
Date: Fri, 12 Dec 2014 10:30:58 +0000	[thread overview]
Message-ID: <548AC3E2.4090805@kernel.org> (raw)
In-Reply-To: <CAEnQRZDwOT1q=gKXg8Lh37GF8RX-UJfX-Jt+LVKoe3nMO6ztHA@mail.gmail.com>

On 04/12/14 14:27, Daniel Baluta wrote:
> On Wed, Nov 26, 2014 at 7:55 PM, Lars-Peter Clausen <lars@metafoo.de> wrote:
>> In preparation for moving the buffer registration to the core make sure to
>> register the same channel array for the device and the buffer. Currently the
>> output voltage and the activity channels are not registered for the buffer,
>> setting its scan index to -1 will make sure that it is skipped for the
>> buffer.
>>
>> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
>> ---
>>  drivers/staging/iio/iio_simple_dummy.c        | 13 +++++--------
>>  drivers/staging/iio/iio_simple_dummy.h        |  3 +--
>>  drivers/staging/iio/iio_simple_dummy_buffer.c |  6 +++---
>>  3 files changed, 9 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c
>> index 10a9e08..0b8611a 100644
>> --- a/drivers/staging/iio/iio_simple_dummy.c
>> +++ b/drivers/staging/iio/iio_simple_dummy.c
>> @@ -239,6 +239,7 @@ static const struct iio_chan_spec iio_dummy_channels[] = {
>>         {
>>                 .type = IIO_VOLTAGE,
>>                 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
>> +               .scan_index = -1, /* No buffer support */
>>                 .output = 1,
>>                 .indexed = 1,
>>                 .channel = 0,
>> @@ -248,7 +249,7 @@ static const struct iio_chan_spec iio_dummy_channels[] = {
>>                 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_ENABLE) |
>>                         BIT(IIO_CHAN_INFO_CALIBHEIGHT),
>>                 .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
>> -               .scan_index = -1,
>> +               .scan_index = -1, /* No buffer support */
>>  #ifdef CONFIG_IIO_SIMPLE_DUMMY_EVENTS
>>                 .event_spec = &step_detect_event,
>>                 .num_event_specs = 1,
>> @@ -259,6 +260,7 @@ static const struct iio_chan_spec iio_dummy_channels[] = {
>>                 .modified = 1,
>>                 .channel2 = IIO_MOD_RUNNING,
>>                 .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
>> +               .scan_index = -1, /* No buffer support */
>>  #ifdef CONFIG_IIO_SIMPLE_DUMMY_EVENTS
>>                 .event_spec = &iio_running_event,
>>                 .num_event_specs = 1,
>> @@ -269,6 +271,7 @@ static const struct iio_chan_spec iio_dummy_channels[] = {
>>                 .modified = 1,
>>                 .channel2 = IIO_MOD_WALKING,
>>                 .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
>> +               .scan_index = -1, /* No buffer support */
>>  #ifdef CONFIG_IIO_SIMPLE_DUMMY_EVENTS
>>                 .event_spec = &iio_walking_event,
>>                 .num_event_specs = 1,
>> @@ -638,13 +641,7 @@ static int iio_dummy_probe(int index)
>>         if (ret < 0)
>>                 goto error_free_device;
>>
>> -       /*
>> -        * Configure buffered capture support and register the channels with the
>> -        * buffer, but avoid the output channel being registered by reducing the
>> -        * number of channels by 1.
>> -        */
>> -       ret = iio_simple_dummy_configure_buffer(indio_dev,
>> -                                               iio_dummy_channels, 5);
>> +       ret = iio_simple_dummy_configure_buffer(indio_dev);
>>         if (ret < 0)
>>                 goto error_unregister_events;
>>
>> diff --git a/drivers/staging/iio/iio_simple_dummy.h b/drivers/staging/iio/iio_simple_dummy.h
>> index 3b714b4..af70126 100644
>> --- a/drivers/staging/iio/iio_simple_dummy.h
>> +++ b/drivers/staging/iio/iio_simple_dummy.h
>> @@ -114,8 +114,7 @@ enum iio_simple_dummy_scan_elements {
>>  };
>>
>>  #ifdef CONFIG_IIO_SIMPLE_DUMMY_BUFFER
>> -int iio_simple_dummy_configure_buffer(struct iio_dev *indio_dev,
>> -       const struct iio_chan_spec *channels, unsigned int num_channels);
>> +int iio_simple_dummy_configure_buffer(struct iio_dev *indio_dev);
>>  void iio_simple_dummy_unconfigure_buffer(struct iio_dev *indio_dev);
>>  #else
>>  static inline int iio_simple_dummy_configure_buffer(struct iio_dev *indio_dev,
>> diff --git a/drivers/staging/iio/iio_simple_dummy_buffer.c b/drivers/staging/iio/iio_simple_dummy_buffer.c
>> index fd74f91..35d60d5 100644
>> --- a/drivers/staging/iio/iio_simple_dummy_buffer.c
>> +++ b/drivers/staging/iio/iio_simple_dummy_buffer.c
>> @@ -115,8 +115,7 @@ static const struct iio_buffer_setup_ops iio_simple_dummy_buffer_setup_ops = {
>>         .predisable = &iio_triggered_buffer_predisable,
>>  };
>>
>> -int iio_simple_dummy_configure_buffer(struct iio_dev *indio_dev,
>> -       const struct iio_chan_spec *channels, unsigned int num_channels)
>> +int iio_simple_dummy_configure_buffer(struct iio_dev *indio_dev)
>>  {
>>         int ret;
>>         struct iio_buffer *buffer;
>> @@ -173,7 +172,8 @@ int iio_simple_dummy_configure_buffer(struct iio_dev *indio_dev,
>>          */
>>         indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
>>
>> -       ret = iio_buffer_register(indio_dev, channels, num_channels);
>> +       ret = iio_buffer_register(indio_dev, indio_dev->channels,
>> +                                 indio_dev->num_channels);
>>         if (ret)
>>                 goto error_dealloc_pollfunc;
>>
> 
> Looks good. I guess this can replace the following patch:
> 
> iio: dummy: set scan_index for unbuffered channels
> 
> http://marc.info/?l=linux-iio&m=141693190013582&w=2
Thanks for pointing that out.  Applied this one to the togreg
branch of iio.git.


> 
> thanks,
> Daniel.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


  reply	other threads:[~2014-12-12 10:31 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-26 17:55 [PATCH 00/11] iio: Buffer cleanups and consolidations Lars-Peter Clausen
2014-11-26 17:55 ` [PATCH 01/11] staging:iio:ad5933: Don't enable channels by default Lars-Peter Clausen
2014-12-04 22:51   ` Daniel Baluta
2014-12-12 10:21     ` Jonathan Cameron
2014-11-26 17:55 ` [PATCH 02/11] staging:iio:sca3000: " Lars-Peter Clausen
2014-12-04 22:51   ` Daniel Baluta
2014-12-12 10:22     ` Jonathan Cameron
2014-11-26 17:55 ` [PATCH 03/11] iio: Unexport iio_scan_mask_set() Lars-Peter Clausen
2014-12-05  9:53   ` Daniel Baluta
2014-12-12 10:23     ` Jonathan Cameron
2014-11-26 17:55 ` [PATCH 04/11] staging:iio:sca3000: Register same channels for device and buffer Lars-Peter Clausen
2014-12-04 22:56   ` Daniel Baluta
2014-12-12 10:28     ` Jonathan Cameron
2014-12-10 22:35   ` Hartmut Knaack
2014-12-12 10:29     ` Jonathan Cameron
2014-11-26 17:55 ` [PATCH 05/11] staging:iio:dummy: " Lars-Peter Clausen
2014-12-04 14:27   ` Daniel Baluta
2014-12-12 10:30     ` Jonathan Cameron [this message]
2014-11-26 17:55 ` [PATCH 06/11] iio: Move buffer registration to the core Lars-Peter Clausen
2014-12-04 14:23   ` Daniel Baluta
2014-12-12 10:49     ` Jonathan Cameron
2014-12-12 10:48   ` Jonathan Cameron
2014-11-26 17:55 ` [PATCH 07/11] iio: Remove get_bytes_per_datum() from iio_buffer_access_funcs Lars-Peter Clausen
2014-12-12 10:51   ` Jonathan Cameron
2014-11-26 17:55 ` [PATCH 08/11] iio: buffer: Move iio_buffer_alloc_sysfs and iio_buffer_free_sysfs Lars-Peter Clausen
2014-12-12 10:57   ` Jonathan Cameron
2014-11-26 17:55 ` [PATCH 09/11] iio: buffer: Allocate standard attributes in the core Lars-Peter Clausen
2014-12-10 22:42   ` Hartmut Knaack
2014-12-12 11:06     ` Jonathan Cameron
2014-11-26 17:55 ` [PATCH 10/11] iio: buffer: Make length attribute read only for buffers without set_length Lars-Peter Clausen
2014-12-12 11:08   ` Jonathan Cameron
2014-12-12 11:11     ` Jonathan Cameron
2014-12-18 16:35       ` Lars-Peter Clausen
2014-11-26 17:55 ` [PATCH 11/11] iio: buffer: Drop get_length callback Lars-Peter Clausen
2014-12-12 11:13   ` 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=548AC3E2.4090805@kernel.org \
    --to=jic23@kernel.org \
    --cc=daniel.baluta@gmail.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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).