summaryrefslogtreecommitdiff
path: root/drivers/of
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-04-13 16:13:01 -0700
committerGrant Likely <grant.likely@secretlab.ca>2010-05-22 00:10:40 -0600
commit597b9d1e44e9ba69f2454a5318bbe7a6d5e6930a (patch)
tree373f1f1387143b0ea8811ca6e2a6812f0a86d933 /drivers/of
parent173b3a7a059a6998a6c0733710818c473cc0de4c (diff)
downloadlinux-3.10-597b9d1e44e9ba69f2454a5318bbe7a6d5e6930a.tar.gz
linux-3.10-597b9d1e44e9ba69f2454a5318bbe7a6d5e6930a.tar.bz2
linux-3.10-597b9d1e44e9ba69f2454a5318bbe7a6d5e6930a.zip
drivercore: Add of_match_table to the common device drivers
OF-style matching can be available to any device, on any type of bus. This patch allows any driver to provide an OF match table when CONFIG_OF is enabled so that drivers can be bound against devices described in the device tree. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/platform.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index d58ade170c4..9fd7f7d0a0d 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -22,8 +22,7 @@ extern struct device_attribute of_platform_device_attrs[];
static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
{
struct of_device *of_dev = to_of_device(dev);
- struct of_platform_driver *of_drv = to_of_platform_driver(drv);
- const struct of_device_id *matches = of_drv->match_table;
+ const struct of_device_id *matches = drv->of_match_table;
if (!matches)
return 0;
@@ -46,7 +45,7 @@ static int of_platform_device_probe(struct device *dev)
of_dev_get(of_dev);
- match = of_match_device(drv->match_table, of_dev);
+ match = of_match_device(drv->driver.of_match_table, of_dev);
if (match)
error = drv->probe(of_dev, match);
if (error)
@@ -391,6 +390,8 @@ int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
drv->driver.name = drv->name;
if (!drv->driver.owner)
drv->driver.owner = drv->owner;
+ if (!drv->driver.of_match_table)
+ drv->driver.of_match_table = drv->match_table;
drv->driver.bus = bus;
/* register with core */