[PATCH 04/13] drivers: Add generic helper to match by of_node

Suzuki K Poulose suzuki.poulose at arm.com
Wed Jun 5 15:13:41 UTC 2019


Add a helper to match device by the of_node. This will be later used
to provide generic lookup functions by of_node.

Cc: Alan Tull <atull at kernel.org>
Cc: Andrew Lunn <andrew at lunn.ch>
Cc: Daniel Vetter <daniel at ffwll.ch>
Cc: David Airlie <airlied at linux.ie>
Cc: "David S. Miller" <davem at davemloft.net>
Cc: devicetree at vger.kernel.org
Cc: dri-devel at lists.freedesktop.org
Cc: Florian Fainelli <f.fainelli at gmail.com>
Cc: Frank Rowand <frowand.list at gmail.com>
Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Cc: Heiner Kallweit <hkallweit1 at gmail.com>
Cc: Jiri Slaby <jslaby at suse.com>
Cc: Jonathan Hunter <jonathanh at nvidia.com>
Cc: Lee Jones <lee.jones at linaro.org>
Cc: Liam Girdwood <lgirdwood at gmail.com>
Cc: linux-fpga at vger.kernel.org
Cc: linux-i2c at vger.kernel.org
Cc: linux-spi at vger.kernel.org
Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Cc: Mark Brown <broonie at kernel.org>
Cc: Mathieu Poirier <mathieu.poirier at linaro.org>
Cc: Maxime Ripard <maxime.ripard at bootlin.com>
Cc: Moritz Fischer <mdf at kernel.org>
Cc: Peter Rosin <peda at axentia.se>
Cc: Rob Herring <robh+dt at kernel.org>
Cc: Srinivas Kandagatla <srinivas.kandagatla at linaro.org>
Cc: Thierry Reding <thierry.reding at gmail.com>
Cc: Thor Thayer <thor.thayer at linux.intel.com>
Cc: Wolfram Sang <wsa at the-dreams.de>
Cc: "Rafael J. Wysocki" <rafael at kernel.org>
Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Cc: Ulf Hansson <ulf.hansson at linaro.org>
Cc: Joe Perches <joe at perches.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose at arm.com>
---
 drivers/base/core.c    | 6 ++++++
 include/linux/device.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index fd7511e..9211908 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -3328,3 +3328,9 @@ void device_set_of_node_from_dev(struct device *dev, const struct device *dev2)
 	dev->of_node_reused = true;
 }
 EXPORT_SYMBOL_GPL(device_set_of_node_from_dev);
+
+int device_match_of_node(struct device *dev, const void *np)
+{
+	return dev->of_node == np;
+}
+EXPORT_SYMBOL_GPL(device_match_of_node);
diff --git a/include/linux/device.h b/include/linux/device.h
index 4d7c881..7093085 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -163,6 +163,8 @@ void subsys_dev_iter_init(struct subsys_dev_iter *iter,
 struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);
 void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
 
+int device_match_of_node(struct device *dev, const void *np);
+
 int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
 		     int (*fn)(struct device *dev, void *data));
 struct device *bus_find_device(struct bus_type *bus, struct device *start,
-- 
2.7.4



More information about the dri-devel mailing list