mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-04 04:02:26 +00:00
iio: potentiometer: mcp4018: Use i2c_get_match_data()
Replace of_device_get_match_data() and i2c_match_id() by i2c_get_match _data() by making similar I2C and DT-based matching table. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230723105209.175545-1-biju.das.jz@bp.renesas.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
65659a8df1
commit
b68adc0ee5
@ -99,20 +99,25 @@ static const struct iio_info mcp4018_info = {
|
||||
.write_raw = mcp4018_write_raw,
|
||||
};
|
||||
|
||||
#define MCP4018_ID_TABLE(_name, cfg) { \
|
||||
.name = _name, \
|
||||
.driver_data = (kernel_ulong_t)&mcp4018_cfg[cfg], \
|
||||
}
|
||||
|
||||
static const struct i2c_device_id mcp4018_id[] = {
|
||||
{ "mcp4017-502", MCP4018_502 },
|
||||
{ "mcp4017-103", MCP4018_103 },
|
||||
{ "mcp4017-503", MCP4018_503 },
|
||||
{ "mcp4017-104", MCP4018_104 },
|
||||
{ "mcp4018-502", MCP4018_502 },
|
||||
{ "mcp4018-103", MCP4018_103 },
|
||||
{ "mcp4018-503", MCP4018_503 },
|
||||
{ "mcp4018-104", MCP4018_104 },
|
||||
{ "mcp4019-502", MCP4018_502 },
|
||||
{ "mcp4019-103", MCP4018_103 },
|
||||
{ "mcp4019-503", MCP4018_503 },
|
||||
{ "mcp4019-104", MCP4018_104 },
|
||||
{}
|
||||
MCP4018_ID_TABLE("mcp4017-502", MCP4018_502),
|
||||
MCP4018_ID_TABLE("mcp4017-103", MCP4018_103),
|
||||
MCP4018_ID_TABLE("mcp4017-503", MCP4018_503),
|
||||
MCP4018_ID_TABLE("mcp4017-104", MCP4018_104),
|
||||
MCP4018_ID_TABLE("mcp4018-502", MCP4018_502),
|
||||
MCP4018_ID_TABLE("mcp4018-103", MCP4018_103),
|
||||
MCP4018_ID_TABLE("mcp4018-503", MCP4018_503),
|
||||
MCP4018_ID_TABLE("mcp4018-104", MCP4018_104),
|
||||
MCP4018_ID_TABLE("mcp4019-502", MCP4018_502),
|
||||
MCP4018_ID_TABLE("mcp4019-103", MCP4018_103),
|
||||
MCP4018_ID_TABLE("mcp4019-503", MCP4018_503),
|
||||
MCP4018_ID_TABLE("mcp4019-104", MCP4018_104),
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, mcp4018_id);
|
||||
|
||||
@ -157,9 +162,7 @@ static int mcp4018_probe(struct i2c_client *client)
|
||||
i2c_set_clientdata(client, indio_dev);
|
||||
data->client = client;
|
||||
|
||||
data->cfg = device_get_match_data(dev);
|
||||
if (!data->cfg)
|
||||
data->cfg = &mcp4018_cfg[i2c_match_id(mcp4018_id, client)->driver_data];
|
||||
data->cfg = i2c_get_match_data(client);
|
||||
|
||||
indio_dev->info = &mcp4018_info;
|
||||
indio_dev->channels = &mcp4018_channel;
|
||||
|
Loading…
Reference in New Issue
Block a user