[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260110-pci-m2-e-v3-4-4faee7d0d5ae@oss.qualcomm.com>
Date: Sat, 10 Jan 2026 12:26:22 +0530
From: Manivannan Sadhasivam via B4 Relay <devnull+manivannan.sadhasivam.oss.qualcomm.com@...nel.org>
To: Rob Herring <robh@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>, Nathan Chancellor <nathan@...nel.org>,
Nicolas Schier <nicolas.schier@...ux.dev>, Hans de Goede <hansg@...nel.org>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
Mark Pearson <mpearson-lenovo@...ebb.ca>,
"Derek J. Clark" <derekjohn.clark@...il.com>,
Manivannan Sadhasivam <mani@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Marcel Holtmann <marcel@...tmann.org>,
Luiz Augusto von Dentz <luiz.dentz@...il.com>,
Bartosz Golaszewski <brgl@...ev.pl>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Daniel Scally <djrscally@...il.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
"Rafael J. Wysocki" <rafael@...nel.org>, Danilo Krummrich <dakr@...nel.org>,
Bartosz Golaszewski <brgl@...nel.org>
Cc: linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kbuild@...r.kernel.org, platform-driver-x86@...r.kernel.org,
linux-pci@...r.kernel.org, devicetree@...r.kernel.org,
linux-arm-msm@...r.kernel.org, linux-bluetooth@...r.kernel.org,
linux-pm@...r.kernel.org, Stephan Gerhold <stephan.gerhold@...aro.org>,
Dmitry Baryshkov <dmitry.baryshkov@....qualcomm.com>,
linux-acpi@...r.kernel.org,
Manivannan Sadhasivam <manivannan.sadhasivam@....qualcomm.com>
Subject: [PATCH v3 04/14] software node: Add software_node_match_device()
API
From: Manivannan Sadhasivam <manivannan.sadhasivam@....qualcomm.com>
Add software_node_match_device() API to match the swnode device with the
swnode driver. The matching is based on the compatible property in the
device and the driver's of_match_table.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@....qualcomm.com>
---
drivers/base/swnode.c | 16 ++++++++++++++++
include/linux/property.h | 3 +++
2 files changed, 19 insertions(+)
diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
index cd722712b8e9..4a3b367dea02 100644
--- a/drivers/base/swnode.c
+++ b/drivers/base/swnode.c
@@ -372,6 +372,22 @@ void property_entries_free(const struct property_entry *properties)
}
EXPORT_SYMBOL_GPL(property_entries_free);
+bool software_node_match_device(struct device *dev, const struct device_driver *drv)
+{
+ const struct of_device_id *id;
+
+ if (!drv->of_match_table)
+ return false;
+
+ for (id = drv->of_match_table; id->compatible[0]; id++) {
+ if (device_is_compatible(dev, id->compatible))
+ return true;
+ }
+
+ return false;
+}
+EXPORT_SYMBOL_GPL(software_node_match_device);
+
/* -------------------------------------------------------------------------- */
/* fwnode operations */
diff --git a/include/linux/property.h b/include/linux/property.h
index 272bfbdea7bf..7fe75ab732f6 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -14,6 +14,7 @@
#include <linux/array_size.h>
#include <linux/bits.h>
#include <linux/cleanup.h>
+#include <linux/device.h>
#include <linux/fwnode.h>
#include <linux/stddef.h>
#include <linux/types.h>
@@ -597,6 +598,8 @@ void software_node_unregister_node_group(const struct software_node * const *nod
int software_node_register(const struct software_node *node);
void software_node_unregister(const struct software_node *node);
+bool software_node_match_device(struct device *dev, const struct device_driver *drv);
+
struct fwnode_handle *
fwnode_create_software_node(const struct property_entry *properties,
const struct fwnode_handle *parent);
--
2.48.1
Powered by blists - more mailing lists