Skip to contentSkip to conversation

gpiolib: more helpers and fwnode conversion

PATCH In review Andy Shevchenko 5 participants 13 messages Apr 14, 2022 – May 5, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v5 cover gpiolib: more helpers and fwnode conversion

This is a spin-off (*) of the previous work of switching GPIO library to use fwnode instead of of_node. Here we introduce a couple of a new macro helpers, which allows to switch some of the drivers to use fwnode and partially fwnode APIs. As a result of this cleanup a few drivers switched to use GPIO fwnode instead of of_node.

*) it's subset of it with a new (patch 1) helper.

Marek, Martin, can you give this a try?
This requires at least two patches for GPIO library to be applied.

Bart, Linus, I can take it thru my tree with an immutable branch if it's the way you prefer, otherwise please suggest on how to proceed.

Changelog v5:
- dropped tested patches (this series based on them, though)
- introduced a new helper (thanks Marek and Martin for reporting an issue)
- redone Armada and Meson code using newly introduced helper

Changelog v4:
- fixed compilation of the Samsung pin control drivers (LKP)
- explained in the commit message why namespacing is good for meson defs
- added tag to one of meson patches (Neil)

Changelog v3:
- moved count initialization to the definition in patch 2 (Geert)
- replaced of_args by args, used %pfwP in patch 7 (Geert)
- fixed kernel doc warning in patch 7
- added tags to patches 1, 2, 6, and 7 (Geert)
- added tag to patch 4 (Fabien)
- renamed MREG to MESON_REG in patch 9 (Neil)
- added tag to patch 10 (Neil)
- used --base for cover-letter

Changelog v2:
- properly based, so kbuild bot may test it (LKP)
- fixed typo in the macro (Geert)
- split to two macro helpers and rename the gpiochip_count()
- tagged one of stm32 and one of meson patches (Fabien, Neil)
- unified previously standalone armada patch
- due to above rewrote the armada patch from v1 completely (Sergey)
- added a lot of a new patches
- compile tested all of them on x86

Andy Shevchenko (6):
gpiolib: Introduce a helper to get first GPIO controller node
pinctrl: armada-37xx: Switch to use fwnode instead of of_node
pinctrl: armada-37xx: Reuse GPIO fwnode in
armada_37xx_irqchip_register()
pinctrl: meson: Rename REG_* to MESON_REG_*
pinctrl: meson: Enable COMPILE_TEST
pinctrl: meson: Replace custom code by gpiochip_node_count() call

 drivers/pinctrl/meson/Kconfig               |  2 +-
 drivers/pinctrl/meson/pinctrl-meson.c       | 52 ++++++++++-----------
 drivers/pinctrl/meson/pinctrl-meson.h       | 28 +++++------
 drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 34 ++++----------
 include/linux/gpio/driver.h                 | 10 ++++
 5 files changed, 59 insertions(+), 67 deletions(-)
Signature · 1 line
2.35.1
#1 lore raw

PATCH v5 1/6 gpiolib: Introduce a helper to get first GPIO controller node

Introduce a helper to get first GPIO controller node which drivers may want to use.

---
 include/linux/gpio/driver.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/linux/gpio/driver.h +10 -0
index 12de0b22b4ef..83e2d72e51bb 100644
@@ -766,4 +766,14 @@ static inline unsigned int gpiochip_node_count(struct device *dev)
 	return count;
 }
 
+static inline struct fwnode_handle *gpiochip_node_get_first(struct device *dev)
+{
+	struct fwnode_handle *fwnode;
+
+	for_each_gpiochip_node(dev, fwnode)
+		return fwnode;
+
+	return NULL;
+}
+
 #endif /* __LINUX_GPIO_DRIVER_H */
Signature · 1 line
2.35.1
#2 lore raw

Re: [PATCH v5 1/6] gpiolib: Introduce a helper to get first GPIO controller node

Quoted 29 lines · Andy Shevchenko

Introduce a helper to get first GPIO controller node which drivers may want to use.

---
 include/linux/gpio/driver.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/linux/gpio/driver.h +10 -1
index 12de0b22b4ef..83e2d72e51bb 100644
@@ -766,4 +766,14 @@ static inline unsigned int gpiochip_node_count(struct device *dev)
        return count;
 }
 
+static inline struct fwnode_handle *gpiochip_node_get_first(struct device *dev)
+{
+       struct fwnode_handle *fwnode;
+
+       for_each_gpiochip_node(dev, fwnode)
+               return fwnode;
+
+       return NULL;
+}
+
 #endif /* __LINUX_GPIO_DRIVER_H */
--
Quoted 2 lines

2.35.1

Any chance you could name it get_first_gpiochip_node()? It's static so we don't have to worry about the prefix and it would make the purpose more clear.

Bart

#3 lore raw

Re: [PATCH v5 1/6] gpiolib: Introduce a helper to get first GPIO controller node

Quoted 17 lines · Bartosz Golaszewski
Quoted 14 lines · Andy Shevchenko

Introduce a helper to get first GPIO controller node which drivers may want to use.

include/linux/gpio/driver.h +10 -0
+static inline struct fwnode_handle *gpiochip_node_get_first(struct device *dev)
+{
+       struct fwnode_handle *fwnode;
+
+       for_each_gpiochip_node(dev, fwnode)
+               return fwnode;
+
+       return NULL;
+}
+
Quoted 8 lines
Quoted 4 lines

#endif /* __LINUX_GPIO_DRIVER_H */
--
2.35.1

Any chance you could name it get_first_gpiochip_node()? It's static so we don't have to worry about the prefix and it would make the purpose more clear.

There are two things why I prefer it as is:
1) it's static inline, so it's part of (internal) but still exported API;
2) it's already in my for-next branch which I would like not to rebase, until it's a really serious issue.

That said, if you still insist I can rename it.

Signature · 7 lines
With Best Regards,
Andy Shevchenko

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
#4 lore raw

Re: [PATCH v5 1/6] gpiolib: Introduce a helper to get first GPIO controller node

Quoted 28 lines · Andy Shevchenko
Quoted 17 lines · Bartosz Golaszewski
Quoted 14 lines · Andy Shevchenko

Introduce a helper to get first GPIO controller node which drivers may want to use.

include/linux/gpio/driver.h +10 -0
+static inline struct fwnode_handle *gpiochip_node_get_first(struct device *dev)
+{
+       struct fwnode_handle *fwnode;
+
+       for_each_gpiochip_node(dev, fwnode)
+               return fwnode;
+
+       return NULL;
+}
+
Quoted 8 lines
Quoted 4 lines

#endif /* __LINUX_GPIO_DRIVER_H */
--
2.35.1

Any chance you could name it get_first_gpiochip_node()? It's static so we don't have to worry about the prefix and it would make the purpose more clear.

Quoted 6 lines

There are two things why I prefer it as is:
1) it's static inline, so it's part of (internal) but still exported API;
2) it's already in my for-next branch which I would like not to rebase, until it's a really serious issue.

That said, if you still insist I can rename it.

No that's fine and I also pulled that into my tree.

Bart

#5 lore raw

Re: [PATCH v5 1/6] gpiolib: Introduce a helper to get first GPIO controller node

Quoted 5 lines · Bartosz Golaszewski
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Bartosz Golaszewski

On Thu, Apr 14, 2022 at 9:02 PM Andy Shevchenko
<[email protected]> wrote:

...

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

Any chance you could name it get_first_gpiochip_node()? It's static so we don't have to worry about the prefix and it would make the purpose more clear.

Quoted 8 lines
Quoted 6 lines

There are two things why I prefer it as is:
1) it's static inline, so it's part of (internal) but still exported API;
2) it's already in my for-next branch which I would like not to rebase, until it's a really serious issue.

That said, if you still insist I can rename it.

No that's fine and I also pulled that into my tree.

Thank you!

Signature · 9 lines
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
#6 lore raw

PATCH v5 2/6 pinctrl: armada-37xx: Switch to use fwnode instead of of_node

In reply to Andy Shevchenko

GPIO library now accepts fwnode as a firmware node, so switch the driver to use it.

---
 drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +7 -11
index 08cad14042e2..110f70bce3fe 100644
@@ -21,6 +21,7 @@
 #include <linux/pinctrl/pinctrl.h>
 #include <linux/pinctrl/pinmux.h>
 #include <linux/platform_device.h>
+#include <linux/property.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
 #include <linux/string_helpers.h>
@@ -787,18 +788,13 @@ static int armada_37xx_gpiochip_register(struct platform_device *pdev,
 					struct armada_37xx_pinctrl *info)
 {
 	struct device *dev = &pdev->dev;
-	struct device_node *np;
+	struct fwnode_handle *fwnode;
 	struct gpio_chip *gc;
-	int ret = -ENODEV;
+	int ret;
 
-	for_each_child_of_node(dev->of_node, np) {
-		if (of_find_property(np, "gpio-controller", NULL)) {
-			ret = 0;
-			break;
-		}
-	}
-	if (ret)
-		return ret;
+	fwnode = gpiochip_node_get_first(dev);
+	if (!fwnode)
+		return -ENODEV;
 
 	info->gpio_chip = armada_37xx_gpiolib_chip;
 
@@ -806,7 +802,7 @@ static int armada_37xx_gpiochip_register(struct platform_device *pdev,
 	gc->ngpio = info->data->nr_pins;
 	gc->parent = dev;
 	gc->base = -1;
-	gc->of_node = np;
+	gc->fwnode = fwnode;
 	gc->label = info->data->name;
 
 	ret = armada_37xx_irqchip_register(pdev, info);
Signature · 1 line
2.35.1
#7 lore raw

PATCH v5 3/6 pinctrl: armada-37xx: Reuse GPIO fwnode in armada_37xx_irqchip_register()

In reply to Andy Shevchenko

Since we have fwnode of the first found GPIO controller assigned to the struct gpio_chip, we may reuse it in the armada_37xx_irqchip_register().

---
 drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +3 -13
index 110f70bce3fe..ef4118e49f16 100644
@@ -727,23 +727,13 @@ static int armada_37xx_irqchip_register(struct platform_device *pdev,
 	struct gpio_chip *gc = &info->gpio_chip;
 	struct irq_chip *irqchip = &info->irq_chip;
 	struct gpio_irq_chip *girq = &gc->irq;
+	struct device_node *np = to_of_node(gc->fwnode);
 	struct device *dev = &pdev->dev;
-	struct device_node *np;
-	int ret = -ENODEV, i, nr_irq_parent;
-
-	/* Check if we have at least one gpio-controller child node */
-	for_each_child_of_node(dev->of_node, np) {
-		if (of_property_read_bool(np, "gpio-controller")) {
-			ret = 0;
-			break;
-		}
-	}
-	if (ret)
-		return dev_err_probe(dev, ret, "no gpio-controller child node\n");
+	unsigned int i, nr_irq_parent;
 
-	nr_irq_parent = of_irq_count(np);
 	spin_lock_init(&info->irq_lock);
 
+	nr_irq_parent = of_irq_count(np);
 	if (!nr_irq_parent) {
 		dev_err(dev, "invalid or no IRQ\n");
 		return 0;
Signature · 1 line
2.35.1
#8 lore raw

PATCH v5 4/6 pinctrl: meson: Rename REG_* to MESON_REG_*

In reply to Andy Shevchenko

Currently compilation test fails on x86 due to name collision. The usual way to fix that is to move both conflicting parts to their own namespaces.

Rename REG_* to MESON_REG_* as a prerequisite for enabling COMPILE_TEST.

---
 drivers/pinctrl/meson/pinctrl-meson.c | 24 +++++++++++------------
 drivers/pinctrl/meson/pinctrl-meson.h | 28 +++++++++++++--------------
 2 files changed, 26 insertions(+), 26 deletions(-)
drivers/pinctrl/meson/pinctrl-meson.c +12 -12
index 49851444a6e3..5b46a0979db7 100644
@@ -218,13 +218,13 @@ static int meson_pinconf_set_output(struct meson_pinctrl *pc,
 				    unsigned int pin,
 				    bool out)
 {
-	return meson_pinconf_set_gpio_bit(pc, pin, REG_DIR, !out);
+	return meson_pinconf_set_gpio_bit(pc, pin, MESON_REG_DIR, !out);
 }
 
 static int meson_pinconf_get_output(struct meson_pinctrl *pc,
 				    unsigned int pin)
 {
-	int ret = meson_pinconf_get_gpio_bit(pc, pin, REG_DIR);
+	int ret = meson_pinconf_get_gpio_bit(pc, pin, MESON_REG_DIR);
 
 	if (ret < 0)
 		return ret;
@@ -236,13 +236,13 @@ static int meson_pinconf_set_drive(struct meson_pinctrl *pc,
 				   unsigned int pin,
 				   bool high)
 {
-	return meson_pinconf_set_gpio_bit(pc, pin, REG_OUT, high);
+	return meson_pinconf_set_gpio_bit(pc, pin, MESON_REG_OUT, high);
 }
 
 static int meson_pinconf_get_drive(struct meson_pinctrl *pc,
 				   unsigned int pin)
 {
-	return meson_pinconf_get_gpio_bit(pc, pin, REG_OUT);
+	return meson_pinconf_get_gpio_bit(pc, pin, MESON_REG_OUT);
 }
 
 static int meson_pinconf_set_output_drive(struct meson_pinctrl *pc,
@@ -269,7 +269,7 @@ static int meson_pinconf_disable_bias(struct meson_pinctrl *pc,
 	if (ret)
 		return ret;
 
-	meson_calc_reg_and_bit(bank, pin, REG_PULLEN, &reg, &bit);
+	meson_calc_reg_and_bit(bank, pin, MESON_REG_PULLEN, &reg, &bit);
 	ret = regmap_update_bits(pc->reg_pullen, reg, BIT(bit), 0);
 	if (ret)
 		return ret;
@@ -288,7 +288,7 @@ static int meson_pinconf_enable_bias(struct meson_pinctrl *pc, unsigned int pin,
 	if (ret)
 		return ret;
 
-	meson_calc_reg_and_bit(bank, pin, REG_PULL, &reg, &bit);
+	meson_calc_reg_and_bit(bank, pin, MESON_REG_PULL, &reg, &bit);
 	if (pull_up)
 		val = BIT(bit);
 
@@ -296,7 +296,7 @@ static int meson_pinconf_enable_bias(struct meson_pinctrl *pc, unsigned int pin,
 	if (ret)
 		return ret;
 
-	meson_calc_reg_and_bit(bank, pin, REG_PULLEN, &reg, &bit);
+	meson_calc_reg_and_bit(bank, pin, MESON_REG_PULLEN, &reg, &bit);
 	ret = regmap_update_bits(pc->reg_pullen, reg, BIT(bit),	BIT(bit));
 	if (ret)
 		return ret;
@@ -321,7 +321,7 @@ static int meson_pinconf_set_drive_strength(struct meson_pinctrl *pc,
 	if (ret)
 		return ret;
 
-	meson_calc_reg_and_bit(bank, pin, REG_DS, &reg, &bit);
+	meson_calc_reg_and_bit(bank, pin, MESON_REG_DS, &reg, &bit);
 
 	if (drive_strength_ua <= 500) {
 		ds_val = MESON_PINCONF_DRV_500UA;
@@ -407,7 +407,7 @@ static int meson_pinconf_get_pull(struct meson_pinctrl *pc, unsigned int pin)
 	if (ret)
 		return ret;
 
-	meson_calc_reg_and_bit(bank, pin, REG_PULLEN, &reg, &bit);
+	meson_calc_reg_and_bit(bank, pin, MESON_REG_PULLEN, &reg, &bit);
 
 	ret = regmap_read(pc->reg_pullen, reg, &val);
 	if (ret)
@@ -416,7 +416,7 @@ static int meson_pinconf_get_pull(struct meson_pinctrl *pc, unsigned int pin)
 	if (!(val & BIT(bit))) {
 		conf = PIN_CONFIG_BIAS_DISABLE;
 	} else {
-		meson_calc_reg_and_bit(bank, pin, REG_PULL, &reg, &bit);
+		meson_calc_reg_and_bit(bank, pin, MESON_REG_PULL, &reg, &bit);
 
 		ret = regmap_read(pc->reg_pull, reg, &val);
 		if (ret)
@@ -447,7 +447,7 @@ static int meson_pinconf_get_drive_strength(struct meson_pinctrl *pc,
 	if (ret)
 		return ret;
 
-	meson_calc_reg_and_bit(bank, pin, REG_DS, &reg, &bit);
+	meson_calc_reg_and_bit(bank, pin, MESON_REG_DS, &reg, &bit);
 
 	ret = regmap_read(pc->reg_ds, reg, &val);
 	if (ret)
@@ -595,7 +595,7 @@ static int meson_gpio_get(struct gpio_chip *chip, unsigned gpio)
 	if (ret)
 		return ret;
 
-	meson_calc_reg_and_bit(bank, gpio, REG_IN, &reg, &bit);
+	meson_calc_reg_and_bit(bank, gpio, MESON_REG_IN, &reg, &bit);
 	regmap_read(pc->reg_gpio, reg, &val);
 
 	return !!(val & BIT(bit));
drivers/pinctrl/meson/pinctrl-meson.h +14 -14
index ff5372e0a475..b197827027bd 100644
@@ -63,13 +63,13 @@ struct meson_reg_desc {
  * enum meson_reg_type - type of registers encoded in @meson_reg_desc
  */
 enum meson_reg_type {
-	REG_PULLEN,
-	REG_PULL,
-	REG_DIR,
-	REG_OUT,
-	REG_IN,
-	REG_DS,
-	NUM_REG,
+	MESON_REG_PULLEN,
+	MESON_REG_PULL,
+	MESON_REG_DIR,
+	MESON_REG_OUT,
+	MESON_REG_IN,
+	MESON_REG_DS,
+	MESON_NUM_REG,
 };
 
 /**
@@ -102,7 +102,7 @@ struct meson_bank {
 	unsigned int last;
 	int irq_first;
 	int irq_last;
-	struct meson_reg_desc regs[NUM_REG];
+	struct meson_reg_desc regs[MESON_NUM_REG];
 };
 
 struct meson_pinctrl_data {
@@ -150,12 +150,12 @@ struct meson_pinctrl {
 		.irq_first	= fi,					\
 		.irq_last	= li,					\
 		.regs = {						\
-			[REG_PULLEN]	= { per, peb },			\
-			[REG_PULL]	= { pr, pb },			\
-			[REG_DIR]	= { dr, db },			\
-			[REG_OUT]	= { or, ob },			\
-			[REG_IN]	= { ir, ib },			\
-			[REG_DS]	= { dsr, dsb },			\
+			[MESON_REG_PULLEN]	= { per, peb },		\
+			[MESON_REG_PULL]	= { pr, pb },		\
+			[MESON_REG_DIR]		= { dr, db },		\
+			[MESON_REG_OUT]		= { or, ob },		\
+			[MESON_REG_IN]		= { ir, ib },		\
+			[MESON_REG_DS]		= { dsr, dsb },		\
 		},							\
 	 }
 
Signature · 1 line
2.35.1
#9 lore raw

PATCH v5 5/6 pinctrl: meson: Enable COMPILE_TEST

In reply to Andy Shevchenko

Enable COMPILE_TEST for a better test coverage.

---
 drivers/pinctrl/meson/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/meson/Kconfig +1 -1
index d1955c65b4b6..64fb9e074ac6 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 menuconfig PINCTRL_MESON
 	tristate "Amlogic SoC pinctrl drivers"
-	depends on ARCH_MESON
+	depends on ARCH_MESON || COMPILE_TEST
 	depends on OF
 	default y
 	select PINMUX
Signature · 1 line
2.35.1
#10 lore raw

PATCH v5 6/6 pinctrl: meson: Replace custom code by gpiochip_node_count() call

In reply to Andy Shevchenko

Since we have generic function to count GPIO controller nodes under a given device, there is no need to open code it. Replace custom code by gpiochip_node_count() call.

---
 drivers/pinctrl/meson/pinctrl-meson.c | 28 ++++++++++++---------------
 1 file changed, 12 insertions(+), 16 deletions(-)
drivers/pinctrl/meson/pinctrl-meson.c +12 -16
index 5b46a0979db7..cc2cd73ff8f9 100644
@@ -49,6 +49,7 @@
 #include <linux/pinctrl/pinctrl.h>
 #include <linux/pinctrl/pinmux.h>
 #include <linux/platform_device.h>
+#include <linux/property.h>
 #include <linux/regmap.h>
 #include <linux/seq_file.h>
 
@@ -662,27 +663,22 @@ static struct regmap *meson_map_resource(struct meson_pinctrl *pc,
 	return devm_regmap_init_mmio(pc->dev, base, &meson_regmap_config);
 }
 
-static int meson_pinctrl_parse_dt(struct meson_pinctrl *pc,
-				  struct device_node *node)
+static int meson_pinctrl_parse_dt(struct meson_pinctrl *pc)
 {
-	struct device_node *np, *gpio_np = NULL;
+	struct device_node *gpio_np;
+	unsigned int chips;
 
-	for_each_child_of_node(node, np) {
-		if (!of_find_property(np, "gpio-controller", NULL))
-			continue;
-		if (gpio_np) {
-			dev_err(pc->dev, "multiple gpio nodes\n");
-			of_node_put(np);
-			return -EINVAL;
-		}
-		gpio_np = np;
-	}
-
-	if (!gpio_np) {
+	chips = gpiochip_node_count(pc->dev);
+	if (!chips) {
 		dev_err(pc->dev, "no gpio node found\n");
 		return -EINVAL;
 	}
+	if (chips > 1) {
+		dev_err(pc->dev, "multiple gpio nodes\n");
+		return -EINVAL;
+	}
 
+	gpio_np = to_of_node(gpiochip_node_get_first(pc->dev));
 	pc->of_node = gpio_np;
 
 	pc->reg_mux = meson_map_resource(pc, gpio_np, "mux");
@@ -751,7 +747,7 @@ int meson_pinctrl_probe(struct platform_device *pdev)
 	pc->dev = dev;
 	pc->data = (struct meson_pinctrl_data *) of_device_get_match_data(dev);
 
-	ret = meson_pinctrl_parse_dt(pc, dev->of_node);
+	ret = meson_pinctrl_parse_dt(pc);
 	if (ret)
 		return ret;
 
Signature · 1 line
2.35.1
Tested-by on the v5 series
#11 lore raw
In reply to Andy Shevchenko

Hi Andy,

Quoted 10 lines · Andy Shevchenko

This is a spin-off (*) of the previous work of switching GPIO library to use fwnode instead of of_node. Here we introduce a couple of a new macro helpers, which allows to switch some of the drivers to use fwnode and partially fwnode APIs. As a result of this cleanup a few drivers switched to use GPIO fwnode instead of of_node.

*) it's subset of it with a new (patch 1) helper.

Marek, Martin, can you give this a try?
This requires at least two patches for GPIO library to be applied.

I've applied patch #1 and #6 on top of linux next-20220413 with commit 88834c75cae5 ("pinctrl: meson: Replace custom code by gpiochip_node_count() call") reverted. All my Meson-based test boards (Odroid C4, N2, Khadas VIM3/3l) work fine now. Thanks! Feel free to add:

Quoted 42 lines

Bart, Linus, I can take it thru my tree with an immutable branch if it's the way you prefer, otherwise please suggest on how to proceed.

Changelog v5:
- dropped tested patches (this series based on them, though)
- introduced a new helper (thanks Marek and Martin for reporting an issue)
- redone Armada and Meson code using newly introduced helper

Changelog v4:
- fixed compilation of the Samsung pin control drivers (LKP)
- explained in the commit message why namespacing is good for meson defs
- added tag to one of meson patches (Neil)

Changelog v3:
- moved count initialization to the definition in patch 2 (Geert)
- replaced of_args by args, used %pfwP in patch 7 (Geert)
- fixed kernel doc warning in patch 7
- added tags to patches 1, 2, 6, and 7 (Geert)
- added tag to patch 4 (Fabien)
- renamed MREG to MESON_REG in patch 9 (Neil)
- added tag to patch 10 (Neil)
- used --base for cover-letter

Changelog v2:
- properly based, so kbuild bot may test it (LKP)
- fixed typo in the macro (Geert)
- split to two macro helpers and rename the gpiochip_count()
- tagged one of stm32 and one of meson patches (Fabien, Neil)
- unified previously standalone armada patch
- due to above rewrote the armada patch from v1 completely (Sergey)
- added a lot of a new patches
- compile tested all of them on x86

Andy Shevchenko (6):
gpiolib: Introduce a helper to get first GPIO controller node
pinctrl: armada-37xx: Switch to use fwnode instead of of_node
pinctrl: armada-37xx: Reuse GPIO fwnode in
armada_37xx_irqchip_register()
pinctrl: meson: Rename REG_* to MESON_REG_*
pinctrl: meson: Enable COMPILE_TEST
pinctrl: meson: Replace custom code by gpiochip_node_count() call

Quoted 7 lines
  drivers/pinctrl/meson/Kconfig               |  2 +-
  drivers/pinctrl/meson/pinctrl-meson.c       | 52 ++++++++++-----------
  drivers/pinctrl/meson/pinctrl-meson.h       | 28 +++++------
  drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 34 ++++----------
  include/linux/gpio/driver.h                 | 10 ++++
  5 files changed, 59 insertions(+), 67 deletions(-)

Best regards

Signature · 2 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland
Acked-by on the v5 series
#12 lore raw
In reply to Andy Shevchenko
Quoted 6 lines · Andy Shevchenko

This is a spin-off (*) of the previous work of switching GPIO library to use fwnode instead of of_node. Here we introduce a couple of a new macro helpers, which allows to switch some of the drivers to use fwnode and partially fwnode APIs. As a result of this cleanup a few drivers switched to use GPIO fwnode instead of of_node.

Quoted 7 lines

*) it's subset of it with a new (patch 1) helper.

Marek, Martin, can you give this a try?
This requires at least two patches for GPIO library to be applied.

Bart, Linus, I can take it thru my tree with an immutable branch if it's the way you prefer, otherwise please suggest on how to proceed.

Hmmm that sounds best, patch 1 does not apply to the pinctrl tree so I suppose there are already dependencies in the GPIO tree?

FWIW, the series:

I'm of course a fan of this nice refactoring series.

Yours,
Linus Walleij