From patchwork Fri Nov 4 19:21:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Likely X-Patchwork-Id: 4942 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id DFF5E23E08 for ; Fri, 4 Nov 2011 19:22:02 +0000 (UTC) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id D06B3A18149 for ; Fri, 4 Nov 2011 19:22:02 +0000 (UTC) Received: by bkbc12 with SMTP id c12so3498156bkb.11 for ; Fri, 04 Nov 2011 12:22:02 -0700 (PDT) Received: by 10.152.148.130 with SMTP id ts2mr1365680lab.20.1320434522427; Fri, 04 Nov 2011 12:22:02 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.14.103 with SMTP id o7cs139899lac; Fri, 4 Nov 2011 12:22:01 -0700 (PDT) Received: by 10.146.74.10 with SMTP id w10mr4065414yaa.14.1320434514444; Fri, 04 Nov 2011 12:21:54 -0700 (PDT) Received: from mail-gy0-f178.google.com (mail-gy0-f178.google.com [209.85.160.178]) by mx.google.com with ESMTPS id u13si4966354ann.131.2011.11.04.12.21.53 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Nov 2011 12:21:54 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.178 is neither permitted nor denied by best guess record for domain of glikely@secretlab.ca) client-ip=209.85.160.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.178 is neither permitted nor denied by best guess record for domain of glikely@secretlab.ca) smtp.mail=glikely@secretlab.ca Received: by gyf3 with SMTP id 3so2693988gyf.37 for ; Fri, 04 Nov 2011 12:21:53 -0700 (PDT) Received: by 10.146.68.21 with SMTP id q21mr1139210yaa.32.1320434513352; Fri, 04 Nov 2011 12:21:53 -0700 (PDT) Received: from localhost ([71.46.235.243]) by mx.google.com with ESMTPS id p15sm5220487anf.11.2011.11.04.12.21.52 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Nov 2011 12:21:52 -0700 (PDT) Sender: Grant Likely Received: by localhost (Postfix, from userid 1000) id 09F653E09DF; Fri, 4 Nov 2011 15:21:52 -0400 (EDT) From: Grant Likely To: deepak.saxena@linaro.org, patches@linaro.org, linaro-kernel@lists.linaro.org Cc: Grant Likely Subject: [PATCH] totally untested attachment of device nodes to usb devices Date: Fri, 4 Nov 2011 15:21:51 -0400 Message-Id: <1320434511-4862-1-git-send-email-grant.likely@secretlab.ca> X-Mailer: git-send-email 1.7.5.4 Proof of concept, needs to be made compilable and add the unwind path on error and remove. Bodged-together-by: Grant Likely --- 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 */