diff options
author | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2009-12-09 18:59:06 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-02 17:53:10 -0500 |
commit | b45b506911247008f694dcaf1d8220a4942ebc4f (patch) | |
tree | 63dbdca8d1e755d890aa8fb4f6be2a0bfcfd9bde /drivers/usb/host/xhci-ring.c | |
parent | a1d78c16bd31a715785e21967ac6110b386a3c1f (diff) |
USB: xhci: Refactor test for vendor-specific completion codes.
All commands that can be issued to the xHCI hardware can come back with
vendor-specific "informational" completion codes. These are to be treated
like a successful completion code. Refactor out the code to test for the
range of these codes and print debugging messages.
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/xhci-ring.c')
-rw-r--r-- | drivers/usb/host/xhci-ring.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index ee7bc7ecbc59..f43e073dee96 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -1080,6 +1080,20 @@ static int xhci_requires_manual_halt_cleanup(struct xhci_hcd *xhci, | |||
1080 | return 0; | 1080 | return 0; |
1081 | } | 1081 | } |
1082 | 1082 | ||
1083 | int xhci_is_vendor_info_code(struct xhci_hcd *xhci, unsigned int trb_comp_code) | ||
1084 | { | ||
1085 | if (trb_comp_code >= 224 && trb_comp_code <= 255) { | ||
1086 | /* Vendor defined "informational" completion code, | ||
1087 | * treat as not-an-error. | ||
1088 | */ | ||
1089 | xhci_dbg(xhci, "Vendor defined info completion code %u\n", | ||
1090 | trb_comp_code); | ||
1091 | xhci_dbg(xhci, "Treating code as success.\n"); | ||
1092 | return 1; | ||
1093 | } | ||
1094 | return 0; | ||
1095 | } | ||
1096 | |||
1083 | /* | 1097 | /* |
1084 | * If this function returns an error condition, it means it got a Transfer | 1098 | * If this function returns an error condition, it means it got a Transfer |
1085 | * event with a corrupted Slot ID, Endpoint ID, or TRB DMA address. | 1099 | * event with a corrupted Slot ID, Endpoint ID, or TRB DMA address. |
@@ -1196,13 +1210,7 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
1196 | status = -ENOSR; | 1210 | status = -ENOSR; |
1197 | break; | 1211 | break; |
1198 | default: | 1212 | default: |
1199 | if (trb_comp_code >= 224 && trb_comp_code <= 255) { | 1213 | if (xhci_is_vendor_info_code(xhci, trb_comp_code)) { |
1200 | /* Vendor defined "informational" completion code, | ||
1201 | * treat as not-an-error. | ||
1202 | */ | ||
1203 | xhci_dbg(xhci, "Vendor defined info completion code %u\n", | ||
1204 | trb_comp_code); | ||
1205 | xhci_dbg(xhci, "Treating code as success.\n"); | ||
1206 | status = 0; | 1214 | status = 0; |
1207 | break; | 1215 | break; |
1208 | } | 1216 | } |