Commit 4d043a09007d4d06c07b941d881ee298a026961e
1 parent
b9dc033c
Quiet warnings introduced with the USB iso support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3329 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
46 additions
and
43 deletions
usb-linux.c
... | ... | @@ -84,9 +84,9 @@ typedef struct PendingURB { |
84 | 84 | struct PendingURB *next; |
85 | 85 | } PendingURB; |
86 | 86 | |
87 | -PendingURB *pending_urbs = NULL; | |
87 | +static PendingURB *pending_urbs = NULL; | |
88 | 88 | |
89 | -int add_pending_urb(struct usbdevfs_urb *urb) | |
89 | +static int add_pending_urb(struct usbdevfs_urb *urb) | |
90 | 90 | { |
91 | 91 | PendingURB *purb = qemu_mallocz(sizeof(PendingURB)); |
92 | 92 | if (purb) { |
... | ... | @@ -101,7 +101,7 @@ int add_pending_urb(struct usbdevfs_urb *urb) |
101 | 101 | return 0; |
102 | 102 | } |
103 | 103 | |
104 | -int del_pending_urb(struct usbdevfs_urb *urb) | |
104 | +static int del_pending_urb(struct usbdevfs_urb *urb) | |
105 | 105 | { |
106 | 106 | PendingURB *purb = pending_urbs; |
107 | 107 | PendingURB *prev = NULL; |
... | ... | @@ -123,7 +123,8 @@ int del_pending_urb(struct usbdevfs_urb *urb) |
123 | 123 | return 0; |
124 | 124 | } |
125 | 125 | |
126 | -PendingURB *get_pending_urb(struct usbdevfs_urb *urb) | |
126 | +#ifdef USE_ASYNCIO | |
127 | +static PendingURB *get_pending_urb(struct usbdevfs_urb *urb) | |
127 | 128 | { |
128 | 129 | PendingURB *purb = pending_urbs; |
129 | 130 | |
... | ... | @@ -136,6 +137,7 @@ PendingURB *get_pending_urb(struct usbdevfs_urb *urb) |
136 | 137 | } |
137 | 138 | return NULL; |
138 | 139 | } |
140 | +#endif | |
139 | 141 | |
140 | 142 | static int usb_host_update_interfaces(USBHostDevice *dev, int configuration) |
141 | 143 | { |
... | ... | @@ -338,9 +340,46 @@ static int usb_host_handle_data(USBDevice *dev, USBPacket *p) |
338 | 340 | } |
339 | 341 | } |
340 | 342 | |
341 | -static void usb_linux_bh_cb(void *opaque); | |
343 | +#ifdef USE_ASYNCIO | |
344 | +static void usb_linux_bh_cb(void *opaque) | |
345 | +{ | |
346 | + PendingURB *pending_urb = (PendingURB *)opaque; | |
347 | + USBHostDevice *s = pending_urb->dev; | |
348 | + struct usbdevfs_urb *purb = NULL; | |
349 | + USBPacket *p = s->packet; | |
350 | + int ret; | |
351 | + | |
352 | + /* FIXME: handle purb->status */ | |
353 | + qemu_free(pending_urb->bh); | |
354 | + del_pending_urb(pending_urb->urb); | |
355 | + | |
356 | + if (!p) { | |
357 | + s->urbs_ready++; | |
358 | + return; | |
359 | + } | |
360 | + | |
361 | + ret = ioctl(s->fd, USBDEVFS_REAPURBNDELAY, &purb); | |
362 | + if (ret < 0) { | |
363 | + printf("usb_linux_bh_cb: REAPURBNDELAY ioctl=%d errno=%d\n", | |
364 | + ret, errno); | |
365 | + return; | |
366 | + } | |
367 | + | |
368 | +#ifdef DEBUG_ISOCH | |
369 | + if (purb == pending_urb->urb) { | |
370 | + printf("usb_linux_bh_cb: urb mismatch reaped=%p pending=%p\n", | |
371 | + purb, urb); | |
372 | + } | |
373 | +#endif | |
374 | + | |
375 | + p->len = purb->actual_length; | |
376 | + usb_packet_complete(p); | |
377 | + qemu_free(purb); | |
378 | + s->packet = NULL; | |
379 | +} | |
342 | 380 | |
343 | -void isoch_done(int signum, siginfo_t *info, void *context) { | |
381 | +static void isoch_done(int signum, siginfo_t *info, void *context) | |
382 | +{ | |
344 | 383 | struct usbdevfs_urb *urb = (struct usbdevfs_urb *)info->si_addr; |
345 | 384 | USBHostDevice *s = (USBHostDevice *)urb->usercontext; |
346 | 385 | PendingURB *purb; |
... | ... | @@ -360,6 +399,7 @@ void isoch_done(int signum, siginfo_t *info, void *context) { |
360 | 399 | } |
361 | 400 | } |
362 | 401 | } |
402 | +#endif | |
363 | 403 | |
364 | 404 | static int usb_host_handle_isoch(USBDevice *dev, USBPacket *p) |
365 | 405 | { |
... | ... | @@ -447,43 +487,6 @@ static int usb_host_handle_isoch(USBDevice *dev, USBPacket *p) |
447 | 487 | #endif |
448 | 488 | } |
449 | 489 | |
450 | -static void usb_linux_bh_cb(void *opaque) | |
451 | -{ | |
452 | - PendingURB *pending_urb = (PendingURB *)opaque; | |
453 | - USBHostDevice *s = pending_urb->dev; | |
454 | - struct usbdevfs_urb *purb = NULL; | |
455 | - USBPacket *p = s->packet; | |
456 | - int ret; | |
457 | - | |
458 | - /* FIXME: handle purb->status */ | |
459 | - qemu_free(pending_urb->bh); | |
460 | - del_pending_urb(pending_urb->urb); | |
461 | - | |
462 | - if (!p) { | |
463 | - s->urbs_ready++; | |
464 | - return; | |
465 | - } | |
466 | - | |
467 | - ret = ioctl(s->fd, USBDEVFS_REAPURBNDELAY, &purb); | |
468 | - if (ret < 0) { | |
469 | - printf("usb_linux_bh_cb: REAPURBNDELAY ioctl=%d errno=%d\n", | |
470 | - ret, errno); | |
471 | - return; | |
472 | - } | |
473 | - | |
474 | -#ifdef DEBUG_ISOCH | |
475 | - if (purb == pending_urb->urb) { | |
476 | - printf("usb_linux_bh_cb: urb mismatch reaped=%p pending=%p\n", | |
477 | - purb, urb); | |
478 | - } | |
479 | -#endif | |
480 | - | |
481 | - p->len = purb->actual_length; | |
482 | - usb_packet_complete(p); | |
483 | - qemu_free(purb); | |
484 | - s->packet = NULL; | |
485 | -} | |
486 | - | |
487 | 490 | /* returns 1 on problem encountered or 0 for success */ |
488 | 491 | static int usb_linux_update_endp_table(USBHostDevice *s) |
489 | 492 | { | ... | ... |