All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: Use of_property_read_bool() for boolean properties
@ 2023-03-10 14:47 Rob Herring
  2023-03-12 19:55 ` Chris Packham
  2023-03-16 19:20 ` Wolfram Sang
  0 siblings, 2 replies; 3+ messages in thread
From: Rob Herring @ 2023-03-10 14:47 UTC (permalink / raw)
  To: Chris Packham, Wolfram Sang; +Cc: devicetree, linux-i2c, linux-kernel

It is preferred to use typed property access functions (i.e.
of_property_read_<type> functions) rather than low-level
of_get_property/of_find_property functions for reading properties.
Convert reading boolean properties to to of_property_read_bool().

Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/i2c/busses/i2c-mpc.c | 2 +-
 drivers/i2c/busses/i2c-pxa.c | 6 ++----
 drivers/i2c/i2c-core-of.c    | 2 +-
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 81ac92bb4f6f..bec0c5dc20d1 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -842,7 +842,7 @@ static int fsl_i2c_probe(struct platform_device *op)
 		data->setup(op->dev.of_node, i2c, clock);
 	} else {
 		/* Backwards compatibility */
-		if (of_get_property(op->dev.of_node, "dfsrr", NULL))
+		if (of_property_read_bool(op->dev.of_node, "dfsrr"))
 			mpc_i2c_setup_8xxx(op->dev.of_node, i2c, clock);
 	}
 
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index b605b6e43cb9..f9fa5308556b 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1261,10 +1261,8 @@ static int i2c_pxa_probe_dt(struct platform_device *pdev, struct pxa_i2c *i2c,
 	/* For device tree we always use the dynamic or alias-assigned ID */
 	i2c->adap.nr = -1;
 
-	if (of_get_property(np, "mrvl,i2c-polling", NULL))
-		i2c->use_pio = 1;
-	if (of_get_property(np, "mrvl,i2c-fast-mode", NULL))
-		i2c->fast_mode = 1;
+	i2c->use_pio = of_property_read_bool(np, "mrvl,i2c-polling");
+	i2c->fast_mode = of_property_read_bool(np, "mrvl,i2c-fast-mode");
 
 	*i2c_types = (enum pxa_i2c_types)(of_id->data);
 
diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c
index bce6b796e04c..aa93467784c2 100644
--- a/drivers/i2c/i2c-core-of.c
+++ b/drivers/i2c/i2c-core-of.c
@@ -55,7 +55,7 @@ int of_i2c_get_board_info(struct device *dev, struct device_node *node,
 	if (of_property_read_bool(node, "host-notify"))
 		info->flags |= I2C_CLIENT_HOST_NOTIFY;
 
-	if (of_get_property(node, "wakeup-source", NULL))
+	if (of_property_read_bool(node, "wakeup-source"))
 		info->flags |= I2C_CLIENT_WAKE;
 
 	return 0;
-- 
2.39.2


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

* Re: [PATCH] i2c: Use of_property_read_bool() for boolean properties
  2023-03-10 14:47 [PATCH] i2c: Use of_property_read_bool() for boolean properties Rob Herring
@ 2023-03-12 19:55 ` Chris Packham
  2023-03-16 19:20 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Packham @ 2023-03-12 19:55 UTC (permalink / raw)
  To: Rob Herring, Wolfram Sang; +Cc: devicetree, linux-i2c, linux-kernel


On 11/03/23 03:47, Rob Herring wrote:
> It is preferred to use typed property access functions (i.e.
> of_property_read_<type> functions) rather than low-level
> of_get_property/of_find_property functions for reading properties.
> Convert reading boolean properties to to of_property_read_bool().
>
> Signed-off-by: Rob Herring <robh@kernel.org>

For i2c-mpc.c

Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>

> ---
>   drivers/i2c/busses/i2c-mpc.c | 2 +-
>   drivers/i2c/busses/i2c-pxa.c | 6 ++----
>   drivers/i2c/i2c-core-of.c    | 2 +-
>   3 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> index 81ac92bb4f6f..bec0c5dc20d1 100644
> --- a/drivers/i2c/busses/i2c-mpc.c
> +++ b/drivers/i2c/busses/i2c-mpc.c
> @@ -842,7 +842,7 @@ static int fsl_i2c_probe(struct platform_device *op)
>   		data->setup(op->dev.of_node, i2c, clock);
>   	} else {
>   		/* Backwards compatibility */
> -		if (of_get_property(op->dev.of_node, "dfsrr", NULL))
> +		if (of_property_read_bool(op->dev.of_node, "dfsrr"))
>   			mpc_i2c_setup_8xxx(op->dev.of_node, i2c, clock);
>   	}
>   
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index b605b6e43cb9..f9fa5308556b 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -1261,10 +1261,8 @@ static int i2c_pxa_probe_dt(struct platform_device *pdev, struct pxa_i2c *i2c,
>   	/* For device tree we always use the dynamic or alias-assigned ID */
>   	i2c->http://scanmail.trustwave.com/?c=20988&d=-cKL5Dh8QMK0P2KPUMhJxUWIHGxrwEz2ggUtInY_JA&u=http%3a%2f%2fadap%2enr = -1;
>   
> -	if (of_get_property(np, "mrvl,i2c-polling", NULL))
> -		i2c->use_pio = 1;
> -	if (of_get_property(np, "mrvl,i2c-fast-mode", NULL))
> -		i2c->fast_mode = 1;
> +	i2c->use_pio = of_property_read_bool(np, "mrvl,i2c-polling");
> +	i2c->fast_mode = of_property_read_bool(np, "mrvl,i2c-fast-mode");
>   
>   	*i2c_types = (enum pxa_i2c_types)(of_id->data);
>   
> diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c
> index bce6b796e04c..aa93467784c2 100644
> --- a/drivers/i2c/i2c-core-of.c
> +++ b/drivers/i2c/i2c-core-of.c
> @@ -55,7 +55,7 @@ int of_i2c_get_board_info(struct device *dev, struct device_node *node,
>   	if (of_property_read_bool(node, "host-notify"))
>   		info->flags |= I2C_CLIENT_HOST_NOTIFY;
>   
> -	if (of_get_property(node, "wakeup-source", NULL))
> +	if (of_property_read_bool(node, "wakeup-source"))
>   		info->flags |= I2C_CLIENT_WAKE;
>   
>   	return 0;

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

* Re: [PATCH] i2c: Use of_property_read_bool() for boolean properties
  2023-03-10 14:47 [PATCH] i2c: Use of_property_read_bool() for boolean properties Rob Herring
  2023-03-12 19:55 ` Chris Packham
@ 2023-03-16 19:20 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2023-03-16 19:20 UTC (permalink / raw)
  To: Rob Herring; +Cc: Chris Packham, devicetree, linux-i2c, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 411 bytes --]

On Fri, Mar 10, 2023 at 08:47:07AM -0600, Rob Herring wrote:
> It is preferred to use typed property access functions (i.e.
> of_property_read_<type> functions) rather than low-level
> of_get_property/of_find_property functions for reading properties.
> Convert reading boolean properties to to of_property_read_bool().
> 
> Signed-off-by: Rob Herring <robh@kernel.org>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2023-03-16 19:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10 14:47 [PATCH] i2c: Use of_property_read_bool() for boolean properties Rob Herring
2023-03-12 19:55 ` Chris Packham
2023-03-16 19:20 ` Wolfram Sang

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.