aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/potentiometer/mcp4018.c
diff options
context:
space:
mode:
authorPeter Rosin <peda@axentia.se>2018-04-11 08:49:14 -0400
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2018-04-15 13:09:47 -0400
commit0f6f400e6980b2eb675289fd0296f916dd4cb0f0 (patch)
treef8f05753272e20a40347fabee615a506cb7e7143 /drivers/iio/potentiometer/mcp4018.c
parent4efa1a0050eba411cd0b5b6714d6b89cdcb128f7 (diff)
iio: potentiometer: mcp4018: switch to using .probe_new
Use the new probe style for i2c drivers. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/potentiometer/mcp4018.c')
-rw-r--r--drivers/iio/potentiometer/mcp4018.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/drivers/iio/potentiometer/mcp4018.c b/drivers/iio/potentiometer/mcp4018.c
index 601b25d1f387..320a7c929777 100644
--- a/drivers/iio/potentiometer/mcp4018.c
+++ b/drivers/iio/potentiometer/mcp4018.c
@@ -99,6 +99,23 @@ static const struct iio_info mcp4018_info = {
99 .write_raw = mcp4018_write_raw, 99 .write_raw = mcp4018_write_raw,
100}; 100};
101 101
102static const struct i2c_device_id mcp4018_id[] = {
103 { "mcp4017-502", MCP4018_502 },
104 { "mcp4017-103", MCP4018_103 },
105 { "mcp4017-503", MCP4018_503 },
106 { "mcp4017-104", MCP4018_104 },
107 { "mcp4018-502", MCP4018_502 },
108 { "mcp4018-103", MCP4018_103 },
109 { "mcp4018-503", MCP4018_503 },
110 { "mcp4018-104", MCP4018_104 },
111 { "mcp4019-502", MCP4018_502 },
112 { "mcp4019-103", MCP4018_103 },
113 { "mcp4019-503", MCP4018_503 },
114 { "mcp4019-104", MCP4018_104 },
115 {}
116};
117MODULE_DEVICE_TABLE(i2c, mcp4018_id);
118
102#ifdef CONFIG_OF 119#ifdef CONFIG_OF
103 120
104#define MCP4018_COMPATIBLE(of_compatible, cfg) { \ 121#define MCP4018_COMPATIBLE(of_compatible, cfg) { \
@@ -125,8 +142,7 @@ MODULE_DEVICE_TABLE(of, mcp4018_of_match);
125 142
126#endif 143#endif
127 144
128static int mcp4018_probe(struct i2c_client *client, 145static int mcp4018_probe(struct i2c_client *client)
129 const struct i2c_device_id *id)
130{ 146{
131 struct device *dev = &client->dev; 147 struct device *dev = &client->dev;
132 struct mcp4018_data *data; 148 struct mcp4018_data *data;
@@ -150,7 +166,7 @@ static int mcp4018_probe(struct i2c_client *client,
150 if (match) 166 if (match)
151 data->cfg = of_device_get_match_data(dev); 167 data->cfg = of_device_get_match_data(dev);
152 else 168 else
153 data->cfg = &mcp4018_cfg[id->driver_data]; 169 data->cfg = &mcp4018_cfg[i2c_match_id(mcp4018_id, client)->driver_data];
154 170
155 indio_dev->dev.parent = dev; 171 indio_dev->dev.parent = dev;
156 indio_dev->info = &mcp4018_info; 172 indio_dev->info = &mcp4018_info;
@@ -161,29 +177,12 @@ static int mcp4018_probe(struct i2c_client *client,
161 return devm_iio_device_register(dev, indio_dev); 177 return devm_iio_device_register(dev, indio_dev);
162} 178}
163 179
164static const struct i2c_device_id mcp4018_id[] = {
165 { "mcp4017-502", MCP4018_502 },
166 { "mcp4017-103", MCP4018_103 },
167 { "mcp4017-503", MCP4018_503 },
168 { "mcp4017-104", MCP4018_104 },
169 { "mcp4018-502", MCP4018_502 },
170 { "mcp4018-103", MCP4018_103 },
171 { "mcp4018-503", MCP4018_503 },
172 { "mcp4018-104", MCP4018_104 },
173 { "mcp4019-502", MCP4018_502 },
174 { "mcp4019-103", MCP4018_103 },
175 { "mcp4019-503", MCP4018_503 },
176 { "mcp4019-104", MCP4018_104 },
177 {}
178};
179MODULE_DEVICE_TABLE(i2c, mcp4018_id);
180
181static struct i2c_driver mcp4018_driver = { 180static struct i2c_driver mcp4018_driver = {
182 .driver = { 181 .driver = {
183 .name = "mcp4018", 182 .name = "mcp4018",
184 .of_match_table = of_match_ptr(mcp4018_of_match), 183 .of_match_table = of_match_ptr(mcp4018_of_match),
185 }, 184 },
186 .probe = mcp4018_probe, 185 .probe_new = mcp4018_probe,
187 .id_table = mcp4018_id, 186 .id_table = mcp4018_id,
188}; 187};
189 188