diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2007-08-21 15:40:36 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-12 17:55:19 -0400 |
commit | eb23105462304fd35571fd0cab1de7aec79a9ec5 (patch) | |
tree | 3579e74b3f1a6e68d42de01c122d206447454d4b /drivers/usb/host/r8a66597-hcd.c | |
parent | b0d9efba3ec53468984aecef8eeaf079089f2e5a (diff) |
USB: add urb->unlinked field
This patch (as970) adds a new urb->unlinked field, which is used to
store the status of unlinked URBs since we can't use urb->status for
that purpose any more. To help simplify the HCDs, usbcore will check
urb->unlinked before calling the completion handler; if the value is
set it will automatically override the status reported by the HCD.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: David Brownell <david-b@pacbell.net>
CC: Olav Kongas <ok@artecdesign.ee>
CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
CC: Tony Olech <tony.olech@elandigitalsystems.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/r8a66597-hcd.c')
-rw-r--r-- | drivers/usb/host/r8a66597-hcd.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index 60248b01ce14..98b9e0547544 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c | |||
@@ -1118,7 +1118,7 @@ __releases(r8a66597->lock) __acquires(r8a66597->lock) | |||
1118 | r8a66597->timeout_map &= ~(1 << pipenum); | 1118 | r8a66597->timeout_map &= ~(1 << pipenum); |
1119 | 1119 | ||
1120 | if (likely(td)) { | 1120 | if (likely(td)) { |
1121 | if (td->set_address && urb->status != 0) | 1121 | if (td->set_address && (urb->status != 0 || urb->unlinked)) |
1122 | r8a66597->address_map &= ~(1 << urb->setup_packet[2]); | 1122 | r8a66597->address_map &= ~(1 << urb->setup_packet[2]); |
1123 | 1123 | ||
1124 | pipe_toggle_save(r8a66597, td->pipe, urb); | 1124 | pipe_toggle_save(r8a66597, td->pipe, urb); |
@@ -1225,8 +1225,7 @@ static void packet_read(struct r8a66597 *r8a66597, u16 pipenum) | |||
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | if (finish && pipenum != 0) { | 1227 | if (finish && pipenum != 0) { |
1228 | if (td->urb->status == -EINPROGRESS) | 1228 | td->urb->status = status; |
1229 | td->urb->status = status; | ||
1230 | finish_request(r8a66597, td, pipenum, urb); | 1229 | finish_request(r8a66597, td, pipenum, urb); |
1231 | } | 1230 | } |
1232 | } | 1231 | } |
@@ -1308,32 +1307,24 @@ static void check_next_phase(struct r8a66597 *r8a66597) | |||
1308 | switch (td->type) { | 1307 | switch (td->type) { |
1309 | case USB_PID_IN: | 1308 | case USB_PID_IN: |
1310 | case USB_PID_OUT: | 1309 | case USB_PID_OUT: |
1311 | if (urb->status != -EINPROGRESS) { | ||
1312 | finish = 1; | ||
1313 | break; | ||
1314 | } | ||
1315 | if (check_transfer_finish(td, urb)) | 1310 | if (check_transfer_finish(td, urb)) |
1316 | td->type = USB_PID_ACK; | 1311 | td->type = USB_PID_ACK; |
1317 | break; | 1312 | break; |
1318 | case USB_PID_SETUP: | 1313 | case USB_PID_SETUP: |
1319 | if (urb->status != -EINPROGRESS) | 1314 | if (urb->transfer_buffer_length == urb->actual_length) |
1320 | finish = 1; | ||
1321 | else if (urb->transfer_buffer_length == urb->actual_length) { | ||
1322 | td->type = USB_PID_ACK; | 1315 | td->type = USB_PID_ACK; |
1323 | urb->status = 0; | 1316 | else if (usb_pipeout(urb->pipe)) |
1324 | } else if (usb_pipeout(urb->pipe)) | ||
1325 | td->type = USB_PID_OUT; | 1317 | td->type = USB_PID_OUT; |
1326 | else | 1318 | else |
1327 | td->type = USB_PID_IN; | 1319 | td->type = USB_PID_IN; |
1328 | break; | 1320 | break; |
1329 | case USB_PID_ACK: | 1321 | case USB_PID_ACK: |
1330 | finish = 1; | 1322 | finish = 1; |
1331 | if (urb->status == -EINPROGRESS) | 1323 | urb->status = 0; |
1332 | urb->status = 0; | ||
1333 | break; | 1324 | break; |
1334 | } | 1325 | } |
1335 | 1326 | ||
1336 | if (finish) | 1327 | if (finish || urb->unlinked) |
1337 | finish_request(r8a66597, td, 0, urb); | 1328 | finish_request(r8a66597, td, 0, urb); |
1338 | else | 1329 | else |
1339 | start_transfer(r8a66597, td); | 1330 | start_transfer(r8a66597, td); |
@@ -1418,8 +1409,7 @@ static void irq_pipe_empty(struct r8a66597 *r8a66597) | |||
1418 | if ((tmp & INBUFM) == 0) { | 1409 | if ((tmp & INBUFM) == 0) { |
1419 | disable_irq_empty(r8a66597, pipenum); | 1410 | disable_irq_empty(r8a66597, pipenum); |
1420 | pipe_irq_disable(r8a66597, pipenum); | 1411 | pipe_irq_disable(r8a66597, pipenum); |
1421 | if (td->urb->status == -EINPROGRESS) | 1412 | td->urb->status = 0; |
1422 | td->urb->status = 0; | ||
1423 | finish_request(r8a66597, td, pipenum, td->urb); | 1413 | finish_request(r8a66597, td, pipenum, td->urb); |
1424 | } | 1414 | } |
1425 | } | 1415 | } |