linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/2] pinctrl: msm: Switch to use device_property_count_uXX()
@ 2019-07-23 19:27 Andy Shevchenko
  2019-07-23 19:27 ` [PATCH v1 2/2] pinctrl: qdf2xxx: " Andy Shevchenko
  2019-08-05 10:01 ` [PATCH v1 1/2] pinctrl: msm: " Linus Walleij
  0 siblings, 2 replies; 6+ messages in thread
From: Andy Shevchenko @ 2019-07-23 19:27 UTC (permalink / raw)
  To: Bjorn Andersson, Andy Gross, linux-arm-msm, Linus Walleij, linux-gpio
  Cc: Andy Shevchenko

Use use device_property_count_uXX() directly, that makes code neater.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/qcom/pinctrl-msm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
index 7f35c196bb3e..90bc667139e0 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -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)
-- 
2.20.1


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

* [PATCH v1 2/2] pinctrl: qdf2xxx: Switch to use device_property_count_uXX()
  2019-07-23 19:27 [PATCH v1 1/2] pinctrl: msm: Switch to use device_property_count_uXX() Andy Shevchenko
@ 2019-07-23 19:27 ` Andy Shevchenko
  2019-08-05 10:02   ` Linus Walleij
  2019-08-05 10:01 ` [PATCH v1 1/2] pinctrl: msm: " Linus Walleij
  1 sibling, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2019-07-23 19:27 UTC (permalink / raw)
  To: Bjorn Andersson, Andy Gross, linux-arm-msm, Linus Walleij, linux-gpio
  Cc: Andy Shevchenko

Use use device_property_count_uXX() directly, that makes code neater.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/qcom/pinctrl-qdf2xxx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c b/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c
index 5da5dd51542c..43bd15f16377 100644
--- a/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c
+++ b/drivers/pinctrl/qcom/pinctrl-qdf2xxx.c
@@ -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;
-- 
2.20.1


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

* Re: [PATCH v1 1/2] pinctrl: msm: Switch to use device_property_count_uXX()
  2019-07-23 19:27 [PATCH v1 1/2] pinctrl: msm: Switch to use device_property_count_uXX() Andy Shevchenko
  2019-07-23 19:27 ` [PATCH v1 2/2] pinctrl: qdf2xxx: " Andy Shevchenko
@ 2019-08-05 10:01 ` Linus Walleij
  2019-08-05 10:24   ` Andy Shevchenko
  1 sibling, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2019-08-05 10:01 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Bjorn Andersson, Andy Gross, MSM, open list:GPIO SUBSYSTEM

On Tue, Jul 23, 2019 at 9:27 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> Use use device_property_count_uXX() directly, that makes code neater.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
(...)
>         /* 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");

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

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

* Re: [PATCH v1 2/2] pinctrl: qdf2xxx: Switch to use device_property_count_uXX()
  2019-07-23 19:27 ` [PATCH v1 2/2] pinctrl: qdf2xxx: " Andy Shevchenko
@ 2019-08-05 10:02   ` Linus Walleij
  2019-08-05 10:24     ` Andy Shevchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2019-08-05 10:02 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Bjorn Andersson, Andy Gross, MSM, open list:GPIO SUBSYSTEM

On Tue, Jul 23, 2019 at 9:27 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> Use use device_property_count_uXX() directly, that makes code neater.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Patch applied. (Same comment.)

Yours,
Linus Walleij

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

* Re: [PATCH v1 1/2] pinctrl: msm: Switch to use device_property_count_uXX()
  2019-08-05 10:01 ` [PATCH v1 1/2] pinctrl: msm: " Linus Walleij
@ 2019-08-05 10:24   ` Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2019-08-05 10:24 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Bjorn Andersson, Andy Gross, MSM, open list:GPIO SUBSYSTEM

On Mon, Aug 05, 2019 at 12:01:11PM +0200, Linus Walleij wrote:
> On Tue, Jul 23, 2019 at 9:27 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> 
> > Use use device_property_count_uXX() directly, that makes code neater.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> (...)
> >         /* 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");
> 
> Patch applied (makes the kernel a better place) but:

Thanks!

> 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.

> 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.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 2/2] pinctrl: qdf2xxx: Switch to use device_property_count_uXX()
  2019-08-05 10:02   ` Linus Walleij
@ 2019-08-05 10:24     ` Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2019-08-05 10:24 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Bjorn Andersson, Andy Gross, MSM, open list:GPIO SUBSYSTEM

On Mon, Aug 05, 2019 at 12:02:10PM +0200, Linus Walleij wrote:
> On Tue, Jul 23, 2019 at 9:27 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> 
> > Use use device_property_count_uXX() directly, that makes code neater.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Patch applied. (Same comment.)

Thanks, same comment.

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2019-08-05 10:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-23 19:27 [PATCH v1 1/2] pinctrl: msm: Switch to use device_property_count_uXX() Andy Shevchenko
2019-07-23 19:27 ` [PATCH v1 2/2] pinctrl: qdf2xxx: " Andy Shevchenko
2019-08-05 10:02   ` Linus Walleij
2019-08-05 10:24     ` Andy Shevchenko
2019-08-05 10:01 ` [PATCH v1 1/2] pinctrl: msm: " Linus Walleij
2019-08-05 10:24   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).