From: Grant Likely <grant.likely@secretlab.ca>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
devicetree-discuss@lists.ozlabs.org, sfr@canb.auug.org.au,
linux-kernel@vger.kernel.org, davem@davemloft.net
Cc: sparclinux@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: [RFC PATCH 02/15] dt: add a match table pointer to struct device
Date: Tue, 22 Feb 2011 21:33:45 -0700 [thread overview]
Message-ID: <20110223043345.20795.2936.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20110223043015.20795.37090.stgit@localhost6.localdomain6>
Add a new .of_match field to struct device which points at the
matching device driver .of_match_table entry when a device is probed
via the device tree
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
include/linux/device.h | 1 +
include/linux/of_device.h | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/linux/device.h b/include/linux/device.h
index ca5d252..8d8e267 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -441,6 +441,7 @@ struct device {
struct dev_archdata archdata;
struct device_node *of_node; /* associated device tree node */
+ const struct of_device_id *of_match; /* matching of_device_id from driver */
dev_t devt; /* dev_t, creates the sysfs "dev" */
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 975d347..8bfe6c1 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -18,10 +18,11 @@ extern void of_device_make_bus_id(struct device *dev);
* @drv: the device_driver structure to test
* @dev: the device structure to match against
*/
-static inline int of_driver_match_device(const struct device *dev,
+static inline int of_driver_match_device(struct device *dev,
const struct device_driver *drv)
{
- return of_match_device(drv->of_match_table, dev) != NULL;
+ dev->of_match = of_match_device(drv->of_match_table, dev);
+ return dev->of_match != NULL;
}
extern struct platform_device *of_dev_get(struct platform_device *dev);
next prev parent reply other threads:[~2011-02-23 4:33 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-23 4:33 [RFC PATCH 00/15] Remove last remains of of_platform_bus_type Grant Likely
2011-02-23 4:33 ` [RFC PATCH 01/15] dt/powerpc: move of_bus_type infrastructure to ibmebus Grant Likely
2011-02-24 14:46 ` Arnd Bergmann
2011-02-25 8:53 ` Benjamin Herrenschmidt
2011-02-28 7:35 ` Grant Likely
2011-02-23 4:33 ` Grant Likely [this message]
2011-02-23 18:29 ` [RFC PATCH 02/15] dt: add a match table pointer to struct device Rob Herring
2011-02-23 18:44 ` Grant Likely
2011-02-23 21:18 ` Open Firmware and interrupt trigger Robert Thorhuus
2011-02-24 20:46 ` Benjamin Herrenschmidt
2011-02-25 7:29 ` Robert Thorhuus
2011-02-25 8:47 ` Benjamin Herrenschmidt
2011-02-23 4:33 ` [RFC PATCH 03/15] dt/powerpc: Eliminate users of of_platform_{, un}register_driver Grant Likely
2011-02-23 4:33 ` [RFC PATCH 04/15] dt/sparc: " Grant Likely
2011-02-23 4:34 ` [RFC PATCH 05/15] leds/leds-gpio: merge platform_driver with of_platform_driver Grant Likely
2011-02-23 4:34 ` [RFC PATCH 06/15] dt: xilinx_hwicap: merge platform and of_platform driver bindings Grant Likely
2011-02-25 18:25 ` [RFC PATCH 06/15] dt: xilinx_hwicap: merge platform and of_platformdriver bindings Stephen Neuendorffer
2011-02-28 7:41 ` Grant Likely
2011-02-23 4:34 ` [RFC PATCH 07/15] dt: uartlite: merge platform and of_platform driver bindings Grant Likely
2011-02-23 8:58 ` Peter Korsgaard
2011-02-23 18:10 ` Grant Likely
2011-02-23 4:34 ` [RFC PATCH 08/15] dt/spi: Eliminate users of of_platform_{, un}register_driver Grant Likely
2011-02-23 4:34 ` [RFC PATCH 09/15] dt/sound: " Grant Likely
2011-02-23 4:34 ` [RFC PATCH 10/15] dt/net: " Grant Likely
2011-02-23 4:34 ` [RFC PATCH 11/15] dt/video: " Grant Likely
2011-02-23 4:34 ` [RFC PATCH 12/15] dt/usb: " Grant Likely
2011-02-23 4:34 ` [RFC PATCH 13/15] dt/serial: " Grant Likely
2011-02-24 16:34 ` Arnd Bergmann
2011-02-23 4:34 ` [RFC PATCH 14/15] dt: Eliminate of_platform_{,un}register_driver Grant Likely
2011-02-23 16:56 ` Rob Herring
2011-02-23 17:22 ` Grant Likely
2011-02-23 4:34 ` [RFC PATCH 15/15] dt: eliminate of_platform_driver shim code Grant Likely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110223043345.20795.2936.stgit@localhost6.localdomain6 \
--to=grant.likely@secretlab.ca \
--cc=benh@kernel.crashing.org \
--cc=davem@davemloft.net \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=sfr@canb.auug.org.au \
--cc=sparclinux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).