diff options
author | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2020-09-10 18:32:29 +0100 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2020-09-21 18:41:31 +0100 |
commit | a867e8986759bf25251c8cad3798cba0e4c25a6e (patch) | |
tree | 01d90dd36c3f8d017deb36a9d85f5c51976bb129 /drivers/iio/chemical | |
parent | 4d36d4df68d3db9aca1e0785f464b5092f39952b (diff) | |
download | linux-stable-a867e8986759bf25251c8cad3798cba0e4c25a6e.tar.gz linux-stable-a867e8986759bf25251c8cad3798cba0e4c25a6e.tar.bz2 linux-stable-a867e8986759bf25251c8cad3798cba0e4c25a6e.zip |
iio:chemical:atlas-sensor: Drop of_match_ptr and use generic fw accessors
of_match_ptr() prevents use of this driver with ACPI via PRP0001 and is
an example of an anti pattern I'm trying to remove from IIO.
Hence drop from this driver and use generic fw accessors to check
if there is a fw_node and get the id.
It might be neater to use pointers rather than indexes for
the device_data but that is another issue and should be handled
separately.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Link: https://lore.kernel.org/r/20200910173242.621168-26-jic23@kernel.org
Diffstat (limited to 'drivers/iio/chemical')
-rw-r--r-- | drivers/iio/chemical/atlas-sensor.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/iio/chemical/atlas-sensor.c b/drivers/iio/chemical/atlas-sensor.c index 43069636fcd5..cdab9d04dedd 100644 --- a/drivers/iio/chemical/atlas-sensor.c +++ b/drivers/iio/chemical/atlas-sensor.c @@ -15,7 +15,7 @@ #include <linux/irq.h> #include <linux/irq_work.h> #include <linux/i2c.h> -#include <linux/of_device.h> +#include <linux/mod_devicetable.h> #include <linux/regmap.h> #include <linux/iio/iio.h> #include <linux/iio/buffer.h> @@ -620,7 +620,6 @@ static int atlas_probe(struct i2c_client *client, { struct atlas_data *data; struct atlas_device *chip; - const struct of_device_id *of_id; struct iio_trigger *trig; struct iio_dev *indio_dev; int ret; @@ -629,11 +628,10 @@ static int atlas_probe(struct i2c_client *client, if (!indio_dev) return -ENOMEM; - of_id = of_match_device(atlas_dt_ids, &client->dev); - if (!of_id) + if (!dev_fwnode(&client->dev)) chip = &atlas_devices[id->driver_data]; else - chip = &atlas_devices[(unsigned long)of_id->data]; + chip = &atlas_devices[(unsigned long)device_get_match_data(&client->dev)]; indio_dev->info = &atlas_info; indio_dev->name = ATLAS_DRV_NAME; @@ -775,7 +773,7 @@ static const struct dev_pm_ops atlas_pm_ops = { static struct i2c_driver atlas_driver = { .driver = { .name = ATLAS_DRV_NAME, - .of_match_table = of_match_ptr(atlas_dt_ids), + .of_match_table = atlas_dt_ids, .pm = &atlas_pm_ops, }, .probe = atlas_probe, |