@@ -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 */