From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] usb: make usb devices children of the corresponding host
Date: Tue, 24 Sep 2013 18:39:01 +0200 [thread overview]
Message-ID: <1380040741-23427-1-git-send-email-s.hauer@pengutronix.de> (raw)
To be able to find usb devices in the hardware tree.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/usb/core/usb.c | 2 ++
drivers/usb/host/ehci-hcd.c | 1 +
drivers/usb/host/ohci-hcd.c | 1 +
include/usb/usb.h | 1 +
4 files changed, 5 insertions(+)
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 36fc736..a7dbe2a 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -440,6 +440,8 @@ static int usb_new_device(struct usb_device *dev)
dev->dev.id = DEVICE_ID_SINGLE;
+ if (dev->host->hw_dev)
+ dev->dev.parent = dev->host->hw_dev;
register_device(&dev->dev);
/* now prode if the device is a hub */
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index f44f836..cb6a592 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -883,6 +883,7 @@ int ehci_register(struct device_d *dev, struct ehci_data *data)
ehci->qh_list = dma_alloc_coherent(sizeof(struct QH) * NUM_TD);
ehci->td = dma_alloc_coherent(sizeof(struct qTD) * NUM_TD);
+ host->hw_dev = dev;
host->init = ehci_init;
host->submit_int_msg = submit_int_msg;
host->submit_control_msg = submit_control_msg;
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index ad39bcf..8bf20d0 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1794,6 +1794,7 @@ static int ohci_probe(struct device_d *dev)
ohci = xzalloc(sizeof(struct ohci));
host = &ohci->host;
+ host->hw_dev = dev;
host->init = ohci_init;
host->submit_int_msg = submit_int_msg;
host->submit_control_msg = submit_control_msg;
diff --git a/include/usb/usb.h b/include/usb/usb.h
index 95fb6f3..821724e 100644
--- a/include/usb/usb.h
+++ b/include/usb/usb.h
@@ -210,6 +210,7 @@ struct usb_host {
struct list_head list;
+ struct device_d *hw_dev;
int busnum;
int scanned;
};
--
1.8.4.rc3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
reply other threads:[~2013-09-24 16:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1380040741-23427-1-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox