]> Git Repo - linux.git/commitdiff
drivers: Add generic helper to match by of_node
authorSuzuki K Poulose <[email protected]>
Fri, 14 Jun 2019 17:54:01 +0000 (18:54 +0100)
committerGreg Kroah-Hartman <[email protected]>
Mon, 24 Jun 2019 03:22:31 +0000 (05:22 +0200)
Add a helper to match device by the of_node. This will be later used
to provide wrappers to the device iterators for {bus/class/driver}_find_device().
Convert other users to reuse this new helper.

Cc: Alan Tull <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: David Airlie <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: Florian Fainelli <[email protected]>
Cc: Frank Rowand <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Heiner Kallweit <[email protected]>
Cc: Jiri Slaby <[email protected]>
Cc: Jonathan Hunter <[email protected]>
Cc: Lee Jones <[email protected]>
Cc: Liam Girdwood <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Maarten Lankhorst <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Mathieu Poirier <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Moritz Fischer <[email protected]>
Cc: Peter Rosin <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Srinivas Kandagatla <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Thor Thayer <[email protected]>
Cc: Wolfram Sang <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: Joe Perches <[email protected]>
Signed-off-by: Suzuki K Poulose <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/base/core.c
drivers/fpga/of-fpga-region.c
include/linux/device.h

index fd7511e04e62233eac98fec28fd5e90a1a111210..92119080474c8b83fb7d41d9840bbc6b1ac2a79c 100644 (file)
@@ -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);
index 75f64abf9c817c6dd88e058a9a3b51b12c8eaa09..e405309baadc199d6f5510f4d0c1e8bf4b9f0305 100644 (file)
@@ -22,11 +22,6 @@ static const struct of_device_id fpga_region_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, fpga_region_of_match);
 
-static int fpga_region_of_node_match(struct device *dev, const void *data)
-{
-       return dev->of_node == data;
-}
-
 /**
  * of_fpga_region_find - find FPGA region
  * @np: device node of FPGA Region
@@ -37,7 +32,7 @@ static int fpga_region_of_node_match(struct device *dev, const void *data)
  */
 static struct fpga_region *of_fpga_region_find(struct device_node *np)
 {
-       return fpga_region_class_find(NULL, np, fpga_region_of_node_match);
+       return fpga_region_class_find(NULL, np, device_match_of_node);
 }
 
 /**
index 4d7c88131a4da701782f7793c159f19aff69d44a..709308560d32489389ee4858355cc37cde952e6a 100644 (file)
@@ -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,
This page took 0.08603 seconds and 4 git commands to generate.