diff mbox series

[v1,1/1] power: supply: core: Use device_property_string_array_count()

Message ID 20220202182325.54680-1-andriy.shevchenko@linux.intel.com
State Accepted
Commit 1c97db1747b756611f0d26ea7fb2ed2d93f90fcc
Headers show
Series [v1,1/1] power: supply: core: Use device_property_string_array_count() | expand

Commit Message

Andy Shevchenko Feb. 2, 2022, 6:23 p.m. UTC
Use device_property_string_array_count() to get number of strings
in a string array property.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/power/supply/power_supply_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Sebastian Reichel Feb. 11, 2022, 6:55 p.m. UTC | #1
Hi,

On Wed, Feb 02, 2022 at 08:23:25PM +0200, Andy Shevchenko wrote:
> Use device_property_string_array_count() to get number of strings
> in a string array property.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/power_supply_core.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
> index df4471e50d33..fb638774577e 100644
> --- a/drivers/power/supply/power_supply_core.c
> +++ b/drivers/power/supply/power_supply_core.c
> @@ -283,8 +283,7 @@ static int power_supply_check_supplies(struct power_supply *psy)
>  	if (!psy->dev.parent)
>  		return 0;
>  
> -	nval = device_property_read_string_array(psy->dev.parent,
> -						 "supplied-from", NULL, 0);
> +	nval = device_property_string_array_count(psy->dev.parent, "supplied-from");
>  	if (nval <= 0)
>  		return 0;
>  
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index df4471e50d33..fb638774577e 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -283,8 +283,7 @@  static int power_supply_check_supplies(struct power_supply *psy)
 	if (!psy->dev.parent)
 		return 0;
 
-	nval = device_property_read_string_array(psy->dev.parent,
-						 "supplied-from", NULL, 0);
+	nval = device_property_string_array_count(psy->dev.parent, "supplied-from");
 	if (nval <= 0)
 		return 0;