diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2010-04-13 19:13:22 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2010-05-22 02:10:41 -0400 |
commit | 44504b2bebf8b5823c59484e73096a7d6574471d (patch) | |
tree | c4d901f026b499f6f0f5c64f4ecbdee297f5db1e /drivers | |
parent | 4018294b53d1dae026880e45f174c1cc63b5d435 (diff) |
of: change of_match_device to work with struct device
The of_node pointer is now stored directly in struct device, so
of_match_device() should work with any device, not just struct of_device.
This patch changes the interface to of_match_device() to accept a
struct device instead of struct of_device.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/macintosh/macio_asic.c | 5 | ||||
-rw-r--r-- | drivers/of/device.c | 9 | ||||
-rw-r--r-- | drivers/of/platform.c | 5 |
3 files changed, 8 insertions, 11 deletions
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index e3ba1d8001a3..97147804a49c 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c | |||
@@ -39,13 +39,12 @@ static struct macio_chip *macio_on_hold; | |||
39 | 39 | ||
40 | static int macio_bus_match(struct device *dev, struct device_driver *drv) | 40 | static int macio_bus_match(struct device *dev, struct device_driver *drv) |
41 | { | 41 | { |
42 | struct macio_dev * macio_dev = to_macio_device(dev); | ||
43 | const struct of_device_id * matches = drv->of_match_table; | 42 | const struct of_device_id * matches = drv->of_match_table; |
44 | 43 | ||
45 | if (!matches) | 44 | if (!matches) |
46 | return 0; | 45 | return 0; |
47 | 46 | ||
48 | return of_match_device(matches, &macio_dev->ofdev) != NULL; | 47 | return of_match_device(matches, dev) != NULL; |
49 | } | 48 | } |
50 | 49 | ||
51 | struct macio_dev *macio_dev_get(struct macio_dev *dev) | 50 | struct macio_dev *macio_dev_get(struct macio_dev *dev) |
@@ -83,7 +82,7 @@ static int macio_device_probe(struct device *dev) | |||
83 | 82 | ||
84 | macio_dev_get(macio_dev); | 83 | macio_dev_get(macio_dev); |
85 | 84 | ||
86 | match = of_match_device(drv->driver.of_match_table, &macio_dev->ofdev); | 85 | match = of_match_device(drv->driver.of_match_table, dev); |
87 | if (match) | 86 | if (match) |
88 | error = drv->probe(macio_dev, match); | 87 | error = drv->probe(macio_dev, match); |
89 | if (error) | 88 | if (error) |
diff --git a/drivers/of/device.c b/drivers/of/device.c index 24068bbbce1a..7d18f8e0b013 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c | |||
@@ -10,8 +10,7 @@ | |||
10 | #include <asm/errno.h> | 10 | #include <asm/errno.h> |
11 | 11 | ||
12 | /** | 12 | /** |
13 | * of_match_device - Tell if an of_device structure has a matching | 13 | * of_match_device - Tell if a struct device matches an of_device_id list |
14 | * of_match structure | ||
15 | * @ids: array of of device match structures to search in | 14 | * @ids: array of of device match structures to search in |
16 | * @dev: the of device structure to match against | 15 | * @dev: the of device structure to match against |
17 | * | 16 | * |
@@ -19,11 +18,11 @@ | |||
19 | * system is in its list of supported devices. | 18 | * system is in its list of supported devices. |
20 | */ | 19 | */ |
21 | const struct of_device_id *of_match_device(const struct of_device_id *matches, | 20 | const struct of_device_id *of_match_device(const struct of_device_id *matches, |
22 | const struct of_device *dev) | 21 | const struct device *dev) |
23 | { | 22 | { |
24 | if (!dev->dev.of_node) | 23 | if (!dev->of_node) |
25 | return NULL; | 24 | return NULL; |
26 | return of_match_node(matches, dev->dev.of_node); | 25 | return of_match_node(matches, dev->of_node); |
27 | } | 26 | } |
28 | EXPORT_SYMBOL(of_match_device); | 27 | EXPORT_SYMBOL(of_match_device); |
29 | 28 | ||
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index ba402c613ede..7dacc1ebe91e 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
@@ -21,13 +21,12 @@ extern struct device_attribute of_platform_device_attrs[]; | |||
21 | 21 | ||
22 | static int of_platform_bus_match(struct device *dev, struct device_driver *drv) | 22 | static int of_platform_bus_match(struct device *dev, struct device_driver *drv) |
23 | { | 23 | { |
24 | struct of_device *of_dev = to_of_device(dev); | ||
25 | const struct of_device_id *matches = drv->of_match_table; | 24 | const struct of_device_id *matches = drv->of_match_table; |
26 | 25 | ||
27 | if (!matches) | 26 | if (!matches) |
28 | return 0; | 27 | return 0; |
29 | 28 | ||
30 | return of_match_device(matches, of_dev) != NULL; | 29 | return of_match_device(matches, dev) != NULL; |
31 | } | 30 | } |
32 | 31 | ||
33 | static int of_platform_device_probe(struct device *dev) | 32 | static int of_platform_device_probe(struct device *dev) |
@@ -45,7 +44,7 @@ static int of_platform_device_probe(struct device *dev) | |||
45 | 44 | ||
46 | of_dev_get(of_dev); | 45 | of_dev_get(of_dev); |
47 | 46 | ||
48 | match = of_match_device(drv->driver.of_match_table, of_dev); | 47 | match = of_match_device(drv->driver.of_match_table, dev); |
49 | if (match) | 48 | if (match) |
50 | error = drv->probe(of_dev, match); | 49 | error = drv->probe(of_dev, match); |
51 | if (error) | 50 | if (error) |