From: Jonathan Cameron <jic23@kernel.org>
To: "Łukasz Czerwiński" <l.czerwinski@samsung.com>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH 2/4] iio: st_sensors: Add threshold events support
Date: Tue, 17 Sep 2013 20:36:19 +0100 [thread overview]
Message-ID: <5238AF33.6010201@kernel.org> (raw)
In-Reply-To: <5238262E.1000901@samsung.com>
>>>
>>> +#define ST_SENSORS_LSM_EVENTS_MASK \
>>> + (IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING) | \
>>> + IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING))
>>> +
>>> #define ST_SENSORS_LSM_CHANNELS(device_type, mask, index, mod, \
>>> - ch2, s, endian, rbits, sbits, addr) \
>>> + ch, s, endian, rbits, sbits, addr) \
>>> { \
>>> .type = device_type, \
>>> .modified = mod, \
>>> .info_mask_separate = mask, \
>>> .scan_index = index, \
>>> - .channel2 = ch2, \
>>> + .channel = ch, \
>>> + .channel2 = ch, \
>> This is 'interesting'. What is the intent?
>>
>> The result will be writing the modifier to both channel and channel2.
>> I don't htink that will have any effect, but it is incorrect so please
>> drop the setting of channel. It might be more appropriate to name
>> you ch instead as mod or something like that to make it clear what
>> is going on?
>>
> Sorry for no explanation. This was my quick workaround. Probably there is a bug in the industrialio-event.c.
> Documentation says
>
> * @channel2: If there is a second number for a differential
> * channel then this is it. If modified is set then the
> * value here specifies the modifier.
>
> So when channel is modified third parameter passed to the IIO_MOD_EVENT_CODE should be chan->channel2 not chan->channel
>
> diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c
> index 10aa9ef..f146acd 100644
> --- a/drivers/iio/industrialio-event.c
> +++ b/drivers/iio/industrialio-event.c
> @@ -276,7 +276,7 @@ static int iio_device_add_event_sysfs(struct iio_dev *indio_dev,
> goto error_ret;
> }
> if (chan->modified)
> - mask = IIO_MOD_EVENT_CODE(chan->type, 0, chan->channel,
> + mask = IIO_MOD_EVENT_CODE(chan->type, 0, chan->channel2,
> i/IIO_EV_DIR_MAX,
> i%IIO_EV_DIR_MAX);
> else if (chan->differential)
>
>>> .address = addr, \
>>> .scan_type = { \
>>> .sign = s, \
Ahh, you are quite correct.
Please could you post that patch formally and I'll push it out as a fix.
If not I'll sort it out at the weekend.
Thanks,
Jonathan
next prev parent reply other threads:[~2013-09-17 18:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-02 12:15 [PATCH 0/4]iio: STMicroelectronics DT and event support Lukasz Czerwinski
2013-07-02 12:15 ` [PATCH 1/4] iio: st_sensors: Add DT bindings for st_accel and st_gyro Lukasz Czerwinski
2013-07-02 12:15 ` [PATCH 2/4] iio: st_sensors: Add threshold events support Lukasz Czerwinski
2013-08-04 14:55 ` Jonathan Cameron
2013-09-17 9:51 ` Łukasz Czerwiński
2013-09-17 19:36 ` Jonathan Cameron [this message]
2013-07-02 12:15 ` [PATCH 3/4] iio: accel: Add event subsystem to st_accel driver Lukasz Czerwinski
2013-08-04 16:02 ` Jonathan Cameron
2013-07-02 12:15 ` [PATCH 4/4] iio: lps331ap: Add support for DT Lukasz Czerwinski
2013-07-02 12:56 ` Lars-Peter Clausen
2013-07-16 13:22 ` Maxime Ripard
2013-08-29 15:25 ` [PATCH 0/4]iio: STMicroelectronics DT and event support Denis CIOCCA
2013-08-30 7:06 ` Lee Jones
2013-08-30 8:07 ` Lee Jones
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=5238AF33.6010201@kernel.org \
--to=jic23@kernel.org \
--cc=l.czerwinski@samsung.com \
--cc=linux-iio@vger.kernel.org \
/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).