linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Crestez Dan Leonard <leonard.crestez@intel.com>,
	linux-iio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Daniel Baluta <daniel.baluta@intel.com>
Subject: Re: [RFC 0/7] Deal with iio trigger names
Date: Sun, 29 May 2016 20:44:27 +0100	[thread overview]
Message-ID: <58325d90-7718-391c-fc7c-b75460cad371@kernel.org> (raw)
In-Reply-To: <cover.1464027859.git.leonard.crestez@intel.com>

On 23/05/16 19:39, Crestez Dan Leonard wrote:
> IIO documents that trigger names are unique but does not actually guarantee
> this. You can easily create a software trigger with a duplicate name if you
> enable CONFIG_IIO_HRTIMER_TRIGGER:
> 
> 	mkdir /sys/kernel/config/iio/triggers/hrtimer/\
> 		`cat /sys/bus/iio/devices/trigger0/name`
> 
> You can also get in this situation if you connect two identical st_sensors.
> 
> My attempt to fix this is by adding a new 'current_trigger_id' ABI which is a
> numeric ID (X from triggerX) rather than a non-unique string. I tested that
> this works as expected when connecting two LIS3DH to the same system. This is
> in patches 4,5.
> 
> In theory the current_trigger ABI could be overloaded to looks for something
> matching "trigger[0-9]+" but this would be nastier. There would be a need to
> prevent registering triggers that match that expression in order to prevent
> stuff like:
> 
> 	mkdir /sys/kernel/config/iio/triggers/hrtimer/trigger1
> 
> Such an overload wouldn't work on read and make it impossible to unambigiously
> determine the currently selected trigger.
> 
> 
> Patch 6 disallows registering duplicate trigger names. This makes drivers
> which currently do that break at probe time.
> 
> Patch 7 attempts to ensure that all drivers include indio_dev->id when calling
> iio_trigger_alloc. This obviously changes trigger names.
> 
> 
> Either 4,5 or 6,7 fix this issue, but 4,5 causes fewer compat issues.
> 
> 
> Patches 1,2,3 are just minor features in tools/generic_buffer. They supersede
> the v2 I posted earlier:
Please don't do this in future.  When reviewing lots of series, one tends
to relying on sorting by name to make sure you find the latest version of
a series.  Do this and people don't know there is a new version embedded in
a different series (in this case I picked up V2 when you had found an issue
in it).

Jonathan
> 
> 	https://www.spinics.net/lists/linux-iio/msg24867.html
> 
> Crestez Dan Leonard (7):
>   iio: generic_buffer: Cleanup when receiving signals
>   iio: generic_buffer: Add --device-num option
>   iio: generic_buffer: Add --trigger-num option
>   iio: Add current_trigger_id alternative
>   iio: generic_buffer: Use current_trigger_id
>   iio: Refuse to register triggers with duplicate names
>   iio: Make trigger names unique
> 
>  Documentation/ABI/testing/sysfs-bus-iio            |   9 +
>  Documentation/DocBook/iio.tmpl                     |   4 +-
>  drivers/iio/adc/max1027.c                          |   4 +-
>  drivers/iio/common/st_sensors/st_sensors_trigger.c |   2 +-
>  drivers/iio/industrialio-trigger.c                 | 136 ++++++++---
>  drivers/iio/light/gp2ap020a00f.c                   |   4 +-
>  tools/iio/generic_buffer.c                         | 269 ++++++++++++++-------
>  7 files changed, 309 insertions(+), 119 deletions(-)
> 

      parent reply	other threads:[~2016-05-29 19:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-23 18:39 [RFC 0/7] Deal with iio trigger names Crestez Dan Leonard
2016-05-23 18:39 ` [PATCHv3 1/7] iio: generic_buffer: Cleanup when receiving signals Crestez Dan Leonard
2016-05-29 19:38   ` Jonathan Cameron
2016-05-23 18:39 ` [PATCHv3 2/7] iio: generic_buffer: Add --device-num option Crestez Dan Leonard
2016-05-29 19:41   ` Jonathan Cameron
2016-05-23 18:39 ` [PATCHv3 3/7] iio: generic_buffer: Add --trigger-num option Crestez Dan Leonard
2016-05-29 19:43   ` Jonathan Cameron
2016-05-23 18:39 ` [RFC 4/7] iio: Add current_trigger_id alternative Crestez Dan Leonard
2016-05-31 14:11   ` Lars-Peter Clausen
2016-05-23 18:40 ` [RFC 5/7] iio: generic_buffer: Use current_trigger_id Crestez Dan Leonard
2016-05-23 18:40 ` [RFC 6/7] iio: Refuse to register triggers with duplicate names Crestez Dan Leonard
2016-05-29 19:48   ` Jonathan Cameron
2016-05-30 12:49     ` Crestez Dan Leonard
2016-05-31 14:03       ` Lars-Peter Clausen
2016-06-11 16:55         ` Jonathan Cameron
2016-05-23 18:40 ` [RFC 7/7] iio: Make trigger names unique Crestez Dan Leonard
2016-05-29 19:44 ` Jonathan Cameron [this message]

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=58325d90-7718-391c-fc7c-b75460cad371@kernel.org \
    --to=jic23@kernel.org \
    --cc=daniel.baluta@intel.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=leonard.crestez@intel.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@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).