Re: [PATCH v2 06/28] drivers: Add generic helper to match by of_node

2019-06-17 Thread Wolfram Sang

> > Is it an option to 'static inline' this simple function in the header,
> > saving the EXPORT?
> > 
> 
> No.

OK, thanks for the explanation!



signature.asc
Description: PGP signature


Re: [PATCH v2 06/28] drivers: Add generic helper to match by of_node

2019-06-17 Thread Suzuki K Poulose

Hi

On 14/06/2019 21:31, Wolfram Sang wrote:

+
+int device_match_of_node(struct device *dev, const void *np)
+{
+   return dev->of_node == np;
+}
+EXPORT_SYMBOL_GPL(device_match_of_node);


Is it an option to 'static inline' this simple function in the header,
saving the EXPORT?



No. This is supposed to be passed on as a call back function pointer
for the APIs. Having it as a static inline, would simply replicate
the same function through the driver subsystems, which is one of the
issues that series is trying to solve. Also, by having them exported,
we can convert the new specialized device lookup functions,
*_find_device_by_ to be static inlines.

Suzuki


[PATCH v2 06/28] drivers: Add generic helper to match by of_node

2019-06-16 Thread Suzuki K Poulose
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 
Cc: Andrew Lunn 
Cc: Daniel Vetter 
Cc: David Airlie 
Cc: "David S. Miller" 
Cc: devicet...@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: Florian Fainelli 
Cc: Frank Rowand 
Cc: Greg Kroah-Hartman 
Cc: Heiner Kallweit 
Cc: Jiri Slaby 
Cc: Jonathan Hunter 
Cc: Lee Jones 
Cc: Liam Girdwood 
Cc: linux-f...@vger.kernel.org
Cc: linux-...@vger.kernel.org
Cc: linux-...@vger.kernel.org
Cc: Maarten Lankhorst 
Cc: Mark Brown 
Cc: Mathieu Poirier 
Cc: Maxime Ripard 
Cc: Moritz Fischer 
Cc: Peter Rosin 
Cc: Rob Herring 
Cc: Srinivas Kandagatla 
Cc: Thierry Reding 
Cc: Thor Thayer 
Cc: Wolfram Sang 
Cc: "Rafael J. Wysocki" 
Cc: Greg Kroah-Hartman 
Cc: Ulf Hansson 
Cc: Joe Perches 
Signed-off-by: Suzuki K Poulose 
---
 drivers/base/core.c   | 6 ++
 drivers/fpga/of-fpga-region.c | 7 +--
 include/linux/device.h| 2 ++
 3 files changed, 9 insertions(+), 6 deletions(-)

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/drivers/fpga/of-fpga-region.c b/drivers/fpga/of-fpga-region.c
index 75f64ab..e405309 100644
--- a/drivers/fpga/of-fpga-region.c
+++ b/drivers/fpga/of-fpga-region.c
@@ -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);
 }
 
 /**
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

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2 06/28] drivers: Add generic helper to match by of_node

2019-06-14 Thread Wolfram Sang
> +
> +int device_match_of_node(struct device *dev, const void *np)
> +{
> + return dev->of_node == np;
> +}
> +EXPORT_SYMBOL_GPL(device_match_of_node);

Is it an option to 'static inline' this simple function in the header,
saving the EXPORT?



signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel