of: change of_match_device to work with struct device
authorGrant Likely <grant.likely@secretlab.ca>
Tue, 13 Apr 2010 23:13:22 +0000 (16:13 -0700)
committerGrant Likely <grant.likely@secretlab.ca>
Sat, 22 May 2010 06:10:41 +0000 (00:10 -0600)
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>
drivers/macintosh/macio_asic.c
drivers/of/device.c
drivers/of/platform.c
include/linux/of_device.h

index e3ba1d8001a34b509660851e6ef7f4785daa5176..97147804a49cefc2e6b8864da44be7de13ca0832 100644 (file)
@@ -39,13 +39,12 @@ static struct macio_chip      *macio_on_hold;
 
 static int macio_bus_match(struct device *dev, struct device_driver *drv) 
 {
-       struct macio_dev * macio_dev = to_macio_device(dev);
        const struct of_device_id * matches = drv->of_match_table;
 
        if (!matches) 
                return 0;
 
-       return of_match_device(matches, &macio_dev->ofdev) != NULL;
+       return of_match_device(matches, dev) != NULL;
 }
 
 struct macio_dev *macio_dev_get(struct macio_dev *dev)
@@ -83,7 +82,7 @@ static int macio_device_probe(struct device *dev)
 
        macio_dev_get(macio_dev);
 
-       match = of_match_device(drv->driver.of_match_table, &macio_dev->ofdev);
+       match = of_match_device(drv->driver.of_match_table, dev);
        if (match)
                error = drv->probe(macio_dev, match);
        if (error)
index 24068bbbce1a8836c46485bb28c774118c75ff7f..7d18f8e0b013199c2e1bfd886b8dd6b93c639f7e 100644 (file)
@@ -10,8 +10,7 @@
 #include <asm/errno.h>
 
 /**
- * of_match_device - Tell if an of_device structure has a matching
- * of_match structure
+ * of_match_device - Tell if a struct device matches an of_device_id list
  * @ids: array of of device match structures to search in
  * @dev: the of device structure to match against
  *
  * system is in its list of supported devices.
  */
 const struct of_device_id *of_match_device(const struct of_device_id *matches,
-                                       const struct of_device *dev)
+                                          const struct device *dev)
 {
-       if (!dev->dev.of_node)
+       if (!dev->of_node)
                return NULL;
-       return of_match_node(matches, dev->dev.of_node);
+       return of_match_node(matches, dev->of_node);
 }
 EXPORT_SYMBOL(of_match_device);
 
index ba402c613ede23e5133229d1d0cc22332f00cb50..7dacc1ebe91e013cadbc77ca57cf729f34585ef5 100644 (file)
@@ -21,13 +21,12 @@ 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);
        const struct of_device_id *matches = drv->of_match_table;
 
        if (!matches)
                return 0;
 
-       return of_match_device(matches, of_dev) != NULL;
+       return of_match_device(matches, dev) != NULL;
 }
 
 static int of_platform_device_probe(struct device *dev)
@@ -45,7 +44,7 @@ static int of_platform_device_probe(struct device *dev)
 
        of_dev_get(of_dev);
 
-       match = of_match_device(drv->driver.of_match_table, of_dev);
+       match = of_match_device(drv->driver.of_match_table, dev);
        if (match)
                error = drv->probe(of_dev, match);
        if (error)
index e7904a9cd3a3d1ff1cfaa2e433b22db8014b2513..11651facc5f179237500ea4d43e3bcc76bfe270d 100644 (file)
@@ -11,7 +11,7 @@
 #define        to_of_device(d) container_of(d, struct of_device, dev)
 
 extern const struct of_device_id *of_match_device(
-       const struct of_device_id *matches, const struct of_device *dev);
+       const struct of_device_id *matches, const struct device *dev);
 
 extern struct of_device *of_dev_get(struct of_device *dev);
 extern void of_dev_put(struct of_device *dev);