mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 08/12] usb: honour timeout fields
Date: Mon, 19 Sep 2011 14:15:45 +0200	[thread overview]
Message-ID: <1316434549-15243-8-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1316434549-15243-1-git-send-email-plagnioj@jcrosoft.com>

From: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/usb/core/usb.c      |   18 +++++-------------
 drivers/usb/host/ehci-hcd.c |    4 ++--
 include/usb/usb.h           |    4 ++--
 3 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 24fa94a..ff60fea 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -531,6 +531,7 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
 			void *data, unsigned short size, int timeout)
 {
 	struct usb_host *host = dev->host;
+	int ret;
 
 	if ((timeout == 0) && (!asynch_allowed)) {
 		/* request for a asynch control pipe is not allowed */
@@ -548,18 +549,9 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
 		   request, requesttype, value, index, size);
 	dev->status = USB_ST_NOT_PROC; /*not yet processed */
 
-	host->submit_control_msg(dev, pipe, data, size, &setup_packet);
-	if (timeout == 0)
-		return (int)size;
-
-	if (dev->status != 0) {
-		/*
-		 * Let's wait a while for the timeout to elapse.
-		 * It has no real use, but it keeps the interface happy.
-		 */
-		wait_ms(timeout);
-		return -1;
-	}
+	ret = host->submit_control_msg(dev, pipe, data, size, &setup_packet, timeout);
+	if (ret)
+		return ret;
 
 	return dev->act_len;
 }
@@ -579,7 +571,7 @@ int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
 		return -1;
 
 	dev->status = USB_ST_NOT_PROC; /* not yet processed */
-	ret = host->submit_bulk_msg(dev, pipe, data, len);
+	ret = host->submit_bulk_msg(dev, pipe, data, len, timeout);
 	if (ret)
 		return ret;
 
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 60fc181..828c5d9 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -850,7 +850,7 @@ static int ehci_init(struct usb_host *host)
 
 static int
 submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-		int length)
+		int length, int timeout)
 {
 
 	if (usb_pipetype(pipe) != PIPE_BULK) {
@@ -862,7 +862,7 @@ submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 
 static int
 submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-		   int length, struct devrequest *setup)
+		   int length, struct devrequest *setup, int timeout)
 {
 	struct usb_host *host = dev->host;
 	struct ehci_priv *ehci = to_ehci(host);
diff --git a/include/usb/usb.h b/include/usb/usb.h
index 6ef9977..6715786 100644
--- a/include/usb/usb.h
+++ b/include/usb/usb.h
@@ -205,9 +205,9 @@ struct usb_host {
 	int (*init)(struct usb_host *);
 	int (*exit)(struct usb_host *);
 	int (*submit_bulk_msg)(struct usb_device *dev, unsigned long pipe,
-			void *buffer, int transfer_len);
+			void *buffer, int transfer_len, int timeout);
 	int (*submit_control_msg)(struct usb_device *dev, unsigned long pipe, void *buffer,
-			int transfer_len, struct devrequest *setup);
+			int transfer_len, struct devrequest *setup, int timeout);
 	int (*submit_int_msg)(struct usb_device *dev, unsigned long pipe, void *buffer,
 			int transfer_len, int interval);
 	void (*usb_event_poll)(void);
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2011-09-19 12:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-19 12:15 [PATCH 01/12 v2] arm: export arch_number to env Jean-Christophe PLAGNIOL-VILLARD
2011-09-19 12:15 ` [PATCH 02/12] at91: fix cpu clock speed display Jean-Christophe PLAGNIOL-VILLARD
2011-09-19 12:15 ` [PATCH 03/12] at91: Fix uhpck clock rate in upll case Jean-Christophe PLAGNIOL-VILLARD
2011-09-19 12:15 ` [PATCH 04/12] at91/boards: switch to software ecc as in linux kernel Jean-Christophe PLAGNIOL-VILLARD
2011-09-19 12:15 ` [PATCH 05/12] resource: introduce add_generic_device_res to add multiple resource Jean-Christophe PLAGNIOL-VILLARD
2011-09-19 12:15 ` [PATCH 06/12] at91: nand switch ecc base to resource Jean-Christophe PLAGNIOL-VILLARD
2011-09-19 12:15 ` [PATCH 07/12] usb/core: make print dev like linux lsusb Jean-Christophe PLAGNIOL-VILLARD
2011-09-19 12:15 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2011-09-19 12:15 ` [PATCH 09/12] initial ohci support Jean-Christophe PLAGNIOL-VILLARD
2011-09-19 12:15 ` [PATCH 10/12] at91: add " Jean-Christophe PLAGNIOL-VILLARD
2011-09-19 13:05   ` Hubert Feurstein
2011-09-19 12:15 ` [PATCH 11/12] at91: add Calao USB-A960 and USB-A9G20 C01 & C11 board support Jean-Christophe PLAGNIOL-VILLARD
2011-09-19 12:15 ` [PATCH 12/12] at91: add Calao USB-A9263 Jean-Christophe PLAGNIOL-VILLARD
2011-09-20 19:13 ` [PATCH 01/12 v2] arm: export arch_number to env Sascha Hauer

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=1316434549-15243-8-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --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