OSDN Git Service

iio:light:cm3605: Switch to generic firmware properties.
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 5 Dec 2021 17:01:34 +0000 (17:01 +0000)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 12 Dec 2021 17:12:50 +0000 (17:12 +0000)
This enables use of other firmware types with minimal driver changes.
Part of an ongoing effort to move all IIO drivers over to generic
accessors in order to reduce the chance of of_* versions being
copied into new drivers.  Also updated the headers to reflect this change
including using mod_devicetable.h for struct of_device_id definition
rather than going via of.h

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
drivers/iio/light/cm3605.c

index 3e7fb16..50d34a9 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
 #include <linux/iio/events.h>
@@ -18,7 +19,7 @@
 #include <linux/init.h>
 #include <linux/leds.h>
 #include <linux/platform_device.h>
-#include <linux/of.h>
+#include <linux/property.h>
 #include <linux/regulator/consumer.h>
 #include <linux/gpio/consumer.h>
 #include <linux/interrupt.h>
@@ -156,7 +157,6 @@ static int cm3605_probe(struct platform_device *pdev)
        struct cm3605 *cm3605;
        struct iio_dev *indio_dev;
        struct device *dev = &pdev->dev;
-       struct device_node *np = dev->of_node;
        enum iio_chan_type ch_type;
        u32 rset;
        int irq;
@@ -171,7 +171,7 @@ static int cm3605_probe(struct platform_device *pdev)
        cm3605->dev = dev;
        cm3605->dir = IIO_EV_DIR_FALLING;
 
-       ret = of_property_read_u32(np, "capella,aset-resistance-ohms", &rset);
+       ret = device_property_read_u32(dev, "capella,aset-resistance-ohms", &rset);
        if (ret) {
                dev_info(dev, "no RSET specified, assuming 100K\n");
                rset = 100000;