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

Marcelo Schmitt <[email protected]>
Newsgroups dev.linux.lists.linux-kernel-mentees,org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel
Message-ID <anqKwJOkl_cxzCT6@debian-BULLSEYE-live-builder-AMD64>
On 08/10, Nicolás Antinori wrote:
> The AM2320 is fully compatible with the AM2315 sensor in terms of I2C
> communication protocol and measurement conversions.
> 
> Add the "am2320" entry to the i2c_device_id table.
> 
> Signed-off-by: Nicolás Antinori <[email protected]>
> ---
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.

> v2:
> - Adapted KConfig text using the suggestions from v1 by Nuno Sá and Andy
>   Shevchenko
> 
> v1: https://lore.kernel.org/all/[email protected]/T/#u
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.