Skip to contentSkip to conversation

dt: add a match table pointer to struct device

PATCH In review Grant Likely 2 participants 6 messages Feb 23, 2011 – Feb 25, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dt: add a match table pointer to struct device

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

---
 include/linux/device.h    |    1 +
 include/linux/of_device.h |    5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)
include/linux/device.h +1 -0
index ca5d252..8d8e267 100644
@@ -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" */
 
include/linux/of_device.h +3 -2
index 975d347..8bfe6c1 100644
@@ -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);
#1 lore raw

Greg, any thoughts on this change? I'd like to take it via my tree so I can finally dump the last vestiges of of_platform_bus_type.

Thanks,
g.

Quoted 42 lines · Grant Likely

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

---
 include/linux/device.h    |    1 +
 include/linux/of_device.h |    5 +++--

 2 files changed, 4 insertions(+), 2 deletions(-)
include/linux/device.h +0 -0
index ca5d252..8d8e267 100644
@@ -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" */

include/linux/of_device.h +3 -2
index 975d347..8bfe6c1 100644
@@ -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);
Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
Acked-by
#2 lore raw
Quoted 2 lines · Grant Likely

Greg, any thoughts on this change? I'd like to take it via my tree so I can finally dump the last vestiges of of_platform_bus_type.

Sorry, I didn't realize you just wanted my review, and not me to take it directly.

If you want to take it, that's great, no objection from me, feel free to add:

to it.

What about the other patch you sent me, do you want me to take that, or will you?

thanks,

greg k-h

#3 lore raw
Quoted 6 lines · Greg KH
Quoted 2 lines · Grant Likely

Greg, any thoughts on this change?  I'd like to take it via my tree so I can finally dump the last vestiges of of_platform_bus_type.

Sorry, I didn't realize you just wanted my review, and not me to take it directly.

Heh, I wasn't very clear about that. Oops,

Quoted 4 lines

If you want to take it, that's great, no objection from me, feel free to add:

to it.

Thanks. Yes I definitely want to take it because I've got a pile of patches that depend on it.

Quoted 2 lines

What about the other patch you sent me, do you want me to take that, or will you?

Which one is that? The relaxation of .name checking on of_serial? Yes, you can take that one, but hold off for the moment. Looking at it now I realize that I forgot to cc some folks that should ack it, so I'm going to repost.

g.

#4 lore raw
Quoted 18 lines · Grant Likely
Quoted 6 lines · Greg KH
Quoted 2 lines · Grant Likely

Greg, any thoughts on this change?  I'd like to take it via my tree so I can finally dump the last vestiges of of_platform_bus_type.

Sorry, I didn't realize you just wanted my review, and not me to take it directly.

Heh, I wasn't very clear about that. Oops,

Quoted 4 lines

If you want to take it, that's great, no objection from me, feel free to add:

to it.

Thanks. Yes I definitely want to take it because I've got a pile of patches that depend on it.

Quoted 7 lines
Quoted 2 lines

What about the other patch you sent me, do you want me to take that, or will you?

Which one is that? The relaxation of .name checking on of_serial? Yes, you can take that one, but hold off for the moment. Looking at it now I realize that I forgot to cc some folks that should ack it, so I'm going to repost.

Oops, I just took it :(

thanks,

greg k-h

#5 lore raw
Quoted 22 lines · Greg KH
Quoted 21 lines · Grant Likely
Quoted 6 lines · Greg KH
Quoted 2 lines · Grant Likely

Greg, any thoughts on this change?  I'd like to take it via my tree so I can finally dump the last vestiges of of_platform_bus_type.

Sorry, I didn't realize you just wanted my review, and not me to take it directly.

Heh, I wasn't very clear about that.  Oops,

Quoted 4 lines

If you want to take it, that's great, no objection from me, feel free to add:

to it.

Thanks.  Yes I definitely want to take it because I've got a pile of patches that depend on it.

Quoted 2 lines

What about the other patch you sent me, do you want me to take that, or will you?

Quoted 6 lines
Quoted 4 lines

Which one is that?  The relaxation of .name checking on of_serial? Yes, you can take that one, but hold off for the moment.  Looking at it now I realize that I forgot to cc some folks that should ack it, so I'm going to repost.

Oops, I just took it :(

Hahaha! No worries, just hold onto it. I'll ping the appropriate folks and if anyone objects then I'll ask you to drop it.

g.