From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Dominique Martinet <dominique.martinet@atmark-techno.com>
Cc: "Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org>,
"Jonathan Cameron" <jic23@kernel.org>,
"Syunya Ohshio" <syunya.ohshio@atmark-techno.com>,
"Guido Günther" <agx@sigxcpu.org>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Rob Herring" <robh+dt@kernel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
"Conor Dooley" <conor+dt@kernel.org>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: industrialio-core: look for aliases to request device index
Date: Wed, 28 Feb 2024 14:24:41 +0000 [thread overview]
Message-ID: <20240228142441.00002a79@Huawei.com> (raw)
In-Reply-To: <Zd7qz1Qte8HWieF_@atmark-techno.com>
On Wed, 28 Feb 2024 17:11:59 +0900
Dominique Martinet <dominique.martinet@atmark-techno.com> wrote:
> Krzysztof Kozlowski wrote on Wed, Feb 28, 2024 at 08:42:46AM +0100:
> > >> Sorry, that's why you have labels and compatibles.
> >
> > > Setting up a fixed alias seems to be precisely what aliases are about
> > > (e.g. setting rtc0 will make a specific node become /dev/rtc0, same with
> > > ethernet0, gpio, i2c, mmc, serial...), I'm not sure I agree a new label
> > > would be more appropriate here, but perhaps I'm missing some context?
> >
> > Maybe I don't get your point, but your email said "sysfs", so why do you
> > refer to /dev?
>
> I wrote /dev/rtc0, but it also sets the name in /sys, right?
> For example /sys/class/rtc/rtc0
>
> As far as I'm aware iio also creates character devices in /dev with the
> same name (/dev/iio/iio:deviceX), but our application doesn't use these
> at all and has to? look in /sys directly, so normal udev SYMLINK+=
> unfortunately isn't applicable or I wouldn't be bothering with all
> this..
A given IIO device driver may create multiple sysfs directories (registers
device + one or more triggers), so I'm not sure how this would work.
>
> > > I'm not sure I understand this comment -- would you rather this doesn't
> > > use aliases but instead add a new label (e.g. `iio,index = <10>` or
> > > whatever) to the iio node itself?
> >
> > No, the devices already have label property.
>
> Thank you for pointing me at the 'label' property, looking at other
> subsystems e.g. leds I see paths in sysfs that use labels as I'd like it
> to work for iio (/sys/class/leds/<label> and
> /sys/devices/platform/<parent>/leds/<label>)
>
> Unfortunately for iio it looks like labels isn't ignored, but instead
> create a file in the sysfs directory of the device, e.g. I now have
> /sys/bus/iio/devices/iio:device1/label which contains the label string,
> so I'm not sure that can be changed easily as that'd be a change of API
> for existing users for labels in iio devices?
Yes, don't touch that ABI. IIO software assumes naming of
iio\:deviceX etc.
>
> (I checked briefly and didn't find any, but there seems to be an awful
> lot of code in the iio drivers tree about labels so I'm not really
> comfortable changing that without some more background on iio first...
> Jonathan perhaps has an opinion on this?)
There are labels for channels as well as devices, but the short description
you have above is it.
I don't see why that isn't sufficient for your use case though?
What does a directory name matter when you can write a few lines of
code to retrieve the IIO device that you want.
If this was day 0 maybe we could support renaming devices like this
but we have a long history of those names not being stable and label
+ parentage of the IIO devices being used to establish stable identification.
Anything beyond a trivial single use script is going to need to deal with
not having stable names (old kernel, dt without alias etc) so this doesn't
help in general.
Jonathan
>
>
> Thanks,
next prev parent reply other threads:[~2024-02-28 14:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-28 5:12 [PATCH] iio: industrialio-core: look for aliases to request device index Dominique Martinet
2024-02-28 7:16 ` Krzysztof Kozlowski
2024-02-28 7:31 ` Dominique Martinet
2024-02-28 7:42 ` Krzysztof Kozlowski
2024-02-28 8:11 ` Dominique Martinet
2024-02-28 14:24 ` Jonathan Cameron [this message]
2024-02-29 2:59 ` Dominique Martinet
2024-03-15 5:47 ` Dominique Martinet
2024-03-15 15:53 ` David Lechner
2024-03-16 20:17 ` Andy Shevchenko
2024-03-18 2:15 ` Dominique Martinet
2024-03-18 12:29 ` Jonathan Cameron
2024-03-31 14:20 ` Jonathan Cameron
2024-04-01 8:18 ` Dominique Martinet
2024-04-01 16:47 ` Jonathan Cameron
2024-04-11 5:11 ` Dominique Martinet
2024-03-18 14:55 ` David Lechner
2024-03-16 20:14 ` Andy Shevchenko
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=20240228142441.00002a79@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=agx@sigxcpu.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dominique.martinet@atmark-techno.com \
--cc=jic23@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=syunya.ohshio@atmark-techno.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.