pinctrl: msm: Switch to use device_property_count_uXX()
Subsystems (5)
PATCH 1/2 pinctrl: msm: Switch to use device_property_count_uXX()
Use use device_property_count_uXX() directly, that makes code neater.
--- drivers/pinctrl/qcom/pinctrl-msm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/pinctrl/qcom/pinctrl-msm.c +2 -3
@@ -617,8 +617,7 @@ static int msm_gpio_init_valid_mask(struct gpio_chip *chip) }/* The number of GPIOs in the ACPI tables */ - len = ret =device_property_read_u16_array (pctrl->dev,"gpios" ,NULL , -0 ); + len = ret =device_property_count_u16 (pctrl->dev,"gpios" );if (ret <0 )return 0 ;
@@ -996,7 +995,7 @@ static bool msm_gpio_needs_valid_mask(struct msm_pinctrl *pctrl)if (pctrl->soc->reserved_gpios)return true; -return device_property_read_u16_array (pctrl->dev,"gpios" ,NULL ,0 ) >0 ; +return device_property_count_u16 (pctrl->dev,"gpios" ) >0 ; }static int msm_gpio_init (struct msm_pinctrl *pctrl)
Signature · 1 line
2.20.1
PATCH 2/2 pinctrl: qdf2xxx: Switch to use device_property_count_uXX()
Use use device_property_count_uXX() directly, that makes code neater.
--- drivers/pinctrl/qcom/pinctrl-qdf2xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/qcom/pinctrl-qdf2xxx.c +1 -1
@@ -52,7 +52,7 @@ static int qdf2xxx_pinctrl_probe(struct platform_device *pdev) }/* The number of GPIOs in the approved list */ - ret =device_property_read_u8_array (&pdev->dev,"gpios" ,NULL ,0 ); + ret =device_property_count_u8 (&pdev->dev,"gpios" );if (ret <0 ) {dev_err (&pdev->dev,"missing 'gpios' property\n" );return ret;
Signature · 1 line
2.20.1
Re: [PATCH v1 2/2] pinctrl: qdf2xxx: Switch to use device_property_count_uXX()
Quoted 3 lines · Andy Shevchenko
Use use
device_property_count_uXX()directly, that makes code neater.Signed-off-by Andy Shevchenko <[email protected]>
Patch applied. (Same comment.)
Yours,
Linus Walleij
Re: [PATCH v1 2/2] pinctrl: qdf2xxx: Switch to use device_property_count_uXX()
Quoted 8 lines · Linus Walleij
Quoted 3 lines · Andy Shevchenko
Use use
device_property_count_uXX()directly, that makes code neater.Signed-off-by Andy Shevchenko <[email protected]>Patch applied. (Same comment.)
Thanks, same comment.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
Use use
device_property_count_uXX()directly, that makes code neater.Signed-off-by Andy Shevchenko <[email protected]>
(...)
drivers/pinctrl/qcom/pinctrl-msm.c static int msm_gpio_init_valid_mask(struct gpio_chip *chip) · line 620
Quoted 4 lines
/* The number of GPIOs in the ACPI tables */drivers/pinctrl/qcom/pinctrl-msm.c +1
-2- len = ret =device_property_read_u16_array (pctrl->dev,"gpios" ,NULL , -0 ); + len = ret =device_property_count_u16 (pctrl->dev,"gpios" );
Patch applied (makes the kernel a better place) but:
Can't we just use: gpiod_count(pctrl->dev, NULL); ?
It's more to the point when counting gpios I think.
However this driver is not includeing <linux/gpio/consumer.h> and is this "gpios" property really a consumer property? I think so but...
Yours,
Linus Walleij
Quoted 5 lines · Linus Walleij
Quoted 2 lines · Andy Shevchenko
Use use
device_property_count_uXX()directly, that makes code neater.
Quoted 8 lines
Quoted 1 line
Signed-off-by Andy Shevchenko <[email protected]>(...)
drivers/pinctrl/qcom/pinctrl-msm.c static int msm_gpio_init_valid_mask(struct gpio_chip *chip) · line 620
Quoted 4 lines
/* The number of GPIOs in the ACPI tables */drivers/pinctrl/qcom/pinctrl-msm.c +1
-2- len = ret =device_property_read_u16_array (pctrl->dev,"gpios" ,NULL , -0 ); + len = ret =device_property_count_u16 (pctrl->dev,"gpios" );Patch applied (makes the kernel a better place) but:
Thanks!
Quoted 1 line
Can't we just use:
gpiod_count(pctrl->dev, NULL); ?
Perhaps. I have no hardware to test and the question probably better to be addressed to author(s) of the driver.
My scope is to convert to new extension to device property API, so, anyone who will look for examples will not use the old approach.
Quoted 5 lines
It's more to the point when counting gpios I think.
However this driver is not includeing <
linux/gpio/consumer.h> and is this "gpios" property really a consumer property? I think so but...
Sounds like this is an old driver and many questions to it applies.
Signature · 2 lines
With Best Regards, Andy Shevchenko