[PATCH v2 2/4] iio: adc: ltc2309: Use i2c_get_match_data() helper
From: Carlos Jones Jr
Date: Tue Mar 24 2026 - 04:51:58 EST
Convert the driver to use the i2c_get_match_data() helper function
for retrieving chip-specific information. This simplifies device
identification and aligns with modern kernel practices.
Update both of_device_id and i2c_device_id tables to include
chip_info data pointers. The device name is now sourced from
chip_info to ensure proper identification in sysfs.
No functional changes to existing LTC2309 behavior.
Signed-off-by: Carlos Jones Jr <carlosjr.jones@xxxxxxxxxx>
---
drivers/iio/adc/ltc2309.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/adc/ltc2309.c b/drivers/iio/adc/ltc2309.c
index 0644b1f02568..475ecc21ebe9 100644
--- a/drivers/iio/adc/ltc2309.c
+++ b/drivers/iio/adc/ltc2309.c
@@ -191,7 +191,7 @@ static int ltc2309_probe(struct i2c_client *client)
ltc2309 = iio_priv(indio_dev);
ltc2309->dev = &indio_dev->dev;
ltc2309->client = client;
- chip_info = <c2309_chip_info;
+ chip_info = i2c_get_match_data(client);
ltc2309->read_delay_us = chip_info->read_delay_us;
indio_dev->name = chip_info->name;
@@ -213,13 +213,13 @@ static int ltc2309_probe(struct i2c_client *client)
}
static const struct of_device_id ltc2309_of_match[] = {
- { .compatible = "lltc,ltc2309" },
+ { .compatible = "lltc,ltc2309", .data = <c2309_chip_info },
{ }
};
MODULE_DEVICE_TABLE(of, ltc2309_of_match);
static const struct i2c_device_id ltc2309_id[] = {
- { "ltc2309" },
+ { "ltc2309", (kernel_ulong_t)<c2309_chip_info },
{ }
};
MODULE_DEVICE_TABLE(i2c, ltc2309_id);
--
2.43.0