| .. | .. |
|---|
| 10 | 10 | #include <linux/mutex.h> |
|---|
| 11 | 11 | #include <linux/init.h> |
|---|
| 12 | 12 | #include <linux/i2c.h> |
|---|
| 13 | | -#include <linux/of.h> |
|---|
| 14 | | -#include <linux/of_device.h> |
|---|
| 13 | +#include <linux/mod_devicetable.h> |
|---|
| 15 | 14 | |
|---|
| 16 | 15 | #include <linux/iio/iio.h> |
|---|
| 17 | 16 | #include <linux/iio/sysfs.h> |
|---|
| .. | .. |
|---|
| 352 | 351 | static int vz89x_probe(struct i2c_client *client, |
|---|
| 353 | 352 | const struct i2c_device_id *id) |
|---|
| 354 | 353 | { |
|---|
| 354 | + struct device *dev = &client->dev; |
|---|
| 355 | 355 | struct iio_dev *indio_dev; |
|---|
| 356 | 356 | struct vz89x_data *data; |
|---|
| 357 | | - const struct of_device_id *of_id; |
|---|
| 358 | 357 | int chip_id; |
|---|
| 359 | 358 | |
|---|
| 360 | | - indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); |
|---|
| 359 | + indio_dev = devm_iio_device_alloc(dev, sizeof(*data)); |
|---|
| 361 | 360 | if (!indio_dev) |
|---|
| 362 | 361 | return -ENOMEM; |
|---|
| 363 | 362 | data = iio_priv(indio_dev); |
|---|
| .. | .. |
|---|
| 370 | 369 | else |
|---|
| 371 | 370 | return -EOPNOTSUPP; |
|---|
| 372 | 371 | |
|---|
| 373 | | - of_id = of_match_device(vz89x_dt_ids, &client->dev); |
|---|
| 374 | | - if (!of_id) |
|---|
| 372 | + if (!dev_fwnode(dev)) |
|---|
| 375 | 373 | chip_id = id->driver_data; |
|---|
| 376 | 374 | else |
|---|
| 377 | | - chip_id = (unsigned long)of_id->data; |
|---|
| 375 | + chip_id = (unsigned long)device_get_match_data(dev); |
|---|
| 378 | 376 | |
|---|
| 379 | 377 | i2c_set_clientdata(client, indio_dev); |
|---|
| 380 | 378 | data->client = client; |
|---|
| .. | .. |
|---|
| 382 | 380 | data->last_update = jiffies - HZ; |
|---|
| 383 | 381 | mutex_init(&data->lock); |
|---|
| 384 | 382 | |
|---|
| 385 | | - indio_dev->dev.parent = &client->dev; |
|---|
| 386 | 383 | indio_dev->info = &vz89x_info; |
|---|
| 387 | | - indio_dev->name = dev_name(&client->dev); |
|---|
| 384 | + indio_dev->name = dev_name(dev); |
|---|
| 388 | 385 | indio_dev->modes = INDIO_DIRECT_MODE; |
|---|
| 389 | 386 | |
|---|
| 390 | 387 | indio_dev->channels = data->chip->channels; |
|---|
| 391 | 388 | indio_dev->num_channels = data->chip->num_channels; |
|---|
| 392 | 389 | |
|---|
| 393 | | - return devm_iio_device_register(&client->dev, indio_dev); |
|---|
| 390 | + return devm_iio_device_register(dev, indio_dev); |
|---|
| 394 | 391 | } |
|---|
| 395 | 392 | |
|---|
| 396 | 393 | static const struct i2c_device_id vz89x_id[] = { |
|---|
| .. | .. |
|---|
| 403 | 400 | static struct i2c_driver vz89x_driver = { |
|---|
| 404 | 401 | .driver = { |
|---|
| 405 | 402 | .name = "vz89x", |
|---|
| 406 | | - .of_match_table = of_match_ptr(vz89x_dt_ids), |
|---|
| 403 | + .of_match_table = vz89x_dt_ids, |
|---|
| 407 | 404 | }, |
|---|
| 408 | 405 | .probe = vz89x_probe, |
|---|
| 409 | 406 | .id_table = vz89x_id, |
|---|