Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: potentiometer: ds1803: Convert enum->pointer for data in the ID table

Convert enum->pointer for data in the ID table, so that
device_get_match_data() can do match against OF/ACPI/I2C tables, once i2c
bus type match support added to it.

Replace enum->struct *ds1803_cfg for data in the ID table and simplify
ds1803_probe() by replacing device_get_match_data() with
i2c_get_match_data().

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230812144106.163355-1-biju.das.jz@bp.renesas.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Biju Das and committed by
Jonathan Cameron
0f5cecd1 8c89edc1

+5 -8
+5 -8
drivers/iio/potentiometer/ds1803.c
··· 204 204 205 205 static int ds1803_probe(struct i2c_client *client) 206 206 { 207 - const struct i2c_device_id *id = i2c_client_get_device_id(client); 208 207 struct device *dev = &client->dev; 209 208 struct ds1803_data *data; 210 209 struct iio_dev *indio_dev; ··· 216 217 217 218 data = iio_priv(indio_dev); 218 219 data->client = client; 219 - data->cfg = device_get_match_data(dev); 220 - if (!data->cfg) 221 - data->cfg = &ds1803_cfg[id->driver_data]; 220 + data->cfg = i2c_get_match_data(client); 222 221 223 222 indio_dev->info = &ds1803_info; 224 223 indio_dev->channels = data->cfg->channels; ··· 236 239 MODULE_DEVICE_TABLE(of, ds1803_dt_ids); 237 240 238 241 static const struct i2c_device_id ds1803_id[] = { 239 - { "ds1803-010", DS1803_010 }, 240 - { "ds1803-050", DS1803_050 }, 241 - { "ds1803-100", DS1803_100 }, 242 - { "ds3502", DS3502 }, 242 + { "ds1803-010", (kernel_ulong_t)&ds1803_cfg[DS1803_010] }, 243 + { "ds1803-050", (kernel_ulong_t)&ds1803_cfg[DS1803_050] }, 244 + { "ds1803-100", (kernel_ulong_t)&ds1803_cfg[DS1803_100] }, 245 + { "ds3502", (kernel_ulong_t)&ds1803_cfg[DS3502] }, 243 246 {} 244 247 }; 245 248 MODULE_DEVICE_TABLE(i2c, ds1803_id);