Re: [PATCH v2] iio: humidity: am2315: add am2320 to i2c_device_id table

From: Andy Shevchenko

Date: Tue Aug 11 2026 - 03:39:52 EST


On Mon, Aug 10, 2026 at 11:36:48PM -0300, Marcelo Schmitt wrote:
> On 08/10, Nicolás Antinori wrote:

...

> David's comment about the IIO device name sounds appropriate.
> The am2315 driver might use a chip_info struct to hold the name of each specific design.
> There are many drivers in IIO that already have such things.
> drivers/iio/accel/adxl372_i2c.c is one example.
>
> An alternative might be to use the device id.
>
> const struct i2c_device_id *id = i2c_client_get_device_id(client);
> ...
>
> indio_dev->name = id->name;
>
> Not sure if the second option works well for both i2c and dt (probably not), so
> I'd suggest the chip_info approach if you intend to add a device tree id table.

Indeed, we suggest chip_info for the more robust approach when name is provided
via string literals independently on the ID tables (as there maybe same ID in
the tables for the slightly different devices that may be autodetected runtime,
or different IDs for the same or fully compatible component; the chip_info works
for the latter case).

--
With Best Regards,
Andy Shevchenko