[PATCH] totally untested attachment of device nodes to usb devices
Grant Likely
grant.likely at secretlab.ca
Fri Nov 4 19:21:51 UTC 2011
Proof of concept, needs to be made compilable and add the unwind path
on error and remove.
Bodged-together-by: Grant Likely <grant.likely at secretlab.ca>
---
Resend... I messed up Deepak's email addr.
g.
drivers/usb/core/hub.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 96f05b2..bafd31d 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1856,6 +1856,8 @@ fail:
*/
int usb_new_device(struct usb_device *udev)
{
+ struct device_node *np = udev->bus->dev.of_node;
+ struct device_node *child;
int err;
if (udev->parent) {
@@ -1864,6 +1866,17 @@ int usb_new_device(struct usb_device *udev)
* sysfs power/wakeup controls wakeup enabled/disabled
*/
device_init_wakeup(&udev->dev, 0);
+
+ /* Grab the device node for the hub */
+ np = udev->parent->dev.of_node;
+ }
+
+ /* Do we have a device tree node for this USB device? */
+ if (np) {
+ for_each_child_of_node(child, np) {
+ if (value_of_reg_property(child) == udev->portnum)
+ udev->dev.of_node = of_node_get(child);
+ }
}
/* Tell the runtime-PM framework the device is active */
--
1.7.5.4
More information about the linaro-kernel
mailing list