linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property
@ 2025-02-13 19:48 Andy Shevchenko
  2025-02-13 19:48 ` [PATCH v1 1/5] gpiolib: Extract gpiochip_choose_fwnode() for wider use Andy Shevchenko
                   ` (7 more replies)
  0 siblings, 8 replies; 22+ messages in thread
From: Andy Shevchenko @ 2025-02-13 19:48 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski, linux-gpio, linux-kernel
  Cc: Michael Walle, Linus Walleij, Bartosz Golaszewski,
	athieu Dubois-Briand

It appears that regmap GPIO doesn't take into account 'ngpios' property
and requires hard coded values or duplication of the parsing the same
outside of GPIO library. This miniseries addresses that.

For the record, I have checked all bgpio_init() users and haven't seen
the suspicious code that this series might break, e.g., an equivalent of
something like this:

static int foo_probe(struct device *dev)
{
	struct gpio_chip *gc = devm_kzalloc(...);
	struct fwnode_handle *fwnode = ...; // NOT dev_fwnode(dev)!

	...
	gc->parent = dev;
	gc->fwnode = fwnode;

	ret = bgpio_init(gc, dev, ...);
	...
}

Reported-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>

Andy Shevchenko (5):
  gpiolib: Extract gpiochip_choose_fwnode() for wider use
  gpiolib: Use fwnode instead of device in gpiochip_get_ngpios()
  gpio: regmap: Group optional assignments together for better
    understanding
  gpio: regmap: Move optional assignments down in the code
  gpio: regmap: Allow ngpio to be read from the property

 drivers/gpio/gpio-regmap.c  | 41 +++++++++++++++++++++----------------
 drivers/gpio/gpiolib.c      | 27 ++++++++++++++++--------
 include/linux/gpio/regmap.h |  4 ++--
 3 files changed, 43 insertions(+), 29 deletions(-)

-- 
2.45.1.3035.g276e886db78b


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

* [PATCH v1 1/5] gpiolib: Extract gpiochip_choose_fwnode() for wider use
  2025-02-13 19:48 [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property Andy Shevchenko
@ 2025-02-13 19:48 ` Andy Shevchenko
  2025-02-13 19:48 ` [PATCH v1 2/5] gpiolib: Use fwnode instead of device in gpiochip_get_ngpios() Andy Shevchenko
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 22+ messages in thread
From: Andy Shevchenko @ 2025-02-13 19:48 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski, linux-gpio, linux-kernel
  Cc: Michael Walle, Linus Walleij, Bartosz Golaszewski,
	athieu Dubois-Briand

Extract gpiochip_choose_fwnode() for the future use in another function.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpiolib.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index d6ebdb2f2e92..0f93aa7736c6 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -883,6 +883,21 @@ void *gpiochip_get_data(struct gpio_chip *gc)
 }
 EXPORT_SYMBOL_GPL(gpiochip_get_data);
 
+/*
+ * If the calling driver provides the specific firmware node,
+ * use it. Otherwise use the one from the parent device, if any.
+ */
+static struct fwnode_handle *gpiochip_choose_fwnode(struct gpio_chip *gc)
+{
+	if (gc->fwnode)
+		return gc->fwnode;
+
+	if (gc->parent)
+		return dev_fwnode(gc->parent);
+
+	return NULL;
+}
+
 int gpiochip_get_ngpios(struct gpio_chip *gc, struct device *dev)
 {
 	u32 ngpios = gc->ngpio;
@@ -942,14 +957,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
 	gc->gpiodev = gdev;
 	gpiochip_set_data(gc, data);
 
-	/*
-	 * If the calling driver did not initialize firmware node,
-	 * do it here using the parent device, if any.
-	 */
-	if (gc->fwnode)
-		device_set_node(&gdev->dev, gc->fwnode);
-	else if (gc->parent)
-		device_set_node(&gdev->dev, dev_fwnode(gc->parent));
+	device_set_node(&gdev->dev, gpiochip_choose_fwnode(gc));
 
 	gdev->id = ida_alloc(&gpio_ida, GFP_KERNEL);
 	if (gdev->id < 0) {
-- 
2.45.1.3035.g276e886db78b


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

* [PATCH v1 2/5] gpiolib: Use fwnode instead of device in gpiochip_get_ngpios()
  2025-02-13 19:48 [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property Andy Shevchenko
  2025-02-13 19:48 ` [PATCH v1 1/5] gpiolib: Extract gpiochip_choose_fwnode() for wider use Andy Shevchenko
@ 2025-02-13 19:48 ` Andy Shevchenko
  2025-02-13 19:48 ` [PATCH v1 3/5] gpio: regmap: Group optional assignments together for better understanding Andy Shevchenko
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 22+ messages in thread
From: Andy Shevchenko @ 2025-02-13 19:48 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski, linux-gpio, linux-kernel
  Cc: Michael Walle, Linus Walleij, Bartosz Golaszewski,
	athieu Dubois-Briand

The gpiochip_get_ngpios() can be used in the cases where passed device
is not a provider of the certain property. Use fwnode instead.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpiolib.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 0f93aa7736c6..0ede5e3eecfd 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -900,11 +900,12 @@ static struct fwnode_handle *gpiochip_choose_fwnode(struct gpio_chip *gc)
 
 int gpiochip_get_ngpios(struct gpio_chip *gc, struct device *dev)
 {
+	struct fwnode_handle *fwnode = gpiochip_choose_fwnode(gc);
 	u32 ngpios = gc->ngpio;
 	int ret;
 
 	if (ngpios == 0) {
-		ret = device_property_read_u32(dev, "ngpios", &ngpios);
+		ret = fwnode_property_read_u32(fwnode, "ngpios", &ngpios);
 		if (ret == -ENODATA)
 			/*
 			 * -ENODATA means that there is no property found and
-- 
2.45.1.3035.g276e886db78b


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

* [PATCH v1 3/5] gpio: regmap: Group optional assignments together for better understanding
  2025-02-13 19:48 [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property Andy Shevchenko
  2025-02-13 19:48 ` [PATCH v1 1/5] gpiolib: Extract gpiochip_choose_fwnode() for wider use Andy Shevchenko
  2025-02-13 19:48 ` [PATCH v1 2/5] gpiolib: Use fwnode instead of device in gpiochip_get_ngpios() Andy Shevchenko
@ 2025-02-13 19:48 ` Andy Shevchenko
  2025-02-17  7:40   ` Michael Walle
  2025-02-13 19:48 ` [PATCH v1 4/5] gpio: regmap: Move optional assignments down in the code Andy Shevchenko
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 22+ messages in thread
From: Andy Shevchenko @ 2025-02-13 19:48 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski, linux-gpio, linux-kernel
  Cc: Michael Walle, Linus Walleij, Bartosz Golaszewski,
	athieu Dubois-Briand

Group ngpio_per_reg, reg_stride, and reg_mask_xlate assignments together
with the respective conditional for better understanding what's going on
in the code.

While at it, mark ngpio_per_reg as (Optional) in the kernel-doc
in accordance with what code actually does.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-regmap.c  | 6 +++---
 include/linux/gpio/regmap.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
index 05f8781b5204..7775b0c56602 100644
--- a/drivers/gpio/gpio-regmap.c
+++ b/drivers/gpio/gpio-regmap.c
@@ -233,9 +233,6 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
 	gpio->parent = config->parent;
 	gpio->driver_data = config->drvdata;
 	gpio->regmap = config->regmap;
-	gpio->ngpio_per_reg = config->ngpio_per_reg;
-	gpio->reg_stride = config->reg_stride;
-	gpio->reg_mask_xlate = config->reg_mask_xlate;
 	gpio->reg_dat_base = config->reg_dat_base;
 	gpio->reg_set_base = config->reg_set_base;
 	gpio->reg_clr_base = config->reg_clr_base;
@@ -243,13 +240,16 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
 	gpio->reg_dir_out_base = config->reg_dir_out_base;
 
 	/* if not set, assume there is only one register */
+	gpio->ngpio_per_reg = config->ngpio_per_reg;
 	if (!gpio->ngpio_per_reg)
 		gpio->ngpio_per_reg = config->ngpio;
 
 	/* if not set, assume they are consecutive */
+	gpio->reg_stride = config->reg_stride;
 	if (!gpio->reg_stride)
 		gpio->reg_stride = 1;
 
+	gpio->reg_mask_xlate = config->reg_mask_xlate;
 	if (!gpio->reg_mask_xlate)
 		gpio->reg_mask_xlate = gpio_regmap_simple_xlate;
 
diff --git a/include/linux/gpio/regmap.h b/include/linux/gpio/regmap.h
index a9f7b7faf57b..b9240e4156cc 100644
--- a/include/linux/gpio/regmap.h
+++ b/include/linux/gpio/regmap.h
@@ -30,7 +30,7 @@ struct regmap;
  * @reg_dir_out_base:	(Optional) out setting register base address
  * @reg_stride:		(Optional) May be set if the registers (of the
  *			same type, dat, set, etc) are not consecutive.
- * @ngpio_per_reg:	Number of GPIOs per register
+ * @ngpio_per_reg:	(Optional) Number of GPIOs per register
  * @irq_domain:		(Optional) IRQ domain if the controller is
  *			interrupt-capable
  * @reg_mask_xlate:     (Optional) Translates base address and GPIO
-- 
2.45.1.3035.g276e886db78b


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

* [PATCH v1 4/5] gpio: regmap: Move optional assignments down in the code
  2025-02-13 19:48 [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property Andy Shevchenko
                   ` (2 preceding siblings ...)
  2025-02-13 19:48 ` [PATCH v1 3/5] gpio: regmap: Group optional assignments together for better understanding Andy Shevchenko
@ 2025-02-13 19:48 ` Andy Shevchenko
  2025-02-17  7:43   ` Michael Walle
  2025-02-13 19:48 ` [PATCH v1 5/5] gpio: regmap: Allow ngpio to be read from the property Andy Shevchenko
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 22+ messages in thread
From: Andy Shevchenko @ 2025-02-13 19:48 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski, linux-gpio, linux-kernel
  Cc: Michael Walle, Linus Walleij, Bartosz Golaszewski,
	athieu Dubois-Briand

Move optional assignments down in the code, so they may use some values
from the (updated) struct gpio_chip later on.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-regmap.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
index 7775b0c56602..41ee576e7cd0 100644
--- a/drivers/gpio/gpio-regmap.c
+++ b/drivers/gpio/gpio-regmap.c
@@ -239,20 +239,6 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
 	gpio->reg_dir_in_base = config->reg_dir_in_base;
 	gpio->reg_dir_out_base = config->reg_dir_out_base;
 
-	/* if not set, assume there is only one register */
-	gpio->ngpio_per_reg = config->ngpio_per_reg;
-	if (!gpio->ngpio_per_reg)
-		gpio->ngpio_per_reg = config->ngpio;
-
-	/* if not set, assume they are consecutive */
-	gpio->reg_stride = config->reg_stride;
-	if (!gpio->reg_stride)
-		gpio->reg_stride = 1;
-
-	gpio->reg_mask_xlate = config->reg_mask_xlate;
-	if (!gpio->reg_mask_xlate)
-		gpio->reg_mask_xlate = gpio_regmap_simple_xlate;
-
 	chip = &gpio->gpio_chip;
 	chip->parent = config->parent;
 	chip->fwnode = config->fwnode;
@@ -276,6 +262,20 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
 		chip->direction_output = gpio_regmap_direction_output;
 	}
 
+	/* if not set, assume there is only one register */
+	gpio->ngpio_per_reg = config->ngpio_per_reg;
+	if (!gpio->ngpio_per_reg)
+		gpio->ngpio_per_reg = config->ngpio;
+
+	/* if not set, assume they are consecutive */
+	gpio->reg_stride = config->reg_stride;
+	if (!gpio->reg_stride)
+		gpio->reg_stride = 1;
+
+	gpio->reg_mask_xlate = config->reg_mask_xlate;
+	if (!gpio->reg_mask_xlate)
+		gpio->reg_mask_xlate = gpio_regmap_simple_xlate;
+
 	ret = gpiochip_add_data(chip, gpio);
 	if (ret < 0)
 		goto err_free_gpio;
-- 
2.45.1.3035.g276e886db78b


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

* [PATCH v1 5/5] gpio: regmap: Allow ngpio to be read from the property
  2025-02-13 19:48 [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property Andy Shevchenko
                   ` (3 preceding siblings ...)
  2025-02-13 19:48 ` [PATCH v1 4/5] gpio: regmap: Move optional assignments down in the code Andy Shevchenko
@ 2025-02-13 19:48 ` Andy Shevchenko
  2025-02-17  7:44   ` Michael Walle
  2025-02-14  9:18 ` [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property Mathieu Dubois-Briand
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 22+ messages in thread
From: Andy Shevchenko @ 2025-02-13 19:48 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski, linux-gpio, linux-kernel
  Cc: Michael Walle, Linus Walleij, Bartosz Golaszewski,
	athieu Dubois-Briand

GPIOLIB supports the case when number of supported GPIOs can be read
from the device property. Enable this for drivers that are using
GPIO regmap layer.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-regmap.c  | 13 +++++++++----
 include/linux/gpio/regmap.h |  2 +-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
index 41ee576e7cd0..856f8569566e 100644
--- a/drivers/gpio/gpio-regmap.c
+++ b/drivers/gpio/gpio-regmap.c
@@ -17,6 +17,8 @@
 #include <linux/gpio/driver.h>
 #include <linux/gpio/regmap.h>
 
+#include "gpiolib.h"
+
 struct gpio_regmap {
 	struct device *parent;
 	struct regmap *regmap;
@@ -210,9 +212,6 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
 	if (!config->parent)
 		return ERR_PTR(-EINVAL);
 
-	if (!config->ngpio)
-		return ERR_PTR(-EINVAL);
-
 	/* we need at least one */
 	if (!config->reg_dat_base && !config->reg_set_base)
 		return ERR_PTR(-EINVAL);
@@ -243,7 +242,6 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
 	chip->parent = config->parent;
 	chip->fwnode = config->fwnode;
 	chip->base = -1;
-	chip->ngpio = config->ngpio;
 	chip->names = config->names;
 	chip->label = config->label ?: dev_name(config->parent);
 	chip->can_sleep = regmap_might_sleep(config->regmap);
@@ -262,6 +260,13 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
 		chip->direction_output = gpio_regmap_direction_output;
 	}
 
+	chip->ngpio = config->ngpio;
+	if (!chip->ngpio) {
+		ret = gpiochip_get_ngpios(chip, chip->parent);
+		if (ret)
+			return ERR_PTR(ret);
+	}
+
 	/* if not set, assume there is only one register */
 	gpio->ngpio_per_reg = config->ngpio_per_reg;
 	if (!gpio->ngpio_per_reg)
diff --git a/include/linux/gpio/regmap.h b/include/linux/gpio/regmap.h
index b9240e4156cc..c722c67668c6 100644
--- a/include/linux/gpio/regmap.h
+++ b/include/linux/gpio/regmap.h
@@ -21,7 +21,7 @@ struct regmap;
  *			If not given, the fwnode of the parent is used.
  * @label:		(Optional) Descriptive name for GPIO controller.
  *			If not given, the name of the device is used.
- * @ngpio:		Number of GPIOs
+ * @ngpio:		(Optional) Number of GPIOs
  * @names:		(Optional) Array of names for gpios
  * @reg_dat_base:	(Optional) (in) register base address
  * @reg_set_base:	(Optional) set register base address
-- 
2.45.1.3035.g276e886db78b


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

* Re: [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property
  2025-02-13 19:48 [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property Andy Shevchenko
                   ` (4 preceding siblings ...)
  2025-02-13 19:48 ` [PATCH v1 5/5] gpio: regmap: Allow ngpio to be read from the property Andy Shevchenko
@ 2025-02-14  9:18 ` Mathieu Dubois-Briand
  2025-02-14 13:49   ` Andy Shevchenko
  2025-02-14 10:50 ` Linus Walleij
  2025-02-21  8:45 ` Bartosz Golaszewski
  7 siblings, 1 reply; 22+ messages in thread
From: Mathieu Dubois-Briand @ 2025-02-14  9:18 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski, linux-gpio, linux-kernel
  Cc: Michael Walle, Linus Walleij, Bartosz Golaszewski

On Thu Feb 13, 2025 at 8:48 PM CET, Andy Shevchenko wrote:
> It appears that regmap GPIO doesn't take into account 'ngpios' property
> and requires hard coded values or duplication of the parsing the same
> outside of GPIO library. This miniseries addresses that.
>
> For the record, I have checked all bgpio_init() users and haven't seen
> the suspicious code that this series might break, e.g., an equivalent of
> something like this:
>
> static int foo_probe(struct device *dev)
> {
> 	struct gpio_chip *gc = devm_kzalloc(...);
> 	struct fwnode_handle *fwnode = ...; // NOT dev_fwnode(dev)!
>
> 	...
> 	gc->parent = dev;
> 	gc->fwnode = fwnode;
>
> 	ret = bgpio_init(gc, dev, ...);
> 	...
> }
>
> Reported-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
>
> Andy Shevchenko (5):
>   gpiolib: Extract gpiochip_choose_fwnode() for wider use
>   gpiolib: Use fwnode instead of device in gpiochip_get_ngpios()
>   gpio: regmap: Group optional assignments together for better
>     understanding
>   gpio: regmap: Move optional assignments down in the code
>   gpio: regmap: Allow ngpio to be read from the property
>
>  drivers/gpio/gpio-regmap.c  | 41 +++++++++++++++++++++----------------
>  drivers/gpio/gpiolib.c      | 27 ++++++++++++++++--------
>  include/linux/gpio/regmap.h |  4 ++--
>  3 files changed, 43 insertions(+), 29 deletions(-)

Hi Andy,

Thanks, I confirm I tested this series and it does fix my case: I can
leave the ngpio field uninitialized and its value will be correctly
retrieved from the "ngpios" property.

Also the whole series looks good to me.

-- 
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


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

* Re: [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property
  2025-02-13 19:48 [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property Andy Shevchenko
                   ` (5 preceding siblings ...)
  2025-02-14  9:18 ` [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property Mathieu Dubois-Briand
@ 2025-02-14 10:50 ` Linus Walleij
  2025-02-20 13:18   ` Andy Shevchenko
  2025-02-21  8:45 ` Bartosz Golaszewski
  7 siblings, 1 reply; 22+ messages in thread
From: Linus Walleij @ 2025-02-14 10:50 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Michael Walle,
	Bartosz Golaszewski, athieu Dubois-Briand

On Thu, Feb 13, 2025 at 8:56 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> It appears that regmap GPIO doesn't take into account 'ngpios' property
> and requires hard coded values or duplication of the parsing the same
> outside of GPIO library. This miniseries addresses that.
>
> For the record, I have checked all bgpio_init() users and haven't seen
> the suspicious code that this series might break, e.g., an equivalent of
> something like this:
>
> static int foo_probe(struct device *dev)
> {
>         struct gpio_chip *gc = devm_kzalloc(...);
>         struct fwnode_handle *fwnode = ...; // NOT dev_fwnode(dev)!
>
>         ...
>         gc->parent = dev;
>         gc->fwnode = fwnode;
>
>         ret = bgpio_init(gc, dev, ...);
>         ...
> }
>
> Reported-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>

Thanks for fixing this Andy!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property
  2025-02-14  9:18 ` [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property Mathieu Dubois-Briand
@ 2025-02-14 13:49   ` Andy Shevchenko
  2025-02-14 14:07     ` Mathieu Dubois-Briand
  0 siblings, 1 reply; 22+ messages in thread
From: Andy Shevchenko @ 2025-02-14 13:49 UTC (permalink / raw)
  To: Mathieu Dubois-Briand
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Michael Walle,
	Linus Walleij, Bartosz Golaszewski

On Fri, Feb 14, 2025 at 10:18:29AM +0100, Mathieu Dubois-Briand wrote:
> On Thu Feb 13, 2025 at 8:48 PM CET, Andy Shevchenko wrote:
> > It appears that regmap GPIO doesn't take into account 'ngpios' property
> > and requires hard coded values or duplication of the parsing the same
> > outside of GPIO library. This miniseries addresses that.
> >
> > For the record, I have checked all bgpio_init() users and haven't seen
> > the suspicious code that this series might break, e.g., an equivalent of
> > something like this:
> >
> > static int foo_probe(struct device *dev)
> > {
> > 	struct gpio_chip *gc = devm_kzalloc(...);
> > 	struct fwnode_handle *fwnode = ...; // NOT dev_fwnode(dev)!
> >
> > 	...
> > 	gc->parent = dev;
> > 	gc->fwnode = fwnode;
> >
> > 	ret = bgpio_init(gc, dev, ...);
> > 	...
> > }
> >
> > Reported-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>

...

> Thanks, I confirm I tested this series and it does fix my case: I can
> leave the ngpio field uninitialized and its value will be correctly
> retrieved from the "ngpios" property.
> 
> Also the whole series looks good to me.

Thank you! Can you give a formal tag(s)?

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property
  2025-02-14 13:49   ` Andy Shevchenko
@ 2025-02-14 14:07     ` Mathieu Dubois-Briand
  0 siblings, 0 replies; 22+ messages in thread
From: Mathieu Dubois-Briand @ 2025-02-14 14:07 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Michael Walle,
	Linus Walleij, Bartosz Golaszewski

On Fri Feb 14, 2025 at 2:49 PM CET, Andy Shevchenko wrote:
> On Fri, Feb 14, 2025 at 10:18:29AM +0100, Mathieu Dubois-Briand wrote:
> > On Thu Feb 13, 2025 at 8:48 PM CET, Andy Shevchenko wrote:
> > > It appears that regmap GPIO doesn't take into account 'ngpios' property
> > > and requires hard coded values or duplication of the parsing the same
> > > outside of GPIO library. This miniseries addresses that.
> > >
> > > For the record, I have checked all bgpio_init() users and haven't seen
> > > the suspicious code that this series might break, e.g., an equivalent of
> > > something like this:
> > >
> > > static int foo_probe(struct device *dev)
> > > {
> > > 	struct gpio_chip *gc = devm_kzalloc(...);
> > > 	struct fwnode_handle *fwnode = ...; // NOT dev_fwnode(dev)!
> > >
> > > 	...
> > > 	gc->parent = dev;
> > > 	gc->fwnode = fwnode;
> > >
> > > 	ret = bgpio_init(gc, dev, ...);
> > > 	...
> > > }
> > >
> > > Reported-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
>
> ...
>
> > Thanks, I confirm I tested this series and it does fix my case: I can
> > leave the ngpio field uninitialized and its value will be correctly
> > retrieved from the "ngpios" property.
> > 
> > Also the whole series looks good to me.
>
> Thank you! Can you give a formal tag(s)?

Sure!

Tested-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Reviewed-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>

-- 
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


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

* Re: [PATCH v1 3/5] gpio: regmap: Group optional assignments together for better understanding
  2025-02-13 19:48 ` [PATCH v1 3/5] gpio: regmap: Group optional assignments together for better understanding Andy Shevchenko
@ 2025-02-17  7:40   ` Michael Walle
  0 siblings, 0 replies; 22+ messages in thread
From: Michael Walle @ 2025-02-17  7:40 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski, linux-gpio, linux-kernel
  Cc: Linus Walleij, Bartosz Golaszewski, athieu Dubois-Briand

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

On Thu Feb 13, 2025 at 8:48 PM CET, Andy Shevchenko wrote:
> Group ngpio_per_reg, reg_stride, and reg_mask_xlate assignments together
> with the respective conditional for better understanding what's going on
> in the code.
>
> While at it, mark ngpio_per_reg as (Optional) in the kernel-doc
> in accordance with what code actually does.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Michael Walle <mwalle@kernel.org>

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

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

* Re: [PATCH v1 4/5] gpio: regmap: Move optional assignments down in the code
  2025-02-13 19:48 ` [PATCH v1 4/5] gpio: regmap: Move optional assignments down in the code Andy Shevchenko
@ 2025-02-17  7:43   ` Michael Walle
  0 siblings, 0 replies; 22+ messages in thread
From: Michael Walle @ 2025-02-17  7:43 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski, linux-gpio, linux-kernel
  Cc: Linus Walleij, Bartosz Golaszewski, athieu Dubois-Briand

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

On Thu Feb 13, 2025 at 8:48 PM CET, Andy Shevchenko wrote:
> Move optional assignments down in the code, so they may use some values
> from the (updated) struct gpio_chip later on.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Michael Walle <mwalle@kernel.org>

-michael

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

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

* Re: [PATCH v1 5/5] gpio: regmap: Allow ngpio to be read from the property
  2025-02-13 19:48 ` [PATCH v1 5/5] gpio: regmap: Allow ngpio to be read from the property Andy Shevchenko
@ 2025-02-17  7:44   ` Michael Walle
  0 siblings, 0 replies; 22+ messages in thread
From: Michael Walle @ 2025-02-17  7:44 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski, linux-gpio, linux-kernel
  Cc: Linus Walleij, Bartosz Golaszewski, athieu Dubois-Briand

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

On Thu Feb 13, 2025 at 8:48 PM CET, Andy Shevchenko wrote:
> GPIOLIB supports the case when number of supported GPIOs can be read
> from the device property. Enable this for drivers that are using
> GPIO regmap layer.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Michael Walle <mwalle@kernel.org>

-michael

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

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

* Re: [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property
  2025-02-14 10:50 ` Linus Walleij
@ 2025-02-20 13:18   ` Andy Shevchenko
  2025-02-20 13:22     ` Bartosz Golaszewski
  0 siblings, 1 reply; 22+ messages in thread
From: Andy Shevchenko @ 2025-02-20 13:18 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Michael Walle,
	Bartosz Golaszewski, athieu Dubois-Briand

On Fri, Feb 14, 2025 at 11:50:53AM +0100, Linus Walleij wrote:
> On Thu, Feb 13, 2025 at 8:56 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> 
> > It appears that regmap GPIO doesn't take into account 'ngpios' property
> > and requires hard coded values or duplication of the parsing the same
> > outside of GPIO library. This miniseries addresses that.
> >
> > For the record, I have checked all bgpio_init() users and haven't seen
> > the suspicious code that this series might break, e.g., an equivalent of
> > something like this:
> >
> > static int foo_probe(struct device *dev)
> > {
> >         struct gpio_chip *gc = devm_kzalloc(...);
> >         struct fwnode_handle *fwnode = ...; // NOT dev_fwnode(dev)!
> >
> >         ...
> >         gc->parent = dev;
> >         gc->fwnode = fwnode;
> >
> >         ret = bgpio_init(gc, dev, ...);
> >         ...
> > }
> >
> > Reported-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
> 
> Thanks for fixing this Andy!
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Thank you for the review!

Bart, do you think it can be applied?

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property
  2025-02-20 13:18   ` Andy Shevchenko
@ 2025-02-20 13:22     ` Bartosz Golaszewski
  2025-02-20 13:40       ` Andy Shevchenko
  0 siblings, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2025-02-20 13:22 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel,
	Michael Walle, athieu Dubois-Briand

On Thu, Feb 20, 2025 at 2:18 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Fri, Feb 14, 2025 at 11:50:53AM +0100, Linus Walleij wrote:
> > On Thu, Feb 13, 2025 at 8:56 PM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> >
> > > It appears that regmap GPIO doesn't take into account 'ngpios' property
> > > and requires hard coded values or duplication of the parsing the same
> > > outside of GPIO library. This miniseries addresses that.
> > >
> > > For the record, I have checked all bgpio_init() users and haven't seen
> > > the suspicious code that this series might break, e.g., an equivalent of
> > > something like this:
> > >
> > > static int foo_probe(struct device *dev)
> > > {
> > >         struct gpio_chip *gc = devm_kzalloc(...);
> > >         struct fwnode_handle *fwnode = ...; // NOT dev_fwnode(dev)!
> > >
> > >         ...
> > >         gc->parent = dev;
> > >         gc->fwnode = fwnode;
> > >
> > >         ret = bgpio_init(gc, dev, ...);
> > >         ...
> > > }
> > >
> > > Reported-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
> >
> > Thanks for fixing this Andy!
> > Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>
> Thank you for the review!
>
> Bart, do you think it can be applied?
>

Andy,

I really rarely lose track of patches. It's been just under a week
since this was posted. Please don't ping me to pick things up unless
I'm not reacting for at least two weeks. I typically leave patches on
the list for some time to give bots some time to react.

Bartosz

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

* Re: [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property
  2025-02-20 13:22     ` Bartosz Golaszewski
@ 2025-02-20 13:40       ` Andy Shevchenko
  2025-02-20 13:41         ` Andy Shevchenko
  0 siblings, 1 reply; 22+ messages in thread
From: Andy Shevchenko @ 2025-02-20 13:40 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel,
	Michael Walle, athieu Dubois-Briand

On Thu, Feb 20, 2025 at 02:22:29PM +0100, Bartosz Golaszewski wrote:
> On Thu, Feb 20, 2025 at 2:18 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Fri, Feb 14, 2025 at 11:50:53AM +0100, Linus Walleij wrote:

...

> > Bart, do you think it can be applied?
> 
> Andy,
> 
> I really rarely lose track of patches. It's been just under a week
> since this was posted. Please don't ping me to pick things up unless
> I'm not reacting for at least two weeks. I typically leave patches on
> the list for some time to give bots some time to react.

I see, I thought your cadence is one week, that's why I have pinged you.
Will try to keep this in mind for the future and sorry to interrupt!

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property
  2025-02-20 13:40       ` Andy Shevchenko
@ 2025-02-20 13:41         ` Andy Shevchenko
  2025-02-20 13:42           ` Bartosz Golaszewski
  0 siblings, 1 reply; 22+ messages in thread
From: Andy Shevchenko @ 2025-02-20 13:41 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel,
	Michael Walle, athieu Dubois-Briand

On Thu, Feb 20, 2025 at 03:40:15PM +0200, Andy Shevchenko wrote:
> On Thu, Feb 20, 2025 at 02:22:29PM +0100, Bartosz Golaszewski wrote:
> > On Thu, Feb 20, 2025 at 2:18 PM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > > On Fri, Feb 14, 2025 at 11:50:53AM +0100, Linus Walleij wrote:

...

> > > Bart, do you think it can be applied?
> > 
> > Andy,
> > 
> > I really rarely lose track of patches. It's been just under a week
> > since this was posted. Please don't ping me to pick things up unless
> > I'm not reacting for at least two weeks. I typically leave patches on
> > the list for some time to give bots some time to react.
> 
> I see, I thought your cadence is one week, that's why I have pinged you.
> Will try to keep this in mind for the future and sorry to interrupt!

Btw, if it's easier to you, I can just combine this to my usual PR to you.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property
  2025-02-20 13:41         ` Andy Shevchenko
@ 2025-02-20 13:42           ` Bartosz Golaszewski
  2025-02-20 14:07             ` Andy Shevchenko
  0 siblings, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2025-02-20 13:42 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel,
	Michael Walle, athieu Dubois-Briand

On Thu, Feb 20, 2025 at 2:41 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Feb 20, 2025 at 03:40:15PM +0200, Andy Shevchenko wrote:
> > On Thu, Feb 20, 2025 at 02:22:29PM +0100, Bartosz Golaszewski wrote:
> > > On Thu, Feb 20, 2025 at 2:18 PM Andy Shevchenko
> > > <andriy.shevchenko@linux.intel.com> wrote:
> > > > On Fri, Feb 14, 2025 at 11:50:53AM +0100, Linus Walleij wrote:
>
> ...
>
> > > > Bart, do you think it can be applied?
> > >
> > > Andy,
> > >
> > > I really rarely lose track of patches. It's been just under a week
> > > since this was posted. Please don't ping me to pick things up unless
> > > I'm not reacting for at least two weeks. I typically leave patches on
> > > the list for some time to give bots some time to react.
> >
> > I see, I thought your cadence is one week, that's why I have pinged you.
> > Will try to keep this in mind for the future and sorry to interrupt!
>
> Btw, if it's easier to you, I can just combine this to my usual PR to you.
>

No, that's fine, let's stick to ACPI-only PRs.

Bart

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

* Re: [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property
  2025-02-20 13:42           ` Bartosz Golaszewski
@ 2025-02-20 14:07             ` Andy Shevchenko
  2025-02-20 14:11               ` Bartosz Golaszewski
  0 siblings, 1 reply; 22+ messages in thread
From: Andy Shevchenko @ 2025-02-20 14:07 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel,
	Michael Walle, athieu Dubois-Briand

On Thu, Feb 20, 2025 at 02:42:26PM +0100, Bartosz Golaszewski wrote:
> On Thu, Feb 20, 2025 at 2:41 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Feb 20, 2025 at 03:40:15PM +0200, Andy Shevchenko wrote:
> > > On Thu, Feb 20, 2025 at 02:22:29PM +0100, Bartosz Golaszewski wrote:
> > > > On Thu, Feb 20, 2025 at 2:18 PM Andy Shevchenko
> > > > <andriy.shevchenko@linux.intel.com> wrote:
> > > > > On Fri, Feb 14, 2025 at 11:50:53AM +0100, Linus Walleij wrote:

...

> > > > > Bart, do you think it can be applied?
> > > >
> > > > Andy,
> > > >
> > > > I really rarely lose track of patches. It's been just under a week
> > > > since this was posted. Please don't ping me to pick things up unless
> > > > I'm not reacting for at least two weeks. I typically leave patches on
> > > > the list for some time to give bots some time to react.
> > >
> > > I see, I thought your cadence is one week, that's why I have pinged you.
> > > Will try to keep this in mind for the future and sorry to interrupt!
> >
> > Btw, if it's easier to you, I can just combine this to my usual PR to you.
> 
> No, that's fine, let's stick to ACPI-only PRs.

Hmm... Is the Intel GPIO stuff should go directly to your tree? Seems I missed
some changes in the flow...

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property
  2025-02-20 14:07             ` Andy Shevchenko
@ 2025-02-20 14:11               ` Bartosz Golaszewski
  2025-02-20 14:15                 ` Andy Shevchenko
  0 siblings, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2025-02-20 14:11 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel,
	Michael Walle, athieu Dubois-Briand

On Thu, Feb 20, 2025 at 3:07 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Feb 20, 2025 at 02:42:26PM +0100, Bartosz Golaszewski wrote:
> > On Thu, Feb 20, 2025 at 2:41 PM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > > On Thu, Feb 20, 2025 at 03:40:15PM +0200, Andy Shevchenko wrote:
> > > > On Thu, Feb 20, 2025 at 02:22:29PM +0100, Bartosz Golaszewski wrote:
> > > > > On Thu, Feb 20, 2025 at 2:18 PM Andy Shevchenko
> > > > > <andriy.shevchenko@linux.intel.com> wrote:
> > > > > > On Fri, Feb 14, 2025 at 11:50:53AM +0100, Linus Walleij wrote:
>
> ...
>
> > > > > > Bart, do you think it can be applied?
> > > > >
> > > > > Andy,
> > > > >
> > > > > I really rarely lose track of patches. It's been just under a week
> > > > > since this was posted. Please don't ping me to pick things up unless
> > > > > I'm not reacting for at least two weeks. I typically leave patches on
> > > > > the list for some time to give bots some time to react.
> > > >
> > > > I see, I thought your cadence is one week, that's why I have pinged you.
> > > > Will try to keep this in mind for the future and sorry to interrupt!
> > >
> > > Btw, if it's easier to you, I can just combine this to my usual PR to you.
> >
> > No, that's fine, let's stick to ACPI-only PRs.
>
> Hmm... Is the Intel GPIO stuff should go directly to your tree? Seems I missed
> some changes in the flow...
>

Ah, no, sure, intel and ACPI and whatever you did up until this point.

Bart

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

* Re: [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property
  2025-02-20 14:11               ` Bartosz Golaszewski
@ 2025-02-20 14:15                 ` Andy Shevchenko
  0 siblings, 0 replies; 22+ messages in thread
From: Andy Shevchenko @ 2025-02-20 14:15 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel,
	Michael Walle, athieu Dubois-Briand

On Thu, Feb 20, 2025 at 03:11:04PM +0100, Bartosz Golaszewski wrote:
> On Thu, Feb 20, 2025 at 3:07 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Feb 20, 2025 at 02:42:26PM +0100, Bartosz Golaszewski wrote:
> > > On Thu, Feb 20, 2025 at 2:41 PM Andy Shevchenko
> > > <andriy.shevchenko@linux.intel.com> wrote:
> > > > On Thu, Feb 20, 2025 at 03:40:15PM +0200, Andy Shevchenko wrote:
> > > > > On Thu, Feb 20, 2025 at 02:22:29PM +0100, Bartosz Golaszewski wrote:
> > > > > > On Thu, Feb 20, 2025 at 2:18 PM Andy Shevchenko
> > > > > > <andriy.shevchenko@linux.intel.com> wrote:
> > > > > > > On Fri, Feb 14, 2025 at 11:50:53AM +0100, Linus Walleij wrote:

...

> > > > > > > Bart, do you think it can be applied?
> > > > > >
> > > > > > Andy,
> > > > > >
> > > > > > I really rarely lose track of patches. It's been just under a week
> > > > > > since this was posted. Please don't ping me to pick things up unless
> > > > > > I'm not reacting for at least two weeks. I typically leave patches on
> > > > > > the list for some time to give bots some time to react.
> > > > >
> > > > > I see, I thought your cadence is one week, that's why I have pinged you.
> > > > > Will try to keep this in mind for the future and sorry to interrupt!
> > > >
> > > > Btw, if it's easier to you, I can just combine this to my usual PR to you.
> > >
> > > No, that's fine, let's stick to ACPI-only PRs.
> >
> > Hmm... Is the Intel GPIO stuff should go directly to your tree? Seems I missed
> > some changes in the flow...
> 
> Ah, no, sure, intel and ACPI and whatever you did up until this point.

Got it, thanks!

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property
  2025-02-13 19:48 [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property Andy Shevchenko
                   ` (6 preceding siblings ...)
  2025-02-14 10:50 ` Linus Walleij
@ 2025-02-21  8:45 ` Bartosz Golaszewski
  7 siblings, 0 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2025-02-21  8:45 UTC (permalink / raw)
  To: linux-gpio, linux-kernel, Andy Shevchenko
  Cc: Bartosz Golaszewski, Michael Walle, Linus Walleij,
	Bartosz Golaszewski, athieu Dubois-Briand

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Thu, 13 Feb 2025 21:48:45 +0200, Andy Shevchenko wrote:
> It appears that regmap GPIO doesn't take into account 'ngpios' property
> and requires hard coded values or duplication of the parsing the same
> outside of GPIO library. This miniseries addresses that.
> 
> For the record, I have checked all bgpio_init() users and haven't seen
> the suspicious code that this series might break, e.g., an equivalent of
> something like this:
> 
> [...]

Applied, thanks!

[1/5] gpiolib: Extract gpiochip_choose_fwnode() for wider use
      commit: 375790f18396b2ba706e031b150c58cd37b45a11
[2/5] gpiolib: Use fwnode instead of device in gpiochip_get_ngpios()
      commit: 6f077e575893214136f9739f993bd9fedf61731a
[3/5] gpio: regmap: Group optional assignments together for better understanding
      commit: 97673ea38a77e42eaafcf5181c84f6c8d40b97e7
[4/5] gpio: regmap: Move optional assignments down in the code
      commit: a630d3960b6ac3c37cb0789605056e8845ffbf16
[5/5] gpio: regmap: Allow ngpio to be read from the property
      commit: db305161880a024a43f4b1cbafa7a294793d7a9e

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

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

end of thread, other threads:[~2025-02-21  8:45 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-13 19:48 [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property Andy Shevchenko
2025-02-13 19:48 ` [PATCH v1 1/5] gpiolib: Extract gpiochip_choose_fwnode() for wider use Andy Shevchenko
2025-02-13 19:48 ` [PATCH v1 2/5] gpiolib: Use fwnode instead of device in gpiochip_get_ngpios() Andy Shevchenko
2025-02-13 19:48 ` [PATCH v1 3/5] gpio: regmap: Group optional assignments together for better understanding Andy Shevchenko
2025-02-17  7:40   ` Michael Walle
2025-02-13 19:48 ` [PATCH v1 4/5] gpio: regmap: Move optional assignments down in the code Andy Shevchenko
2025-02-17  7:43   ` Michael Walle
2025-02-13 19:48 ` [PATCH v1 5/5] gpio: regmap: Allow ngpio to be read from the property Andy Shevchenko
2025-02-17  7:44   ` Michael Walle
2025-02-14  9:18 ` [PATCH v1 0/5] gpio: regmap: Make use of 'ngpios' property Mathieu Dubois-Briand
2025-02-14 13:49   ` Andy Shevchenko
2025-02-14 14:07     ` Mathieu Dubois-Briand
2025-02-14 10:50 ` Linus Walleij
2025-02-20 13:18   ` Andy Shevchenko
2025-02-20 13:22     ` Bartosz Golaszewski
2025-02-20 13:40       ` Andy Shevchenko
2025-02-20 13:41         ` Andy Shevchenko
2025-02-20 13:42           ` Bartosz Golaszewski
2025-02-20 14:07             ` Andy Shevchenko
2025-02-20 14:11               ` Bartosz Golaszewski
2025-02-20 14:15                 ` Andy Shevchenko
2025-02-21  8:45 ` Bartosz Golaszewski

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