Re: AD7192 driver mess

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 29 Mar 2023 12:46:00 +0200
Paul Cercueil <paul@xxxxxxxxxxxxxxx> 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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux