diff mbox series

[38/38] iio:health:max30102: Drop of_match_ptr and use generic fw accessors

Message ID 20200910173242.621168-39-jic23@kernel.org (mailing list archive)
State New, archived
Headers show
Series iio: remaining easy of_match_ptr removal and related. | expand

Commit Message

Jonathan Cameron Sept. 10, 2020, 5:32 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

This enables use of the driver with ACPI PRP0001 and also removes
an antipattern that I am trying to clear out of IIO to avoid
it being coppied into new drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Matt Ranostay <matt.ranostay@konsulko.com>
---
 drivers/iio/health/max30102.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Matt Ranostay Sept. 15, 2020, 6:54 p.m. UTC | #1
On Thu, Sep 10, 2020 at 10:36 AM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> This enables use of the driver with ACPI PRP0001 and also removes
> an antipattern that I am trying to clear out of IIO to avoid
> it being coppied into new drivers.

Typo, should be copied.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Matt Ranostay <matt.ranostay@konsulko.com>

Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>

> ---
>  drivers/iio/health/max30102.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iio/health/max30102.c b/drivers/iio/health/max30102.c
> index bb504e993f19..543021d8df34 100644
> --- a/drivers/iio/health/max30102.c
> +++ b/drivers/iio/health/max30102.c
> @@ -19,7 +19,7 @@
>  #include <linux/irq.h>
>  #include <linux/i2c.h>
>  #include <linux/mutex.h>
> -#include <linux/of.h>
> +#include <linux/mod_devicetable.h>
>  #include <linux/regmap.h>
>  #include <linux/iio/iio.h>
>  #include <linux/iio/buffer.h>
> @@ -323,11 +323,10 @@ static int max30102_get_current_idx(unsigned int val, int *reg)
>  static int max30102_led_init(struct max30102_data *data)
>  {
>         struct device *dev = &data->client->dev;
> -       struct device_node *np = dev->of_node;
>         unsigned int val;
>         int reg, ret;
>
> -       ret = of_property_read_u32(np, "maxim,red-led-current-microamp", &val);
> +       ret = device_property_read_u32(dev, "maxim,red-led-current-microamp", &val);
>         if (ret) {
>                 dev_info(dev, "no red-led-current-microamp set\n");
>
> @@ -346,7 +345,7 @@ static int max30102_led_init(struct max30102_data *data)
>                 return ret;
>
>         if (data->chip_id == max30105) {
> -               ret = of_property_read_u32(np,
> +               ret = device_property_read_u32(dev,
>                         "maxim,green-led-current-microamp", &val);
>                 if (ret) {
>                         dev_info(dev, "no green-led-current-microamp set\n");
> @@ -368,7 +367,7 @@ static int max30102_led_init(struct max30102_data *data)
>                         return ret;
>         }
>
> -       ret = of_property_read_u32(np, "maxim,ir-led-current-microamp", &val);
> +       ret = device_property_read_u32(dev, "maxim,ir-led-current-microamp", &val);
>         if (ret) {
>                 dev_info(dev, "no ir-led-current-microamp set\n");
>
> @@ -624,7 +623,7 @@ MODULE_DEVICE_TABLE(of, max30102_dt_ids);
>  static struct i2c_driver max30102_driver = {
>         .driver = {
>                 .name   = MAX30102_DRV_NAME,
> -               .of_match_table = of_match_ptr(max30102_dt_ids),
> +               .of_match_table = max30102_dt_ids,
>         },
>         .probe          = max30102_probe,
>         .remove         = max30102_remove,
> --
> 2.28.0
>
diff mbox series

Patch

diff --git a/drivers/iio/health/max30102.c b/drivers/iio/health/max30102.c
index bb504e993f19..543021d8df34 100644
--- a/drivers/iio/health/max30102.c
+++ b/drivers/iio/health/max30102.c
@@ -19,7 +19,7 @@ 
 #include <linux/irq.h>
 #include <linux/i2c.h>
 #include <linux/mutex.h>
-#include <linux/of.h>
+#include <linux/mod_devicetable.h>
 #include <linux/regmap.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/buffer.h>
@@ -323,11 +323,10 @@  static int max30102_get_current_idx(unsigned int val, int *reg)
 static int max30102_led_init(struct max30102_data *data)
 {
 	struct device *dev = &data->client->dev;
-	struct device_node *np = dev->of_node;
 	unsigned int val;
 	int reg, ret;
 
-	ret = of_property_read_u32(np, "maxim,red-led-current-microamp", &val);
+	ret = device_property_read_u32(dev, "maxim,red-led-current-microamp", &val);
 	if (ret) {
 		dev_info(dev, "no red-led-current-microamp set\n");
 
@@ -346,7 +345,7 @@  static int max30102_led_init(struct max30102_data *data)
 		return ret;
 
 	if (data->chip_id == max30105) {
-		ret = of_property_read_u32(np,
+		ret = device_property_read_u32(dev,
 			"maxim,green-led-current-microamp", &val);
 		if (ret) {
 			dev_info(dev, "no green-led-current-microamp set\n");
@@ -368,7 +367,7 @@  static int max30102_led_init(struct max30102_data *data)
 			return ret;
 	}
 
-	ret = of_property_read_u32(np, "maxim,ir-led-current-microamp", &val);
+	ret = device_property_read_u32(dev, "maxim,ir-led-current-microamp", &val);
 	if (ret) {
 		dev_info(dev, "no ir-led-current-microamp set\n");
 
@@ -624,7 +623,7 @@  MODULE_DEVICE_TABLE(of, max30102_dt_ids);
 static struct i2c_driver max30102_driver = {
 	.driver = {
 		.name	= MAX30102_DRV_NAME,
-		.of_match_table	= of_match_ptr(max30102_dt_ids),
+		.of_match_table	= max30102_dt_ids,
 	},
 	.probe		= max30102_probe,
 	.remove		= max30102_remove,