[PATCHv2] USB: URB: Return -EALREADY for urbs in flight

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Disambiguate between invalid URBs (ones that seem impossible
to submit because they are broken) and ones that should not be
submitted because they are already in flight.

Signed-off-by: Paul Stewart <pstew@xxxxxxxxxxxx>
---
 Documentation/usb/error-codes.txt |    2 ++
 drivers/usb/core/urb.c            |    4 +++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/Documentation/usb/error-codes.txt b/Documentation/usb/error-codes.txt
index d83703e..f5e059f 100644
--- a/Documentation/usb/error-codes.txt
+++ b/Documentation/usb/error-codes.txt
@@ -35,6 +35,8 @@ USB-specific:
 		d) ISO: number_of_packets is < 0
 		e) various other cases
 
+-EALREADY	URB has already been submitted and is in flight
+
 -EAGAIN		a) specified ISO start frame too early
 		b) (using ISO-ASAP) too much scheduled for the future
 		   wait some time and try again.
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index ae334b0..50f5346 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -305,8 +305,10 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
 	struct usb_host_endpoint	*ep;
 	int				is_out;
 
-	if (!urb || urb->hcpriv || !urb->complete)
+	if (!urb || !urb->complete)
 		return -EINVAL;
+	if (urb->hcpriv)
+		return -EALREADY;
 	dev = urb->dev;
 	if ((!dev) || (dev->state < USB_STATE_UNAUTHENTICATED))
 		return -ENODEV;
-- 
1.7.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux