From: Grant Likely <grant.likely@secretlab.ca>
To: devicetree-discuss@lists.ozlabs.org,
Greg Kroah-Hartman <gregkh@suse.de>,
linux-kernel@vger.kernel.org
Subject: [PATCH] dt: add a match table pointer to struct device
Date: Tue, 22 Feb 2011 19:52:34 -0700 [thread overview]
Message-ID: <20110223025233.25131.47193.stgit@localhost6.localdomain6> (raw)
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 reply other threads:[~2011-02-23 2:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-23 2:52 Grant Likely [this message]
2011-02-25 15:46 ` [PATCH] dt: add a match table pointer to struct device Grant Likely
2011-02-25 16:35 ` Greg KH
2011-02-25 17:34 ` Grant Likely
2011-02-25 18:44 ` Greg KH
2011-02-25 19:20 ` 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=20110223025233.25131.47193.stgit@localhost6.localdomain6 \
--to=grant.likely@secretlab.ca \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@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