diff options
Diffstat (limited to 'Documentation/usb/URB.txt')
-rw-r--r-- | Documentation/usb/URB.txt | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/Documentation/usb/URB.txt b/Documentation/usb/URB.txt index 00d2c644068e..50da0d455444 100644 --- a/Documentation/usb/URB.txt +++ b/Documentation/usb/URB.txt | |||
@@ -195,13 +195,12 @@ by the completion handler. | |||
195 | 195 | ||
196 | The handler is of the following type: | 196 | The handler is of the following type: |
197 | 197 | ||
198 | typedef void (*usb_complete_t)(struct urb *, struct pt_regs *) | 198 | typedef void (*usb_complete_t)(struct urb *) |
199 | 199 | ||
200 | I.e., it gets the URB that caused the completion call, plus the | 200 | I.e., it gets the URB that caused the completion call. In the completion |
201 | register values at the time of the corresponding interrupt (if any). | 201 | handler, you should have a look at urb->status to detect any USB errors. |
202 | In the completion handler, you should have a look at urb->status to | 202 | Since the context parameter is included in the URB, you can pass |
203 | detect any USB errors. Since the context parameter is included in the URB, | 203 | information to the completion handler. |
204 | you can pass information to the completion handler. | ||
205 | 204 | ||
206 | Note that even when an error (or unlink) is reported, data may have been | 205 | Note that even when an error (or unlink) is reported, data may have been |
207 | transferred. That's because USB transfers are packetized; it might take | 206 | transferred. That's because USB transfers are packetized; it might take |
@@ -210,12 +209,12 @@ have transferred successfully before the completion was called. | |||
210 | 209 | ||
211 | 210 | ||
212 | NOTE: ***** WARNING ***** | 211 | NOTE: ***** WARNING ***** |
213 | NEVER SLEEP IN A COMPLETION HANDLER. These are normally called | 212 | NEVER SLEEP IN A COMPLETION HANDLER. These are often called in atomic |
214 | during hardware interrupt processing. If you can, defer substantial | 213 | context. |
215 | work to a tasklet (bottom half) to keep system latencies low. You'll | ||
216 | probably need to use spinlocks to protect data structures you manipulate | ||
217 | in completion handlers. | ||
218 | 214 | ||
215 | In the current kernel, completion handlers run with local interrupts | ||
216 | disabled, but in the future this will be changed, so don't assume that | ||
217 | local IRQs are always disabled inside completion handlers. | ||
219 | 218 | ||
220 | 1.8. How to do isochronous (ISO) transfers? | 219 | 1.8. How to do isochronous (ISO) transfers? |
221 | 220 | ||