All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mfd: ucb1x00: Convert Assabet gpio-keys to software nodes
@ 2026-07-07  5:01 Dmitry Torokhov
  2026-07-07  5:01 ` [PATCH v2 1/2] mfd: ucb1x00: Register software node for GPIO controller Dmitry Torokhov
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Dmitry Torokhov @ 2026-07-07  5:01 UTC (permalink / raw)
  To: Lee Jones, Arnd Bergmann, Bartosz Golaszewski; +Cc: mfd, linux-kernel

This patch series converts the legacy gpio-keys platform device on the
StrongARM SA-1100 Assabet evaluation board from platform data to software
nodes and device properties.

The first patch registers a shared software node for the UCB1x00 GPIO
controller in drivers/mfd/ucb1x00-core.c, attaching its firmware node
directly to the GPIO chip prior to registration. The second patch
converts the Assabet machine subdriver to define dynamically allocated
software nodes referencing the UCB1x00 GPIO controller directly, allowing
pin bindings to be resolved via the attached firmware node without relying
on name matching.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
Changes in v2:
- Export ucb1x00_gpiochip_node to fix link errors when built as module.
- Fix teardown order in core driver to avoid software node use-after-free.
- Convert Assabet subdriver to use dynamically allocated software nodes
  to avoid use-after-free on module unload.
- Factor out button node removal logic into a helper.
- Link to v1: https://patch.msgid.link/20260706-ucb1x00-assabet-swnode-v1-0-6102eabd31d0@gmail.com

---
Dmitry Torokhov (2):
      mfd: ucb1x00: Register software node for GPIO controller
      mfd: ucb1x00: Convert Assabet gpio-keys to use software nodes

 drivers/mfd/ucb1x00-assabet.c | 124 +++++++++++++++++++++++++++++++++---------
 drivers/mfd/ucb1x00-core.c    |  16 +++++-
 include/linux/mfd/ucb1x00.h   |   3 +
 3 files changed, 116 insertions(+), 27 deletions(-)
---
base-commit: 8e9685d3c41c35dd1b37df70d854137abcb2fbac
change-id: 20260705-ucb1x00-assabet-swnode-683cb383d398

Thanks.

-- 
Dmitry


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

* [PATCH v2 1/2] mfd: ucb1x00: Register software node for GPIO controller
  2026-07-07  5:01 [PATCH v2 0/2] mfd: ucb1x00: Convert Assabet gpio-keys to software nodes Dmitry Torokhov
@ 2026-07-07  5:01 ` Dmitry Torokhov
  2026-07-07 13:46   ` Arnd Bergmann
  2026-07-07  5:01 ` [PATCH v2 2/2] mfd: ucb1x00: Convert Assabet gpio-keys to use software nodes Dmitry Torokhov
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 14+ messages in thread
From: Dmitry Torokhov @ 2026-07-07  5:01 UTC (permalink / raw)
  To: Lee Jones, Arnd Bergmann, Bartosz Golaszewski; +Cc: mfd, linux-kernel

Define a static software node for the UCB1x00 GPIO controller and attach
it to the core MFD device in ucb1x00_probe(). This node will also be
used by the created GPIO chip.

This allows machine subdrivers (such as Assabet evaluation board
support) to reference the UCB1x00 GPIO controller in property entries
when converting legacy platform data to software nodes, resolving pin
bindings directly via the attached firmware node without relying on
name matching.

Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/mfd/ucb1x00-core.c  | 16 +++++++++++++++-
 include/linux/mfd/ucb1x00.h |  3 +++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c
index 16f64e2b2f77..90edf0352d05 100644
--- a/drivers/mfd/ucb1x00-core.c
+++ b/drivers/mfd/ucb1x00-core.c
@@ -25,6 +25,7 @@
 #include <linux/mutex.h>
 #include <linux/mfd/ucb1x00.h>
 #include <linux/pm.h>
+#include <linux/property.h>
 #include <linux/gpio/driver.h>
 
 static DEFINE_MUTEX(ucb1x00_mutex);
@@ -492,6 +493,11 @@ static struct class ucb1x00_class = {
 	.dev_release	= ucb1x00_release,
 };
 
+const struct software_node ucb1x00_gpiochip_node = {
+	.name = "ucb1x00-gpio",
+};
+EXPORT_SYMBOL_GPL(ucb1x00_gpiochip_node);
+
 static int ucb1x00_probe(struct mcp *mcp)
 {
 	struct ucb1x00_plat_data *pdata = mcp->attached_device.platform_data;
@@ -530,6 +536,10 @@ static int ucb1x00_probe(struct mcp *mcp)
 	ucb->id  = id;
 	ucb->mcp = mcp;
 
+	ret = device_add_software_node(&ucb->dev, &ucb1x00_gpiochip_node);
+	if (ret)
+		goto err_swnode_add;
+
 	ret = device_add(&ucb->dev);
 	if (ret)
 		goto err_dev_add;
@@ -604,6 +614,8 @@ static int ucb1x00_probe(struct mcp *mcp)
  err_no_irq:
 	device_del(&ucb->dev);
  err_dev_add:
+	device_remove_software_node(&ucb->dev);
+ err_swnode_add:
 	put_device(&ucb->dev);
  out:
 	if (pdata && pdata->reset)
@@ -630,7 +642,9 @@ static void ucb1x00_remove(struct mcp *mcp)
 
 	irq_set_chained_handler(ucb->irq, NULL);
 	irq_free_descs(ucb->irq_base, 16);
-	device_unregister(&ucb->dev);
+	device_del(&ucb->dev);
+	device_remove_software_node(&ucb->dev);
+	put_device(&ucb->dev);
 
 	if (pdata && pdata->reset)
 		pdata->reset(UCB_RST_REMOVE);
diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h
index ede237384723..214c71a12e84 100644
--- a/include/linux/mfd/ucb1x00.h
+++ b/include/linux/mfd/ucb1x00.h
@@ -103,6 +103,9 @@
 #define UCB_MODE_DYN_VFLAG_ENA	(1 << 12)
 #define UCB_MODE_AUD_OFF_CAN	(1 << 13)
 
+struct software_node;
+extern const struct software_node ucb1x00_gpiochip_node;
+
 enum ucb1x00_reset {
 	UCB_RST_PROBE,
 	UCB_RST_RESUME,

-- 
2.55.0.rc2.803.g1fd1e6609c-goog


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

* [PATCH v2 2/2] mfd: ucb1x00: Convert Assabet gpio-keys to use software nodes
  2026-07-07  5:01 [PATCH v2 0/2] mfd: ucb1x00: Convert Assabet gpio-keys to software nodes Dmitry Torokhov
  2026-07-07  5:01 ` [PATCH v2 1/2] mfd: ucb1x00: Register software node for GPIO controller Dmitry Torokhov
@ 2026-07-07  5:01 ` Dmitry Torokhov
  2026-07-16 13:06   ` Lee Jones
  2026-07-07  8:07 ` [PATCH v2 0/2] mfd: ucb1x00: Convert Assabet gpio-keys to " Bartosz Golaszewski
  2026-07-16 15:49 ` Lee Jones
  3 siblings, 1 reply; 14+ messages in thread
From: Dmitry Torokhov @ 2026-07-07  5:01 UTC (permalink / raw)
  To: Lee Jones, Arnd Bergmann, Bartosz Golaszewski; +Cc: mfd, linux-kernel

Convert the legacy gpio-keys platform device on the StrongARM SA-1100
Assabet evaluation board to use software nodes and device properties.
This allows describing the buttons and their GPIO bindings via software
nodes so that platform data support can eventually be removed from the
gpio-keys driver.

Define static software nodes for the gpio-keys device and the six button
child nodes at file scope using relative pin indexing on the UCB1x00 GPIO
controller node. In ucb1x00_assabet_add(), register the software node
group and use platform_device_register_full() to register the device.

Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/mfd/ucb1x00-assabet.c | 124 +++++++++++++++++++++++++++++++++---------
 1 file changed, 98 insertions(+), 26 deletions(-)

diff --git a/drivers/mfd/ucb1x00-assabet.c b/drivers/mfd/ucb1x00-assabet.c
index 6a389737c615..ee49ac779d1a 100644
--- a/drivers/mfd/ucb1x00-assabet.c
+++ b/drivers/mfd/ucb1x00-assabet.c
@@ -6,15 +6,18 @@
  *
  *  We handle the machine-specific bits of the UCB1x00 driver here.
  */
-#include <linux/module.h>
-#include <linux/init.h>
 #include <linux/device.h>
 #include <linux/err.h>
 #include <linux/fs.h>
-#include <linux/gpio_keys.h>
+#include <linux/gpio/machine.h>
+#include <linux/gpio/property.h>
+#include <linux/init.h>
 #include <linux/input.h>
+#include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/proc_fs.h>
+#include <linux/property.h>
+#include <linux/slab.h>
 #include <linux/mfd/ucb1x00.h>
 
 #define UCB1X00_ATTR(name,input)\
@@ -34,50 +37,119 @@ UCB1X00_ATTR(vbatt, UCB_ADC_INP_AD1);
 UCB1X00_ATTR(vcharger, UCB_ADC_INP_AD0);
 UCB1X00_ATTR(batt_temp, UCB_ADC_INP_AD2);
 
+static const struct property_entry ucb1x00_gpio_keys_props[] = {
+	PROPERTY_ENTRY_STRING("label", "ucb1x00"),
+	PROPERTY_ENTRY_U32("poll-interval", 50),
+	{ }
+};
+
+#define UCB1X00_BTN_PROPS(_idx)						\
+struct property_entry ucb1x00_btn##_idx##_props[] = {			\
+	PROPERTY_ENTRY_U32("linux,code", BTN_0 + (_idx)),		\
+	PROPERTY_ENTRY_GPIO("gpios", &ucb1x00_gpiochip_node,		\
+			    _idx, GPIO_ACTIVE_HIGH),			\
+	PROPERTY_ENTRY_STRING("label", "btn" #_idx),			\
+	PROPERTY_ENTRY_BOOL("linux,can-disable"),			\
+	{ }								\
+}
+
+static const UCB1X00_BTN_PROPS(0);
+static const UCB1X00_BTN_PROPS(1);
+static const UCB1X00_BTN_PROPS(2);
+static const UCB1X00_BTN_PROPS(3);
+static const UCB1X00_BTN_PROPS(4);
+static const UCB1X00_BTN_PROPS(5);
+
+static const struct property_entry * const ucb1x00_btn_props[] = {
+	ucb1x00_btn0_props,
+	ucb1x00_btn1_props,
+	ucb1x00_btn2_props,
+	ucb1x00_btn3_props,
+	ucb1x00_btn4_props,
+	ucb1x00_btn5_props,
+};
+
+struct ucb1x00_assabet_priv {
+	struct platform_device *pdev;
+	struct fwnode_handle *keys_node;
+	struct fwnode_handle *button_nodes[ARRAY_SIZE(ucb1x00_btn_props)];
+};
+
+static void ucb1x00_assabet_remove_nodes(struct ucb1x00_assabet_priv *priv, int n)
+{
+	while (--n >= 0)
+		fwnode_remove_software_node(priv->button_nodes[n]);
+
+	fwnode_remove_software_node(priv->keys_node);
+}
+
 static int ucb1x00_assabet_add(struct ucb1x00_dev *dev)
 {
 	struct ucb1x00 *ucb = dev->ucb;
-	struct platform_device *pdev;
-	struct gpio_keys_platform_data keys;
-	static struct gpio_keys_button buttons[6];
-	unsigned i;
-
-	memset(buttons, 0, sizeof(buttons));
-	memset(&keys, 0, sizeof(keys));
-
-	for (i = 0; i < ARRAY_SIZE(buttons); i++) {
-		buttons[i].code = BTN_0 + i;
-		buttons[i].gpio = ucb->gpio.base + i;
-		buttons[i].type = EV_KEY;
-		buttons[i].can_disable = true;
+	struct platform_device_info pdevinfo = {
+		.name = "gpio-keys",
+		.id = PLATFORM_DEVID_NONE,
+		.parent = &ucb->dev,
+	};
+	int ret;
+	int i;
+
+	struct ucb1x00_assabet_priv *priv;
+
+	priv = kzalloc_obj(*priv, GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	priv->keys_node = fwnode_create_software_node(ucb1x00_gpio_keys_props, NULL);
+	if (IS_ERR(priv->keys_node)) {
+		ret = PTR_ERR(priv->keys_node);
+		goto err_free_priv;
 	}
 
-	keys.buttons = buttons;
-	keys.nbuttons = ARRAY_SIZE(buttons);
-	keys.poll_interval = 50;
-	keys.name = "ucb1x00";
+	for (i = 0; i < ARRAY_SIZE(ucb1x00_btn_props); i++) {
+		priv->button_nodes[i] = fwnode_create_software_node(ucb1x00_btn_props[i],
+								    priv->keys_node);
+		if (IS_ERR(priv->button_nodes[i])) {
+			ret = PTR_ERR(priv->button_nodes[i]);
+			goto err_free_buttons;
+		}
+	}
+
+	pdevinfo.fwnode = priv->keys_node;
 
-	pdev = platform_device_register_data(&ucb->dev, "gpio-keys", -1,
-		&keys, sizeof(keys));
+	priv->pdev = platform_device_register_full(&pdevinfo);
+	ret = PTR_ERR_OR_ZERO(priv->pdev);
+	if (ret)
+		goto err_free_buttons;
 
 	device_create_file(&ucb->dev, &dev_attr_vbatt);
 	device_create_file(&ucb->dev, &dev_attr_vcharger);
 	device_create_file(&ucb->dev, &dev_attr_batt_temp);
 
-	dev->priv = pdev;
+	dev->priv = priv;
 	return 0;
+
+err_free_buttons:
+	ucb1x00_assabet_remove_nodes(priv, i);
+err_free_priv:
+	kfree(priv);
+	return ret;
 }
 
 static void ucb1x00_assabet_remove(struct ucb1x00_dev *dev)
 {
-	struct platform_device *pdev = dev->priv;
+	struct ucb1x00_assabet_priv *priv = dev->priv;
 
-	if (!IS_ERR(pdev))
-		platform_device_unregister(pdev);
+	if (!IS_ERR(priv->pdev))
+		platform_device_unregister(priv->pdev);
+
+	ucb1x00_assabet_remove_nodes(priv, ARRAY_SIZE(priv->button_nodes));
 
 	device_remove_file(&dev->ucb->dev, &dev_attr_batt_temp);
 	device_remove_file(&dev->ucb->dev, &dev_attr_vcharger);
 	device_remove_file(&dev->ucb->dev, &dev_attr_vbatt);
+
+	kfree(priv);
 }
 
 static struct ucb1x00_driver ucb1x00_assabet_driver = {

-- 
2.55.0.rc2.803.g1fd1e6609c-goog


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

* Re: [PATCH v2 0/2] mfd: ucb1x00: Convert Assabet gpio-keys to software nodes
  2026-07-07  5:01 [PATCH v2 0/2] mfd: ucb1x00: Convert Assabet gpio-keys to software nodes Dmitry Torokhov
  2026-07-07  5:01 ` [PATCH v2 1/2] mfd: ucb1x00: Register software node for GPIO controller Dmitry Torokhov
  2026-07-07  5:01 ` [PATCH v2 2/2] mfd: ucb1x00: Convert Assabet gpio-keys to use software nodes Dmitry Torokhov
@ 2026-07-07  8:07 ` Bartosz Golaszewski
  2026-07-16 15:49 ` Lee Jones
  3 siblings, 0 replies; 14+ messages in thread
From: Bartosz Golaszewski @ 2026-07-07  8:07 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: mfd, linux-kernel, Lee Jones, Arnd Bergmann, Bartosz Golaszewski

On Tue, 7 Jul 2026 07:01:29 +0200, Dmitry Torokhov
<dmitry.torokhov@gmail.com> said:
> This patch series converts the legacy gpio-keys platform device on the
> StrongARM SA-1100 Assabet evaluation board from platform data to software
> nodes and device properties.
>
> The first patch registers a shared software node for the UCB1x00 GPIO
> controller in drivers/mfd/ucb1x00-core.c, attaching its firmware node
> directly to the GPIO chip prior to registration. The second patch
> converts the Assabet machine subdriver to define dynamically allocated
> software nodes referencing the UCB1x00 GPIO controller directly, allowing
> pin bindings to be resolved via the attached firmware node without relying
> on name matching.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> Changes in v2:
> - Export ucb1x00_gpiochip_node to fix link errors when built as module.
> - Fix teardown order in core driver to avoid software node use-after-free.
> - Convert Assabet subdriver to use dynamically allocated software nodes
>   to avoid use-after-free on module unload.
> - Factor out button node removal logic into a helper.
> - Link to v1: https://patch.msgid.link/20260706-ucb1x00-assabet-swnode-v1-0-6102eabd31d0@gmail.com
>
> ---
> Dmitry Torokhov (2):
>       mfd: ucb1x00: Register software node for GPIO controller
>       mfd: ucb1x00: Convert Assabet gpio-keys to use software nodes
>
>  drivers/mfd/ucb1x00-assabet.c | 124 +++++++++++++++++++++++++++++++++---------
>  drivers/mfd/ucb1x00-core.c    |  16 +++++-
>  include/linux/mfd/ucb1x00.h   |   3 +
>  3 files changed, 116 insertions(+), 27 deletions(-)
> ---
> base-commit: 8e9685d3c41c35dd1b37df70d854137abcb2fbac
> change-id: 20260705-ucb1x00-assabet-swnode-683cb383d398
>
> Thanks.
>
> --
> Dmitry
>
>

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

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

* Re: [PATCH v2 1/2] mfd: ucb1x00: Register software node for GPIO controller
  2026-07-07  5:01 ` [PATCH v2 1/2] mfd: ucb1x00: Register software node for GPIO controller Dmitry Torokhov
@ 2026-07-07 13:46   ` Arnd Bergmann
  2026-07-16 12:40     ` Lee Jones
  0 siblings, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2026-07-07 13:46 UTC (permalink / raw)
  To: Dmitry Torokhov, Lee Jones, Bartosz Golaszewski; +Cc: mfd, linux-kernel

On Tue, Jul 7, 2026, at 07:01, Dmitry Torokhov wrote:
> Define a static software node for the UCB1x00 GPIO controller and attach
> it to the core MFD device in ucb1x00_probe(). This node will also be
> used by the created GPIO chip.
>
> This allows machine subdrivers (such as Assabet evaluation board
> support) to reference the UCB1x00 GPIO controller in property entries
> when converting legacy platform data to software nodes, resolving pin
> bindings directly via the attached firmware node without relying on
> name matching.
>
> Assisted-by: Antigravity:gemini-3.5-flash
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Acked-by: Arnd Bergmann <arnd@arndb.de>

Assabet should be going away soon, so it really doesn't
matter much.

> +const struct software_node ucb1x00_gpiochip_node = {
> +	.name = "ucb1x00-gpio",
> +};
> +EXPORT_SYMBOL_GPL(ucb1x00_gpiochip_node);

It does feel a bit counterproductive if you have to add more
exported symbols.

> index ede237384723..214c71a12e84 100644
> --- a/include/linux/mfd/ucb1x00.h
> +++ b/include/linux/mfd/ucb1x00.h
> @@ -103,6 +103,9 @@
>  #define UCB_MODE_DYN_VFLAG_ENA	(1 << 12)
>  #define UCB_MODE_AUD_OFF_CAN	(1 << 13)
> 
> +struct software_node;
> +extern const struct software_node ucb1x00_gpiochip_node;

No need for the seperate declaration of the struct tag,
you only need this if the first user is in the argument
list of a function, but not for a global variable.

     Arnd

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

* Re: [PATCH v2 1/2] mfd: ucb1x00: Register software node for GPIO controller
  2026-07-07 13:46   ` Arnd Bergmann
@ 2026-07-16 12:40     ` Lee Jones
  2026-07-16 13:05       ` Arnd Bergmann
  0 siblings, 1 reply; 14+ messages in thread
From: Lee Jones @ 2026-07-16 12:40 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Dmitry Torokhov, Bartosz Golaszewski, mfd, linux-kernel

On Tue, 07 Jul 2026, Arnd Bergmann wrote:

> On Tue, Jul 7, 2026, at 07:01, Dmitry Torokhov wrote:
> > Define a static software node for the UCB1x00 GPIO controller and attach
> > it to the core MFD device in ucb1x00_probe(). This node will also be
> > used by the created GPIO chip.
> >
> > This allows machine subdrivers (such as Assabet evaluation board
> > support) to reference the UCB1x00 GPIO controller in property entries
> > when converting legacy platform data to software nodes, resolving pin
> > bindings directly via the attached firmware node without relying on
> > name matching.
> >
> > Assisted-by: Antigravity:gemini-3.5-flash
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> 
> Assabet should be going away soon, so it really doesn't
> matter much.
> 
> > +const struct software_node ucb1x00_gpiochip_node = {
> > +	.name = "ucb1x00-gpio",
> > +};
> > +EXPORT_SYMBOL_GPL(ucb1x00_gpiochip_node);
> 
> It does feel a bit counterproductive if you have to add more
> exported symbols.
> 
> > index ede237384723..214c71a12e84 100644
> > --- a/include/linux/mfd/ucb1x00.h
> > +++ b/include/linux/mfd/ucb1x00.h
> > @@ -103,6 +103,9 @@
> >  #define UCB_MODE_DYN_VFLAG_ENA	(1 << 12)
> >  #define UCB_MODE_AUD_OFF_CAN	(1 << 13)
> > 
> > +struct software_node;
> > +extern const struct software_node ucb1x00_gpiochip_node;
> 
> No need for the seperate declaration of the struct tag,
> you only need this if the first user is in the argument
> list of a function, but not for a global variable.

Are you planning on fixing these review comments, Dmitry?

-- 
Lee Jones

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

* Re: [PATCH v2 1/2] mfd: ucb1x00: Register software node for GPIO controller
  2026-07-16 12:40     ` Lee Jones
@ 2026-07-16 13:05       ` Arnd Bergmann
  2026-07-16 14:00         ` Lee Jones
  0 siblings, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2026-07-16 13:05 UTC (permalink / raw)
  To: Lee Jones; +Cc: Dmitry Torokhov, Bartosz Golaszewski, mfd, linux-kernel

On Thu, Jul 16, 2026, at 14:40, Lee Jones wrote:
> On Tue, 07 Jul 2026, Arnd Bergmann wrote:
>
>> On Tue, Jul 7, 2026, at 07:01, Dmitry Torokhov wrote:
>> > Define a static software node for the UCB1x00 GPIO controller and attach
>> > it to the core MFD device in ucb1x00_probe(). This node will also be
>> > used by the created GPIO chip.
>> >
>> > This allows machine subdrivers (such as Assabet evaluation board
>> > support) to reference the UCB1x00 GPIO controller in property entries
>> > when converting legacy platform data to software nodes, resolving pin
>> > bindings directly via the attached firmware node without relying on
>> > name matching.
>> >
>> > Assisted-by: Antigravity:gemini-3.5-flash
>> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>> 
>> Acked-by: Arnd Bergmann <arnd@arndb.de>
>> 
>> Assabet should be going away soon, so it really doesn't
>> matter much.

>> > +EXPORT_SYMBOL_GPL(ucb1x00_gpiochip_node);
>> 
>> It does feel a bit counterproductive if you have to add more
>> exported symbols.
 
>> No need for the seperate declaration of the struct tag,
>> you only need this if the first user is in the argument
>> list of a function, but not for a global variable.
>
> Are you planning on fixing these review comments, Dmitry?

Just to clarify, I was not asking for anything to be changed
in this patch, just observing. I'm fine with this version
getting applied as-is. As I said, the file is probably
going away soon, so let's just make sure it's not getting
in the way until then.

     Arnd

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

* Re: [PATCH v2 2/2] mfd: ucb1x00: Convert Assabet gpio-keys to use software nodes
  2026-07-07  5:01 ` [PATCH v2 2/2] mfd: ucb1x00: Convert Assabet gpio-keys to use software nodes Dmitry Torokhov
@ 2026-07-16 13:06   ` Lee Jones
  2026-07-16 15:15     ` Dmitry Torokhov
  0 siblings, 1 reply; 14+ messages in thread
From: Lee Jones @ 2026-07-16 13:06 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Arnd Bergmann, Bartosz Golaszewski, mfd, linux-kernel

On Mon, 06 Jul 2026, Dmitry Torokhov wrote:

> Convert the legacy gpio-keys platform device on the StrongARM SA-1100
> Assabet evaluation board to use software nodes and device properties.
> This allows describing the buttons and their GPIO bindings via software
> nodes so that platform data support can eventually be removed from the
> gpio-keys driver.
> 
> Define static software nodes for the gpio-keys device and the six button
> child nodes at file scope using relative pin indexing on the UCB1x00 GPIO
> controller node. In ucb1x00_assabet_add(), register the software node
> group and use platform_device_register_full() to register the device.
> 
> Assisted-by: Antigravity:gemini-3.5-flash
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  drivers/mfd/ucb1x00-assabet.c | 124 +++++++++++++++++++++++++++++++++---------
>  1 file changed, 98 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/mfd/ucb1x00-assabet.c b/drivers/mfd/ucb1x00-assabet.c
> index 6a389737c615..ee49ac779d1a 100644
> --- a/drivers/mfd/ucb1x00-assabet.c
> +++ b/drivers/mfd/ucb1x00-assabet.c
> @@ -6,15 +6,18 @@
>   *
>   *  We handle the machine-specific bits of the UCB1x00 driver here.
>   */
> -#include <linux/module.h>
> -#include <linux/init.h>
>  #include <linux/device.h>
>  #include <linux/err.h>
>  #include <linux/fs.h>
> -#include <linux/gpio_keys.h>
> +#include <linux/gpio/machine.h>
> +#include <linux/gpio/property.h>
> +#include <linux/init.h>
>  #include <linux/input.h>
> +#include <linux/module.h>
>  #include <linux/platform_device.h>
>  #include <linux/proc_fs.h>
> +#include <linux/property.h>
> +#include <linux/slab.h>
>  #include <linux/mfd/ucb1x00.h>

Should 'linux/mfd/ucb1x00.h' be sorted alphabetically along with the other
header inclusions (e.g. placed before 'linux/module.h')?

>  
>  #define UCB1X00_ATTR(name,input)\
> @@ -34,50 +37,119 @@ UCB1X00_ATTR(vbatt, UCB_ADC_INP_AD1);
>  UCB1X00_ATTR(vcharger, UCB_ADC_INP_AD0);
>  UCB1X00_ATTR(batt_temp, UCB_ADC_INP_AD2);
>  
> +static const struct property_entry ucb1x00_gpio_keys_props[] = {
> +	PROPERTY_ENTRY_STRING("label", "ucb1x00"),
> +	PROPERTY_ENTRY_U32("poll-interval", 50),
> +	{ }
> +};
> +
> +#define UCB1X00_BTN_PROPS(_idx)						\
> +struct property_entry ucb1x00_btn##_idx##_props[] = {			\
> +	PROPERTY_ENTRY_U32("linux,code", BTN_0 + (_idx)),		\
> +	PROPERTY_ENTRY_GPIO("gpios", &ucb1x00_gpiochip_node,		\

Where is 'ucb1x00_gpiochip_node' defined or declared? Should we add an 'extern'
declaration or include the relevant header to prevent build errors?

> +			    _idx, GPIO_ACTIVE_HIGH),			\
> +	PROPERTY_ENTRY_STRING("label", "btn" #_idx),			\
> +	PROPERTY_ENTRY_BOOL("linux,can-disable"),			\
> +	{ }								\
> +}
> +
> +static const UCB1X00_BTN_PROPS(0);
> +static const UCB1X00_BTN_PROPS(1);
> +static const UCB1X00_BTN_PROPS(2);
> +static const UCB1X00_BTN_PROPS(3);
> +static const UCB1X00_BTN_PROPS(4);
> +static const UCB1X00_BTN_PROPS(5);
> +
> +static const struct property_entry * const ucb1x00_btn_props[] = {
> +	ucb1x00_btn0_props,
> +	ucb1x00_btn1_props,
> +	ucb1x00_btn2_props,
> +	ucb1x00_btn3_props,
> +	ucb1x00_btn4_props,
> +	ucb1x00_btn5_props,
> +};
> +
> +struct ucb1x00_assabet_priv {
> +	struct platform_device *pdev;
> +	struct fwnode_handle *keys_node;
> +	struct fwnode_handle *button_nodes[ARRAY_SIZE(ucb1x00_btn_props)];
> +};
> +
> +static void ucb1x00_assabet_remove_nodes(struct ucb1x00_assabet_priv *priv, int n)
> +{
> +	while (--n >= 0)
> +		fwnode_remove_software_node(priv->button_nodes[n]);
> +
> +	fwnode_remove_software_node(priv->keys_node);
> +}
> +
>  static int ucb1x00_assabet_add(struct ucb1x00_dev *dev)
>  {
>  	struct ucb1x00 *ucb = dev->ucb;
> -	struct platform_device *pdev;
> -	struct gpio_keys_platform_data keys;
> -	static struct gpio_keys_button buttons[6];
> -	unsigned i;
> -
> -	memset(buttons, 0, sizeof(buttons));
> -	memset(&keys, 0, sizeof(keys));
> -
> -	for (i = 0; i < ARRAY_SIZE(buttons); i++) {
> -		buttons[i].code = BTN_0 + i;
> -		buttons[i].gpio = ucb->gpio.base + i;
> -		buttons[i].type = EV_KEY;
> -		buttons[i].can_disable = true;
> +	struct platform_device_info pdevinfo = {
> +		.name = "gpio-keys",
> +		.id = PLATFORM_DEVID_NONE,
> +		.parent = &ucb->dev,
> +	};
> +	int ret;
> +	int i;

Nit: If you re-work this, please declare inside the if ().

> +
> +	struct ucb1x00_assabet_priv *priv;
> +
> +	priv = kzalloc_obj(*priv, GFP_KERNEL);

Why _obj() here instead of the usual candidates?

What about devm_*?

> +	if (!priv)
> +		return -ENOMEM;
> +
> +	priv->keys_node = fwnode_create_software_node(ucb1x00_gpio_keys_props, NULL);
> +	if (IS_ERR(priv->keys_node)) {
> +		ret = PTR_ERR(priv->keys_node);
> +		goto err_free_priv;
>  	}
>  
> -	keys.buttons = buttons;
> -	keys.nbuttons = ARRAY_SIZE(buttons);
> -	keys.poll_interval = 50;
> -	keys.name = "ucb1x00";
> +	for (i = 0; i < ARRAY_SIZE(ucb1x00_btn_props); i++) {
> +		priv->button_nodes[i] = fwnode_create_software_node(ucb1x00_btn_props[i],
> +								    priv->keys_node);
> +		if (IS_ERR(priv->button_nodes[i])) {
> +			ret = PTR_ERR(priv->button_nodes[i]);
> +			goto err_free_buttons;
> +		}
> +	}
> +
> +	pdevinfo.fwnode = priv->keys_node;
>  
> -	pdev = platform_device_register_data(&ucb->dev, "gpio-keys", -1,
> -		&keys, sizeof(keys));
> +	priv->pdev = platform_device_register_full(&pdevinfo);
> +	ret = PTR_ERR_OR_ZERO(priv->pdev);
> +	if (ret)
> +		goto err_free_buttons;
>  
>  	device_create_file(&ucb->dev, &dev_attr_vbatt);
>  	device_create_file(&ucb->dev, &dev_attr_vcharger);
>  	device_create_file(&ucb->dev, &dev_attr_batt_temp);
>  
> -	dev->priv = pdev;
> +	dev->priv = priv;
>  	return 0;
> +
> +err_free_buttons:
> +	ucb1x00_assabet_remove_nodes(priv, i);
> +err_free_priv:
> +	kfree(priv);
> +	return ret;
>  }
>  
>  static void ucb1x00_assabet_remove(struct ucb1x00_dev *dev)
>  {
> -	struct platform_device *pdev = dev->priv;
> +	struct ucb1x00_assabet_priv *priv = dev->priv;
>  
> -	if (!IS_ERR(pdev))
> -		platform_device_unregister(pdev);
> +	if (!IS_ERR(priv->pdev))
> +		platform_device_unregister(priv->pdev);
> +
> +	ucb1x00_assabet_remove_nodes(priv, ARRAY_SIZE(priv->button_nodes));
>  
>  	device_remove_file(&dev->ucb->dev, &dev_attr_batt_temp);
>  	device_remove_file(&dev->ucb->dev, &dev_attr_vcharger);
>  	device_remove_file(&dev->ucb->dev, &dev_attr_vbatt);
> +
> +	kfree(priv);
>  }
>  
>  static struct ucb1x00_driver ucb1x00_assabet_driver = {
> 
> -- 
> 2.55.0.rc2.803.g1fd1e6609c-goog
> 

-- 
Lee Jones

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

* Re: [PATCH v2 1/2] mfd: ucb1x00: Register software node for GPIO controller
  2026-07-16 13:05       ` Arnd Bergmann
@ 2026-07-16 14:00         ` Lee Jones
  2026-07-16 15:06           ` Dmitry Torokhov
  0 siblings, 1 reply; 14+ messages in thread
From: Lee Jones @ 2026-07-16 14:00 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Dmitry Torokhov, Bartosz Golaszewski, mfd, linux-kernel

On Thu, 16 Jul 2026, Arnd Bergmann wrote:

> On Thu, Jul 16, 2026, at 14:40, Lee Jones wrote:
> > On Tue, 07 Jul 2026, Arnd Bergmann wrote:
> >
> >> On Tue, Jul 7, 2026, at 07:01, Dmitry Torokhov wrote:
> >> > Define a static software node for the UCB1x00 GPIO controller and attach
> >> > it to the core MFD device in ucb1x00_probe(). This node will also be
> >> > used by the created GPIO chip.
> >> >
> >> > This allows machine subdrivers (such as Assabet evaluation board
> >> > support) to reference the UCB1x00 GPIO controller in property entries
> >> > when converting legacy platform data to software nodes, resolving pin
> >> > bindings directly via the attached firmware node without relying on
> >> > name matching.
> >> >
> >> > Assisted-by: Antigravity:gemini-3.5-flash
> >> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> >> 
> >> Acked-by: Arnd Bergmann <arnd@arndb.de>
> >> 
> >> Assabet should be going away soon, so it really doesn't
> >> matter much.
> 
> >> > +EXPORT_SYMBOL_GPL(ucb1x00_gpiochip_node);
> >> 
> >> It does feel a bit counterproductive if you have to add more
> >> exported symbols.
>  
> >> No need for the seperate declaration of the struct tag,
> >> you only need this if the first user is in the argument
> >> list of a function, but not for a global variable.
> >
> > Are you planning on fixing these review comments, Dmitry?
> 
> Just to clarify, I was not asking for anything to be changed
> in this patch, just observing. I'm fine with this version
> getting applied as-is. As I said, the file is probably
> going away soon, so let's just make sure it's not getting
> in the way until then.

The 2 comments above sure look like review comments.

-- 
Lee Jones

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

* Re: [PATCH v2 1/2] mfd: ucb1x00: Register software node for GPIO controller
  2026-07-16 14:00         ` Lee Jones
@ 2026-07-16 15:06           ` Dmitry Torokhov
  2026-07-16 15:49             ` Lee Jones
  0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Torokhov @ 2026-07-16 15:06 UTC (permalink / raw)
  To: Lee Jones; +Cc: Arnd Bergmann, Bartosz Golaszewski, mfd, linux-kernel

On Thu, Jul 16, 2026 at 03:00:27PM +0100, Lee Jones wrote:
> On Thu, 16 Jul 2026, Arnd Bergmann wrote:
> 
> > On Thu, Jul 16, 2026, at 14:40, Lee Jones wrote:
> > > On Tue, 07 Jul 2026, Arnd Bergmann wrote:
> > >
> > >> On Tue, Jul 7, 2026, at 07:01, Dmitry Torokhov wrote:
> > >> > Define a static software node for the UCB1x00 GPIO controller and attach
> > >> > it to the core MFD device in ucb1x00_probe(). This node will also be
> > >> > used by the created GPIO chip.
> > >> >
> > >> > This allows machine subdrivers (such as Assabet evaluation board
> > >> > support) to reference the UCB1x00 GPIO controller in property entries
> > >> > when converting legacy platform data to software nodes, resolving pin
> > >> > bindings directly via the attached firmware node without relying on
> > >> > name matching.
> > >> >
> > >> > Assisted-by: Antigravity:gemini-3.5-flash
> > >> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > >> 
> > >> Acked-by: Arnd Bergmann <arnd@arndb.de>
> > >> 
> > >> Assabet should be going away soon, so it really doesn't
> > >> matter much.
> > 
> > >> > +EXPORT_SYMBOL_GPL(ucb1x00_gpiochip_node);
> > >> 
> > >> It does feel a bit counterproductive if you have to add more
> > >> exported symbols.

Just FTR: I completely agree. However Bartosz is dead set on not
supporting weaker references based on name matching and wants only
identity matching. So we export bunch of stuff and pay for this with 
tighter coupling and potential changes in load order.

> >  
> > >> No need for the seperate declaration of the struct tag,
> > >> you only need this if the first user is in the argument
> > >> list of a function, but not for a global variable.
> > >
> > > Are you planning on fixing these review comments, Dmitry?
> > 
> > Just to clarify, I was not asking for anything to be changed
> > in this patch, just observing. I'm fine with this version
> > getting applied as-is. As I said, the file is probably
> > going away soon, so let's just make sure it's not getting
> > in the way until then.
> 
> The 2 comments above sure look like review comments.
> 

Well, if this all truly goes away in 7.4 there is no much point in
polishing this.

Thanks.

-- 
Dmitry

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

* Re: [PATCH v2 2/2] mfd: ucb1x00: Convert Assabet gpio-keys to use software nodes
  2026-07-16 13:06   ` Lee Jones
@ 2026-07-16 15:15     ` Dmitry Torokhov
  2026-07-16 15:48       ` Lee Jones
  0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Torokhov @ 2026-07-16 15:15 UTC (permalink / raw)
  To: Lee Jones; +Cc: Arnd Bergmann, Bartosz Golaszewski, mfd, linux-kernel

On Thu, Jul 16, 2026 at 02:06:04PM +0100, Lee Jones wrote:
> On Mon, 06 Jul 2026, Dmitry Torokhov wrote:
> 
> > Convert the legacy gpio-keys platform device on the StrongARM SA-1100
> > Assabet evaluation board to use software nodes and device properties.
> > This allows describing the buttons and their GPIO bindings via software
> > nodes so that platform data support can eventually be removed from the
> > gpio-keys driver.
> > 
> > Define static software nodes for the gpio-keys device and the six button
> > child nodes at file scope using relative pin indexing on the UCB1x00 GPIO
> > controller node. In ucb1x00_assabet_add(), register the software node
> > group and use platform_device_register_full() to register the device.
> > 
> > Assisted-by: Antigravity:gemini-3.5-flash
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > ---
> >  drivers/mfd/ucb1x00-assabet.c | 124 +++++++++++++++++++++++++++++++++---------
> >  1 file changed, 98 insertions(+), 26 deletions(-)
> > 
> > diff --git a/drivers/mfd/ucb1x00-assabet.c b/drivers/mfd/ucb1x00-assabet.c
> > index 6a389737c615..ee49ac779d1a 100644
> > --- a/drivers/mfd/ucb1x00-assabet.c
> > +++ b/drivers/mfd/ucb1x00-assabet.c
> > @@ -6,15 +6,18 @@
> >   *
> >   *  We handle the machine-specific bits of the UCB1x00 driver here.
> >   */
> > -#include <linux/module.h>
> > -#include <linux/init.h>
> >  #include <linux/device.h>
> >  #include <linux/err.h>
> >  #include <linux/fs.h>
> > -#include <linux/gpio_keys.h>
> > +#include <linux/gpio/machine.h>
> > +#include <linux/gpio/property.h>
> > +#include <linux/init.h>
> >  #include <linux/input.h>
> > +#include <linux/module.h>
> >  #include <linux/platform_device.h>
> >  #include <linux/proc_fs.h>
> > +#include <linux/property.h>
> > +#include <linux/slab.h>
> >  #include <linux/mfd/ucb1x00.h>
> 
> Should 'linux/mfd/ucb1x00.h' be sorted alphabetically along with the other
> header inclusions (e.g. placed before 'linux/module.h')?

Maybe, but I did not add it here...

> 
> >  
> >  #define UCB1X00_ATTR(name,input)\
> > @@ -34,50 +37,119 @@ UCB1X00_ATTR(vbatt, UCB_ADC_INP_AD1);
> >  UCB1X00_ATTR(vcharger, UCB_ADC_INP_AD0);
> >  UCB1X00_ATTR(batt_temp, UCB_ADC_INP_AD2);
> >  
> > +static const struct property_entry ucb1x00_gpio_keys_props[] = {
> > +	PROPERTY_ENTRY_STRING("label", "ucb1x00"),
> > +	PROPERTY_ENTRY_U32("poll-interval", 50),
> > +	{ }
> > +};
> > +
> > +#define UCB1X00_BTN_PROPS(_idx)						\
> > +struct property_entry ucb1x00_btn##_idx##_props[] = {			\
> > +	PROPERTY_ENTRY_U32("linux,code", BTN_0 + (_idx)),		\
> > +	PROPERTY_ENTRY_GPIO("gpios", &ucb1x00_gpiochip_node,		\
> 
> Where is 'ucb1x00_gpiochip_node' defined or declared? Should we add an 'extern'
> declaration or include the relevant header to prevent build errors?

We did. It is introduced in the previous patch and is declared in
linux/mfd/ucb1x00.h

> 
> > +			    _idx, GPIO_ACTIVE_HIGH),			\
> > +	PROPERTY_ENTRY_STRING("label", "btn" #_idx),			\
> > +	PROPERTY_ENTRY_BOOL("linux,can-disable"),			\
> > +	{ }								\
> > +}
> > +
> > +static const UCB1X00_BTN_PROPS(0);
> > +static const UCB1X00_BTN_PROPS(1);
> > +static const UCB1X00_BTN_PROPS(2);
> > +static const UCB1X00_BTN_PROPS(3);
> > +static const UCB1X00_BTN_PROPS(4);
> > +static const UCB1X00_BTN_PROPS(5);
> > +
> > +static const struct property_entry * const ucb1x00_btn_props[] = {
> > +	ucb1x00_btn0_props,
> > +	ucb1x00_btn1_props,
> > +	ucb1x00_btn2_props,
> > +	ucb1x00_btn3_props,
> > +	ucb1x00_btn4_props,
> > +	ucb1x00_btn5_props,
> > +};
> > +
> > +struct ucb1x00_assabet_priv {
> > +	struct platform_device *pdev;
> > +	struct fwnode_handle *keys_node;
> > +	struct fwnode_handle *button_nodes[ARRAY_SIZE(ucb1x00_btn_props)];
> > +};
> > +
> > +static void ucb1x00_assabet_remove_nodes(struct ucb1x00_assabet_priv *priv, int n)
> > +{
> > +	while (--n >= 0)
> > +		fwnode_remove_software_node(priv->button_nodes[n]);
> > +
> > +	fwnode_remove_software_node(priv->keys_node);
> > +}
> > +
> >  static int ucb1x00_assabet_add(struct ucb1x00_dev *dev)
> >  {
> >  	struct ucb1x00 *ucb = dev->ucb;
> > -	struct platform_device *pdev;
> > -	struct gpio_keys_platform_data keys;
> > -	static struct gpio_keys_button buttons[6];
> > -	unsigned i;
> > -
> > -	memset(buttons, 0, sizeof(buttons));
> > -	memset(&keys, 0, sizeof(keys));
> > -
> > -	for (i = 0; i < ARRAY_SIZE(buttons); i++) {
> > -		buttons[i].code = BTN_0 + i;
> > -		buttons[i].gpio = ucb->gpio.base + i;
> > -		buttons[i].type = EV_KEY;
> > -		buttons[i].can_disable = true;
> > +	struct platform_device_info pdevinfo = {
> > +		.name = "gpio-keys",
> > +		.id = PLATFORM_DEVID_NONE,
> > +		.parent = &ucb->dev,
> > +	};
> > +	int ret;
> > +	int i;
> 
> Nit: If you re-work this, please declare inside the if ().

You man inside "for ()"?

> 
> > +
> > +	struct ucb1x00_assabet_priv *priv;
> > +
> > +	priv = kzalloc_obj(*priv, GFP_KERNEL);
> 
> Why _obj() here instead of the usual candidates?
> 
> What about devm_*?

This is not a driver in the sense of device core driver, so devm would
not work.

Thanks.

-- 
Dmitry

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

* Re: [PATCH v2 2/2] mfd: ucb1x00: Convert Assabet gpio-keys to use software nodes
  2026-07-16 15:15     ` Dmitry Torokhov
@ 2026-07-16 15:48       ` Lee Jones
  0 siblings, 0 replies; 14+ messages in thread
From: Lee Jones @ 2026-07-16 15:48 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Arnd Bergmann, Bartosz Golaszewski, mfd, linux-kernel

On Thu, 16 Jul 2026, Dmitry Torokhov wrote:

> On Thu, Jul 16, 2026 at 02:06:04PM +0100, Lee Jones wrote:
> > On Mon, 06 Jul 2026, Dmitry Torokhov wrote:
> > 
> > > Convert the legacy gpio-keys platform device on the StrongARM SA-1100
> > > Assabet evaluation board to use software nodes and device properties.
> > > This allows describing the buttons and their GPIO bindings via software
> > > nodes so that platform data support can eventually be removed from the
> > > gpio-keys driver.
> > > 
> > > Define static software nodes for the gpio-keys device and the six button
> > > child nodes at file scope using relative pin indexing on the UCB1x00 GPIO
> > > controller node. In ucb1x00_assabet_add(), register the software node
> > > group and use platform_device_register_full() to register the device.
> > > 
> > > Assisted-by: Antigravity:gemini-3.5-flash
> > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > > ---
> > >  drivers/mfd/ucb1x00-assabet.c | 124 +++++++++++++++++++++++++++++++++---------
> > >  1 file changed, 98 insertions(+), 26 deletions(-)
> > > 
> > > diff --git a/drivers/mfd/ucb1x00-assabet.c b/drivers/mfd/ucb1x00-assabet.c
> > > index 6a389737c615..ee49ac779d1a 100644
> > > --- a/drivers/mfd/ucb1x00-assabet.c
> > > +++ b/drivers/mfd/ucb1x00-assabet.c
> > > @@ -6,15 +6,18 @@
> > >   *
> > >   *  We handle the machine-specific bits of the UCB1x00 driver here.
> > >   */
> > > -#include <linux/module.h>
> > > -#include <linux/init.h>
> > >  #include <linux/device.h>
> > >  #include <linux/err.h>
> > >  #include <linux/fs.h>
> > > -#include <linux/gpio_keys.h>
> > > +#include <linux/gpio/machine.h>
> > > +#include <linux/gpio/property.h>
> > > +#include <linux/init.h>
> > >  #include <linux/input.h>
> > > +#include <linux/module.h>
> > >  #include <linux/platform_device.h>
> > >  #include <linux/proc_fs.h>
> > > +#include <linux/property.h>
> > > +#include <linux/slab.h>
> > >  #include <linux/mfd/ucb1x00.h>
> > 
> > Should 'linux/mfd/ucb1x00.h' be sorted alphabetically along with the other
> > header inclusions (e.g. placed before 'linux/module.h')?
> 
> Maybe, but I did not add it here...
> 
> > 
> > >  
> > >  #define UCB1X00_ATTR(name,input)\
> > > @@ -34,50 +37,119 @@ UCB1X00_ATTR(vbatt, UCB_ADC_INP_AD1);
> > >  UCB1X00_ATTR(vcharger, UCB_ADC_INP_AD0);
> > >  UCB1X00_ATTR(batt_temp, UCB_ADC_INP_AD2);
> > >  
> > > +static const struct property_entry ucb1x00_gpio_keys_props[] = {
> > > +	PROPERTY_ENTRY_STRING("label", "ucb1x00"),
> > > +	PROPERTY_ENTRY_U32("poll-interval", 50),
> > > +	{ }
> > > +};
> > > +
> > > +#define UCB1X00_BTN_PROPS(_idx)						\
> > > +struct property_entry ucb1x00_btn##_idx##_props[] = {			\
> > > +	PROPERTY_ENTRY_U32("linux,code", BTN_0 + (_idx)),		\
> > > +	PROPERTY_ENTRY_GPIO("gpios", &ucb1x00_gpiochip_node,		\
> > 
> > Where is 'ucb1x00_gpiochip_node' defined or declared? Should we add an 'extern'
> > declaration or include the relevant header to prevent build errors?
> 
> We did. It is introduced in the previous patch and is declared in
> linux/mfd/ucb1x00.h

Ignore the two above - they were "assisted" and I forgot to tear them out.

> > > +			    _idx, GPIO_ACTIVE_HIGH),			\
> > > +	PROPERTY_ENTRY_STRING("label", "btn" #_idx),			\
> > > +	PROPERTY_ENTRY_BOOL("linux,can-disable"),			\
> > > +	{ }								\
> > > +}
> > > +
> > > +static const UCB1X00_BTN_PROPS(0);
> > > +static const UCB1X00_BTN_PROPS(1);
> > > +static const UCB1X00_BTN_PROPS(2);
> > > +static const UCB1X00_BTN_PROPS(3);
> > > +static const UCB1X00_BTN_PROPS(4);
> > > +static const UCB1X00_BTN_PROPS(5);
> > > +
> > > +static const struct property_entry * const ucb1x00_btn_props[] = {
> > > +	ucb1x00_btn0_props,
> > > +	ucb1x00_btn1_props,
> > > +	ucb1x00_btn2_props,
> > > +	ucb1x00_btn3_props,
> > > +	ucb1x00_btn4_props,
> > > +	ucb1x00_btn5_props,
> > > +};
> > > +
> > > +struct ucb1x00_assabet_priv {
> > > +	struct platform_device *pdev;
> > > +	struct fwnode_handle *keys_node;
> > > +	struct fwnode_handle *button_nodes[ARRAY_SIZE(ucb1x00_btn_props)];
> > > +};
> > > +
> > > +static void ucb1x00_assabet_remove_nodes(struct ucb1x00_assabet_priv *priv, int n)
> > > +{
> > > +	while (--n >= 0)
> > > +		fwnode_remove_software_node(priv->button_nodes[n]);
> > > +
> > > +	fwnode_remove_software_node(priv->keys_node);
> > > +}
> > > +
> > >  static int ucb1x00_assabet_add(struct ucb1x00_dev *dev)
> > >  {
> > >  	struct ucb1x00 *ucb = dev->ucb;
> > > -	struct platform_device *pdev;
> > > -	struct gpio_keys_platform_data keys;
> > > -	static struct gpio_keys_button buttons[6];
> > > -	unsigned i;
> > > -
> > > -	memset(buttons, 0, sizeof(buttons));
> > > -	memset(&keys, 0, sizeof(keys));
> > > -
> > > -	for (i = 0; i < ARRAY_SIZE(buttons); i++) {
> > > -		buttons[i].code = BTN_0 + i;
> > > -		buttons[i].gpio = ucb->gpio.base + i;
> > > -		buttons[i].type = EV_KEY;
> > > -		buttons[i].can_disable = true;
> > > +	struct platform_device_info pdevinfo = {
> > > +		.name = "gpio-keys",
> > > +		.id = PLATFORM_DEVID_NONE,
> > > +		.parent = &ucb->dev,
> > > +	};
> > > +	int ret;
> > > +	int i;
> > 
> > Nit: If you re-work this, please declare inside the if ().
> 
> You man inside "for ()"?

Yes, for (), sorry, long day!

> > 
> > > +
> > > +	struct ucb1x00_assabet_priv *priv;
> > > +
> > > +	priv = kzalloc_obj(*priv, GFP_KERNEL);
> > 
> > Why _obj() here instead of the usual candidates?
> > 
> > What about devm_*?
> 
> This is not a driver in the sense of device core driver, so devm would
> not work.

Oh, I see now (just went and read through the history).  So this isn't
an MFD at all.  It should probably be converted to MFD or moved out at
one point then.

-- 
Lee Jones

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

* Re: [PATCH v2 1/2] mfd: ucb1x00: Register software node for GPIO controller
  2026-07-16 15:06           ` Dmitry Torokhov
@ 2026-07-16 15:49             ` Lee Jones
  0 siblings, 0 replies; 14+ messages in thread
From: Lee Jones @ 2026-07-16 15:49 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Arnd Bergmann, Bartosz Golaszewski, mfd, linux-kernel

On Thu, 16 Jul 2026, Dmitry Torokhov wrote:

> On Thu, Jul 16, 2026 at 03:00:27PM +0100, Lee Jones wrote:
> > On Thu, 16 Jul 2026, Arnd Bergmann wrote:
> > 
> > > On Thu, Jul 16, 2026, at 14:40, Lee Jones wrote:
> > > > On Tue, 07 Jul 2026, Arnd Bergmann wrote:
> > > >
> > > >> On Tue, Jul 7, 2026, at 07:01, Dmitry Torokhov wrote:
> > > >> > Define a static software node for the UCB1x00 GPIO controller and attach
> > > >> > it to the core MFD device in ucb1x00_probe(). This node will also be
> > > >> > used by the created GPIO chip.
> > > >> >
> > > >> > This allows machine subdrivers (such as Assabet evaluation board
> > > >> > support) to reference the UCB1x00 GPIO controller in property entries
> > > >> > when converting legacy platform data to software nodes, resolving pin
> > > >> > bindings directly via the attached firmware node without relying on
> > > >> > name matching.
> > > >> >
> > > >> > Assisted-by: Antigravity:gemini-3.5-flash
> > > >> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > > >> 
> > > >> Acked-by: Arnd Bergmann <arnd@arndb.de>
> > > >> 
> > > >> Assabet should be going away soon, so it really doesn't
> > > >> matter much.
> > > 
> > > >> > +EXPORT_SYMBOL_GPL(ucb1x00_gpiochip_node);
> > > >> 
> > > >> It does feel a bit counterproductive if you have to add more
> > > >> exported symbols.
> 
> Just FTR: I completely agree. However Bartosz is dead set on not
> supporting weaker references based on name matching and wants only
> identity matching. So we export bunch of stuff and pay for this with 
> tighter coupling and potential changes in load order.
> 
> > >  
> > > >> No need for the seperate declaration of the struct tag,
> > > >> you only need this if the first user is in the argument
> > > >> list of a function, but not for a global variable.
> > > >
> > > > Are you planning on fixing these review comments, Dmitry?
> > > 
> > > Just to clarify, I was not asking for anything to be changed
> > > in this patch, just observing. I'm fine with this version
> > > getting applied as-is. As I said, the file is probably
> > > going away soon, so let's just make sure it's not getting
> > > in the way until then.
> > 
> > The 2 comments above sure look like review comments.
> > 
> 
> Well, if this all truly goes away in 7.4 there is no much point in
> polishing this.

You can have the creds anyway!

-- 
Lee Jones

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

* Re: [PATCH v2 0/2] mfd: ucb1x00: Convert Assabet gpio-keys to software nodes
  2026-07-07  5:01 [PATCH v2 0/2] mfd: ucb1x00: Convert Assabet gpio-keys to software nodes Dmitry Torokhov
                   ` (2 preceding siblings ...)
  2026-07-07  8:07 ` [PATCH v2 0/2] mfd: ucb1x00: Convert Assabet gpio-keys to " Bartosz Golaszewski
@ 2026-07-16 15:49 ` Lee Jones
  3 siblings, 0 replies; 14+ messages in thread
From: Lee Jones @ 2026-07-16 15:49 UTC (permalink / raw)
  To: Lee Jones, Arnd Bergmann, Bartosz Golaszewski, Dmitry Torokhov
  Cc: mfd, linux-kernel

On Mon, 06 Jul 2026 22:01:29 -0700, Dmitry Torokhov wrote:
> This patch series converts the legacy gpio-keys platform device on the
> StrongARM SA-1100 Assabet evaluation board from platform data to software
> nodes and device properties.
> 
> The first patch registers a shared software node for the UCB1x00 GPIO
> controller in drivers/mfd/ucb1x00-core.c, attaching its firmware node
> directly to the GPIO chip prior to registration. The second patch
> converts the Assabet machine subdriver to define dynamically allocated
> software nodes referencing the UCB1x00 GPIO controller directly, allowing
> pin bindings to be resolved via the attached firmware node without relying
> on name matching.
> 
> [...]

Applied, thanks!

[1/2] mfd: ucb1x00: Register software node for GPIO controller
      commit: ded1b7daab756ab61f5f6f0a3ed7465a106fb60c
[2/2] mfd: ucb1x00: Convert Assabet gpio-keys to use software nodes
      commit: 3a162eca527feb80856da0ab32972d677210237b

--
Lee Jones [李琼斯]


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

end of thread, other threads:[~2026-07-16 15:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-07  5:01 [PATCH v2 0/2] mfd: ucb1x00: Convert Assabet gpio-keys to software nodes Dmitry Torokhov
2026-07-07  5:01 ` [PATCH v2 1/2] mfd: ucb1x00: Register software node for GPIO controller Dmitry Torokhov
2026-07-07 13:46   ` Arnd Bergmann
2026-07-16 12:40     ` Lee Jones
2026-07-16 13:05       ` Arnd Bergmann
2026-07-16 14:00         ` Lee Jones
2026-07-16 15:06           ` Dmitry Torokhov
2026-07-16 15:49             ` Lee Jones
2026-07-07  5:01 ` [PATCH v2 2/2] mfd: ucb1x00: Convert Assabet gpio-keys to use software nodes Dmitry Torokhov
2026-07-16 13:06   ` Lee Jones
2026-07-16 15:15     ` Dmitry Torokhov
2026-07-16 15:48       ` Lee Jones
2026-07-07  8:07 ` [PATCH v2 0/2] mfd: ucb1x00: Convert Assabet gpio-keys to " Bartosz Golaszewski
2026-07-16 15:49 ` Lee Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.