hwmon: ltc4245: Use of_property_read_bool() for boolean properties

Message ID 20230310144707.1542525-1-robh@kernel.org
State New
Headers
Series hwmon: ltc4245: Use of_property_read_bool() for boolean properties |

Commit Message

Rob Herring March 10, 2023, 2:47 p.m. UTC
  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/hwmon/ltc4245.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Guenter Roeck March 10, 2023, 4:30 p.m. UTC | #1
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 after s/to to/to/

Thanks,
Guenter

> ---
>  drivers/hwmon/ltc4245.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/ltc4245.c b/drivers/hwmon/ltc4245.c
> index 5088d28b3a7c..57cbaf3b39fa 100644
> --- a/drivers/hwmon/ltc4245.c
> +++ b/drivers/hwmon/ltc4245.c
> @@ -434,7 +434,7 @@ static bool ltc4245_use_extra_gpios(struct i2c_client *client)
>  		return pdata->use_extra_gpios;
>  
>  	/* fallback on OF */
> -	if (of_find_property(np, "ltc4245,use-extra-gpios", NULL))
> +	if (of_property_read_bool(np, "ltc4245,use-extra-gpios"))
>  		return true;
>  
>  	return false;
  

Patch

diff --git a/drivers/hwmon/ltc4245.c b/drivers/hwmon/ltc4245.c
index 5088d28b3a7c..57cbaf3b39fa 100644
--- a/drivers/hwmon/ltc4245.c
+++ b/drivers/hwmon/ltc4245.c
@@ -434,7 +434,7 @@  static bool ltc4245_use_extra_gpios(struct i2c_client *client)
 		return pdata->use_extra_gpios;
 
 	/* fallback on OF */
-	if (of_find_property(np, "ltc4245,use-extra-gpios", NULL))
+	if (of_property_read_bool(np, "ltc4245,use-extra-gpios"))
 		return true;
 
 	return false;