lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1560534863-15115-7-git-send-email-suzuki.poulose@arm.com>
Date:   Fri, 14 Jun 2019 18:54:01 +0100
From:   Suzuki K Poulose <suzuki.poulose@....com>
To:     linux-kernel@...r.kernel.org
Cc:     gregkh@...uxfoundation.org, rafael@...nel.org,
        suzuki.poulose@....com, Alan Tull <atull@...nel.org>,
        Andrew Lunn <andrew@...n.ch>, Daniel Vetter <daniel@...ll.ch>,
        David Airlie <airlied@...ux.ie>,
        "David S. Miller" <davem@...emloft.net>,
        devicetree@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        Florian Fainelli <f.fainelli@...il.com>,
        Frank Rowand <frowand.list@...il.com>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Jiri Slaby <jslaby@...e.com>,
        Jonathan Hunter <jonathanh@...dia.com>,
        Lee Jones <lee.jones@...aro.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        linux-fpga@...r.kernel.org, linux-i2c@...r.kernel.org,
        linux-spi@...r.kernel.org,
        Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Mark Brown <broonie@...nel.org>,
        Mathieu Poirier <mathieu.poirier@...aro.org>,
        Maxime Ripard <maxime.ripard@...tlin.com>,
        Moritz Fischer <mdf@...nel.org>, Peter Rosin <peda@...ntia.se>,
        Rob Herring <robh+dt@...nel.org>,
        Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
        Thierry Reding <thierry.reding@...il.com>,
        Thor Thayer <thor.thayer@...ux.intel.com>,
        Wolfram Sang <wsa@...-dreams.de>,
        Ulf Hansson <ulf.hansson@...aro.org>,
        Joe Perches <joe@...ches.com>
Subject: [PATCH v2 06/28] drivers: Add generic helper to match by of_node

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 <atull@...nel.org>
Cc: Andrew Lunn <andrew@...n.ch>
Cc: Daniel Vetter <daniel@...ll.ch>
Cc: David Airlie <airlied@...ux.ie>
Cc: "David S. Miller" <davem@...emloft.net>
Cc: devicetree@...r.kernel.org
Cc: dri-devel@...ts.freedesktop.org
Cc: Florian Fainelli <f.fainelli@...il.com>
Cc: Frank Rowand <frowand.list@...il.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Heiner Kallweit <hkallweit1@...il.com>
Cc: Jiri Slaby <jslaby@...e.com>
Cc: Jonathan Hunter <jonathanh@...dia.com>
Cc: Lee Jones <lee.jones@...aro.org>
Cc: Liam Girdwood <lgirdwood@...il.com>
Cc: linux-fpga@...r.kernel.org
Cc: linux-i2c@...r.kernel.org
Cc: linux-spi@...r.kernel.org
Cc: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>
Cc: Mark Brown <broonie@...nel.org>
Cc: Mathieu Poirier <mathieu.poirier@...aro.org>
Cc: Maxime Ripard <maxime.ripard@...tlin.com>
Cc: Moritz Fischer <mdf@...nel.org>
Cc: Peter Rosin <peda@...ntia.se>
Cc: Rob Herring <robh+dt@...nel.org>
Cc: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Cc: Thierry Reding <thierry.reding@...il.com>
Cc: Thor Thayer <thor.thayer@...ux.intel.com>
Cc: Wolfram Sang <wsa@...-dreams.de>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Ulf Hansson <ulf.hansson@...aro.org>
Cc: Joe Perches <joe@...ches.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@....com>
---
 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ