Skip to content

Commit

Permalink
drivercore/dt: add a match table pointer to struct device
Browse files Browse the repository at this point in the history
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>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Grant Likely committed Feb 28, 2011
1 parent 3d6b882 commit b826291
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/linux/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -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" */

Expand Down
5 changes: 3 additions & 2 deletions include/linux/of_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b826291

Please sign in to comment.