All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] iio: health: max30100: use generic property handler
@ 2020-03-15 15:25 Rohit Sarkar
  2020-03-22 17:50 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Rohit Sarkar @ 2020-03-15 15:25 UTC (permalink / raw)
  To: linux-iio
  Cc: linux-kernel, alexandru.Ardelean, dragos.bogdan, Matt Ranostay,
	jic23, rohitsarkar5398

Instead of of_property_read_xxx use device_property_read_xxx as it is
compatible with ACPI too as opposed to only device tree.

Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com>
---
Changelog
v1 -> v2
- remove of_match_ptr to make it possible to use PRP0001 ACPI based
  bindings
 drivers/iio/health/max30100.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/health/max30100.c b/drivers/iio/health/max30100.c
index 84010501762d..546fc37ad75d 100644
--- a/drivers/iio/health/max30100.c
+++ b/drivers/iio/health/max30100.c
@@ -16,7 +16,7 @@
 #include <linux/irq.h>
 #include <linux/i2c.h>
 #include <linux/mutex.h>
-#include <linux/of.h>
+#include <linux/property.h>
 #include <linux/regmap.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/buffer.h>
@@ -267,11 +267,10 @@ static int max30100_get_current_idx(unsigned int val, int *reg)
 static int max30100_led_init(struct max30100_data *data)
 {
 	struct device *dev = &data->client->dev;
-	struct device_node *np = dev->of_node;
 	unsigned int val[2];
 	int reg, ret;
 
-	ret = of_property_read_u32_array(np, "maxim,led-current-microamp",
+	ret = device_property_read_u32_array(dev, "maxim,led-current-microamp",
 					(unsigned int *) &val, 2);
 	if (ret) {
 		/* Default to 24 mA RED LED, 50 mA IR LED */
@@ -502,7 +501,7 @@ MODULE_DEVICE_TABLE(of, max30100_dt_ids);
 static struct i2c_driver max30100_driver = {
 	.driver = {
 		.name	= MAX30100_DRV_NAME,
-		.of_match_table	= of_match_ptr(max30100_dt_ids),
+		.of_match_table	= max30100_dt_ids,
 	},
 	.probe		= max30100_probe,
 	.remove		= max30100_remove,
-- 
2.23.0.385.gbc12974a89


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] iio: health: max30100: use generic property handler
  2020-03-15 15:25 [PATCH v2] iio: health: max30100: use generic property handler Rohit Sarkar
@ 2020-03-22 17:50 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2020-03-22 17:50 UTC (permalink / raw)
  To: Rohit Sarkar
  Cc: linux-iio, linux-kernel, alexandru.Ardelean, dragos.bogdan,
	Matt Ranostay

On Sun, 15 Mar 2020 20:55:12 +0530
Rohit Sarkar <rohitsarkar5398@gmail.com> wrote:

> Instead of of_property_read_xxx use device_property_read_xxx as it is
> compatible with ACPI too as opposed to only device tree.
> 
> Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com>

Looks good to me.

Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with them.

Thanks,

Jonathan

> ---
> Changelog
> v1 -> v2
> - remove of_match_ptr to make it possible to use PRP0001 ACPI based
>   bindings
>  drivers/iio/health/max30100.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/health/max30100.c b/drivers/iio/health/max30100.c
> index 84010501762d..546fc37ad75d 100644
> --- a/drivers/iio/health/max30100.c
> +++ b/drivers/iio/health/max30100.c
> @@ -16,7 +16,7 @@
>  #include <linux/irq.h>
>  #include <linux/i2c.h>
>  #include <linux/mutex.h>
> -#include <linux/of.h>
> +#include <linux/property.h>
>  #include <linux/regmap.h>
>  #include <linux/iio/iio.h>
>  #include <linux/iio/buffer.h>
> @@ -267,11 +267,10 @@ static int max30100_get_current_idx(unsigned int val, int *reg)
>  static int max30100_led_init(struct max30100_data *data)
>  {
>  	struct device *dev = &data->client->dev;
> -	struct device_node *np = dev->of_node;
>  	unsigned int val[2];
>  	int reg, ret;
>  
> -	ret = of_property_read_u32_array(np, "maxim,led-current-microamp",
> +	ret = device_property_read_u32_array(dev, "maxim,led-current-microamp",
>  					(unsigned int *) &val, 2);
>  	if (ret) {
>  		/* Default to 24 mA RED LED, 50 mA IR LED */
> @@ -502,7 +501,7 @@ MODULE_DEVICE_TABLE(of, max30100_dt_ids);
>  static struct i2c_driver max30100_driver = {
>  	.driver = {
>  		.name	= MAX30100_DRV_NAME,
> -		.of_match_table	= of_match_ptr(max30100_dt_ids),
> +		.of_match_table	= max30100_dt_ids,
>  	},
>  	.probe		= max30100_probe,
>  	.remove		= max30100_remove,


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-22 17:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-15 15:25 [PATCH v2] iio: health: max30100: use generic property handler Rohit Sarkar
2020-03-22 17:50 ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.