public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	 Daniel Scally <djrscally@gmail.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	 Sakari Ailus <sakari.ailus@linux.intel.com>,
	Bartosz Golaszewski <brgl@kernel.org>,
	 Danilo Krummrich <dakr@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	 linux-acpi@vger.kernel.org, driver-core@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] software node: allow referencing software nodes by name
Date: Tue, 24 Mar 2026 09:25:16 -0700	[thread overview]
Message-ID: <acK6qV1Be7Wl-Yiv@google.com> (raw)
In-Reply-To: <2026032406-recycler-device-7660@gregkh>

On Tue, Mar 24, 2026 at 08:59:24AM +0100, Greg Kroah-Hartman wrote:
> 
> Do you have a follow-on patch that uses this new api anywhere?
> 

It will look like this (obviously split in 2 patches):

diff --git a/arch/x86/platform/geode/geode-common.c b/arch/x86/platform/geode/geode-common.c
index 05189c5f7d2a..ae43ca2ba4ec 100644
--- a/arch/x86/platform/geode/geode-common.c
+++ b/arch/x86/platform/geode/geode-common.c
@@ -14,10 +14,6 @@
 
 #include "geode-common.h"
 
-static const struct software_node geode_gpiochip_node = {
-	.name = "cs5535-gpio",
-};
-
 static const struct property_entry geode_gpio_keys_props[] = {
 	PROPERTY_ENTRY_U32("poll-interval", 20),
 	{ }
@@ -42,7 +38,6 @@ static const struct software_node geode_restart_key_node = {
 };
 
 static const struct software_node *geode_gpio_keys_swnodes[] __initconst = {
-	&geode_gpiochip_node,
 	&geode_gpio_keys_node,
 	&geode_restart_key_node,
 	NULL
@@ -50,10 +45,6 @@ static const struct software_node *geode_gpio_keys_swnodes[] __initconst = {
 
 /*
  * Creates gpio-keys-polled device for the restart key.
- *
- * Note that it needs to be called first, before geode_create_leds(),
- * because it registers gpiochip software node used by both gpio-keys and
- * leds-gpio devices.
  */
 int __init geode_create_restart_key(unsigned int pin)
 {
@@ -64,8 +55,7 @@ int __init geode_create_restart_key(unsigned int pin)
 	struct platform_device *pd;
 	int err;
 
-	geode_restart_key_props[0] = PROPERTY_ENTRY_GPIO("gpios",
-							 &geode_gpiochip_node,
+	geode_restart_key_props[0] = PROPERTY_ENTRY_GPIO("gpios", "cs5535-gpio",
 							 pin, GPIO_ACTIVE_LOW);
 
 	err = software_node_register_node_group(geode_gpio_keys_swnodes);
@@ -136,7 +126,7 @@ int __init geode_create_leds(const char *label, const struct geode_led *leds,
 		}
 
 		props[i * 3 + 0] =
-			PROPERTY_ENTRY_GPIO("gpios", &geode_gpiochip_node,
+			PROPERTY_ENTRY_GPIO("gpios", "cs5535-gpio",
 					    leds[i].pin, GPIO_ACTIVE_LOW);
 		props[i * 3 + 1] =
 			PROPERTY_ENTRY_STRING("linux,default-trigger",
diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c
index d0fb2e52ee76..6941e124e87f 100644
--- a/drivers/mfd/cs5535-mfd.c
+++ b/drivers/mfd/cs5535-mfd.c
@@ -14,6 +14,7 @@
 #include <linux/mfd/core.h>
 #include <linux/module.h>
 #include <linux/pci.h>
+#include <linux/property.h>
 #include <asm/olpc.h>
 
 #define DRV_NAME "cs5535-mfd"
@@ -29,6 +30,10 @@ enum cs5535_mfd_bars {
 
 static struct resource cs5535_mfd_resources[NR_BARS];
 
+static const struct software_node cs5535_gpiochip_node = {
+	.name = "cs5535-gpio",
+};
+
 static struct mfd_cell cs5535_mfd_cells[] = {
 	{
 		.name = "cs5535-smb",
@@ -39,6 +44,7 @@ static struct mfd_cell cs5535_mfd_cells[] = {
 		.name = "cs5535-gpio",
 		.num_resources = 1,
 		.resources = &cs5535_mfd_resources[GPIO_BAR],
+		.swnode = &cs5535_gpiochip_node,
 	},
 	{
 		.name = "cs5535-mfgpt",

Thanks.

-- 
Dmitry

  reply	other threads:[~2026-03-24 16:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-24  4:46 [PATCH] software node: allow referencing software nodes by name Dmitry Torokhov
2026-03-24  7:59 ` Greg Kroah-Hartman
2026-03-24 16:25   ` Dmitry Torokhov [this message]
2026-03-24  9:46 ` Bartosz Golaszewski
2026-03-24 19:30   ` Dmitry Torokhov
2026-03-25 16:32     ` Bartosz Golaszewski
2026-03-25 18:11       ` Dmitry Torokhov
2026-03-26  8:26       ` Andy Shevchenko
2026-03-26  8:28         ` Andy Shevchenko
2026-03-26  8:34         ` Bartosz Golaszewski
2026-03-26  8:39           ` Andy Shevchenko
2026-03-26  8:47             ` Bartosz Golaszewski
2026-03-26  9:03               ` Andy Shevchenko
2026-03-26  8:48             ` Andy Shevchenko
2026-03-26 15:47               ` Bartosz Golaszewski
2026-03-26 19:01                 ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=acK6qV1Be7Wl-Yiv@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=brgl@kernel.org \
    --cc=dakr@kernel.org \
    --cc=djrscally@gmail.com \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox