[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220221162652.103834-3-clement.leger@bootlin.com>
Date: Mon, 21 Feb 2022 17:26:44 +0100
From: Clément Léger <clement.leger@...tlin.com>
To: 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>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Wolfram Sang <wsa@...nel.org>, Peter Rosin <peda@...ntia.se>,
Russell King <linux@...linux.org.uk>,
Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
linux-i2c@...r.kernel.org, netdev@...r.kernel.org,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Clément Léger <clement.leger@...tlin.com>
Subject: [RFC 02/10] property: add fwnode_get_match_data()
Add fwnode_get_match_data() which is meant to be used as
device_get_match_data for fwnode_operations.
Signed-off-by: Clément Léger <clement.leger@...tlin.com>
---
drivers/base/property.c | 12 ++++++++++++
include/linux/property.h | 3 +++
2 files changed, 15 insertions(+)
diff --git a/drivers/base/property.c b/drivers/base/property.c
index 434c2713fd99..6ffb3ac4509c 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -1181,6 +1181,18 @@ const struct of_device_id *fwnode_match_node(const struct fwnode_handle *fwnode,
}
EXPORT_SYMBOL(fwnode_match_node);
+const void *fwnode_get_match_data(const struct fwnode_handle *fwnode,
+ const struct device *dev)
+{
+ const struct of_device_id *match;
+
+ match = fwnode_match_node(fwnode, dev->driver->of_match_table);
+ if (!match)
+ return NULL;
+
+ return match->data;
+}
+
const void *device_get_match_data(struct device *dev)
{
return fwnode_call_ptr_op(dev_fwnode(dev), device_get_match_data, dev);
diff --git a/include/linux/property.h b/include/linux/property.h
index 978ecf6be34e..7f727c492602 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -449,6 +449,9 @@ static inline void *device_connection_find_match(struct device *dev,
const struct of_device_id *fwnode_match_node(const struct fwnode_handle *fwnode,
const struct of_device_id *matches);
+const void *fwnode_get_match_data(const struct fwnode_handle *fwnode,
+ const struct device *dev);
+
/* -------------------------------------------------------------------------- */
/* Software fwnode support - when HW description is incomplete or missing */
--
2.34.1
Powered by blists - more mailing lists