From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Paul Cercueil <paul@crapouillou.net>
Cc: Jonathan Cameron <jic23@kernel.org>, <linux-iio@vger.kernel.org>
Subject: Re: AD7192 driver mess
Date: Thu, 30 Mar 2023 09:44:13 +0100 [thread overview]
Message-ID: <20230330094413.000053d4@Huawei.com> (raw)
In-Reply-To: <f3365b540d6a6789cb3a18cf531e652673320855.camel@crapouillou.net>
On Wed, 29 Mar 2023 12:46:00 +0200
Paul Cercueil <paul@crapouillou.net> wrote:
> Hi Jonathan,
>
> I noticed that the upstream AD7192 driver (drivers/iio/adc/ad7192.c) we
> have two IIO channels with the same identifier:
>
> AD719x_SHORTED_CHANNEL(3, 2, AD7192_CH_AIN2P_AIN2M)
>
> and:
> AD719x_CHANNEL(5, 2, AD7192_CH_AIN2)
>
> Both macros create a iio_chan_spec with .channel = 2.
>
> This results in having this mess in sysfs:
> in_voltage2_en
> in_voltage2_index
> in_voltage2_shorted_en
> in_voltage2_shorted_index
>
> In turn, this causes Libiio to detect it as a single IIO channel whose
> identifier is "in_voltage2", with attributes "en", "index",
> "shorted_en" and "shorted_index".
>
> My question is, is it okay for the driver to do this? I would expect
> the .channel field to contain an identifier, and it would be invalid
> for two channels to have the same identifier.
Unique naming (ignoring the extend name part) would be my expectation
as well.
So I'd be very happy to see this moved to a different index. I'd consider
it a bug so fine to backport even if it breaks ABI, but open to comments
on this from others.
If this was done originally with the idea of 'grouping' channels, then
that should be changed to being done with labels (though that extend name
trick with the label is then not available).
Jonathan
> Cheers,
> -Paul
prev parent reply other threads:[~2023-03-30 8:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-29 10:46 AD7192 driver mess Paul Cercueil
2023-03-30 8: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=20230330094413.000053d4@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=paul@crapouillou.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