.. | .. |
---|
16 | 16 | #include <linux/i2c.h> |
---|
17 | 17 | #include <linux/iio/iio.h> |
---|
18 | 18 | #include <linux/module.h> |
---|
19 | | -#include <linux/of.h> |
---|
20 | | -#include <linux/of_device.h> |
---|
| 19 | +#include <linux/mod_devicetable.h> |
---|
| 20 | +#include <linux/property.h> |
---|
21 | 21 | |
---|
22 | 22 | #define MCP4018_WIPER_MAX 127 |
---|
23 | 23 | |
---|
.. | .. |
---|
116 | 116 | }; |
---|
117 | 117 | MODULE_DEVICE_TABLE(i2c, mcp4018_id); |
---|
118 | 118 | |
---|
119 | | -#ifdef CONFIG_OF |
---|
120 | | - |
---|
121 | 119 | #define MCP4018_COMPATIBLE(of_compatible, cfg) { \ |
---|
122 | 120 | .compatible = of_compatible, \ |
---|
123 | 121 | .data = &mcp4018_cfg[cfg], \ |
---|
.. | .. |
---|
140 | 138 | }; |
---|
141 | 139 | MODULE_DEVICE_TABLE(of, mcp4018_of_match); |
---|
142 | 140 | |
---|
143 | | -#endif |
---|
144 | | - |
---|
145 | 141 | static int mcp4018_probe(struct i2c_client *client) |
---|
146 | 142 | { |
---|
147 | 143 | struct device *dev = &client->dev; |
---|
148 | 144 | struct mcp4018_data *data; |
---|
149 | 145 | struct iio_dev *indio_dev; |
---|
150 | | - const struct of_device_id *match; |
---|
151 | 146 | |
---|
152 | 147 | if (!i2c_check_functionality(client->adapter, |
---|
153 | 148 | I2C_FUNC_SMBUS_BYTE)) { |
---|
.. | .. |
---|
162 | 157 | i2c_set_clientdata(client, indio_dev); |
---|
163 | 158 | data->client = client; |
---|
164 | 159 | |
---|
165 | | - match = of_match_device(of_match_ptr(mcp4018_of_match), dev); |
---|
166 | | - if (match) |
---|
167 | | - data->cfg = of_device_get_match_data(dev); |
---|
168 | | - else |
---|
| 160 | + data->cfg = device_get_match_data(dev); |
---|
| 161 | + if (!data->cfg) |
---|
169 | 162 | data->cfg = &mcp4018_cfg[i2c_match_id(mcp4018_id, client)->driver_data]; |
---|
170 | 163 | |
---|
171 | | - indio_dev->dev.parent = dev; |
---|
172 | 164 | indio_dev->info = &mcp4018_info; |
---|
173 | 165 | indio_dev->channels = &mcp4018_channel; |
---|
174 | 166 | indio_dev->num_channels = 1; |
---|
.. | .. |
---|
180 | 172 | static struct i2c_driver mcp4018_driver = { |
---|
181 | 173 | .driver = { |
---|
182 | 174 | .name = "mcp4018", |
---|
183 | | - .of_match_table = of_match_ptr(mcp4018_of_match), |
---|
| 175 | + .of_match_table = mcp4018_of_match, |
---|
184 | 176 | }, |
---|
185 | 177 | .probe_new = mcp4018_probe, |
---|
186 | 178 | .id_table = mcp4018_id, |
---|
.. | .. |
---|
190 | 182 | |
---|
191 | 183 | MODULE_AUTHOR("Peter Rosin <peda@axentia.se>"); |
---|
192 | 184 | MODULE_DESCRIPTION("MCP4018 digital potentiometer"); |
---|
193 | | -MODULE_LICENSE("GPL"); |
---|
| 185 | +MODULE_LICENSE("GPL v2"); |
---|