aboutsummaryrefslogtreecommitdiff
path: root/hw/usb.h
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2011-05-12 13:48:13 +0200
committerGerd Hoffmann <kraxel@redhat.com>2011-05-26 11:55:03 +0200
commit4ff658fb6c4f1cb7f771b16f808547e4f5767d02 (patch)
treeef76e89e2fe1e8a710876f96de06eb104a6000da /hw/usb.h
parent53aa8c0e2af473050fa765533a8d69f3450788ab (diff)
usb: keep track of packet owner.
Keep track of the device which owns the usb packet for async processing. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb.h')
-rw-r--r--hw/usb.h18
1 files changed, 3 insertions, 15 deletions
diff --git a/hw/usb.h b/hw/usb.h
index 68894671bf..80e8e902c6 100644
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -262,11 +262,14 @@ struct USBPacket {
uint8_t *data;
int len;
/* Internal use by the USB layer. */
+ USBDevice *owner;
USBCallback *cancel_cb;
void *cancel_opaque;
};
int usb_handle_packet(USBDevice *dev, USBPacket *p);
+void usb_packet_complete(USBDevice *dev, USBPacket *p);
+void usb_cancel_packet(USBPacket * p);
/* Defer completion of a USB packet. The hadle_packet routine should then
return USB_RET_ASYNC. Packets that complete immediately (before
@@ -278,21 +281,6 @@ static inline void usb_defer_packet(USBPacket *p, USBCallback *cancel,
p->cancel_opaque = opaque;
}
-/* Notify the controller that an async packet is complete. This should only
- be called for packets previously deferred with usb_defer_packet, and
- should never be called from within handle_packet. */
-static inline void usb_packet_complete(USBDevice *dev, USBPacket *p)
-{
- dev->port->ops->complete(dev, p);
-}
-
-/* Cancel an active packet. The packed must have been deferred with
- usb_defer_packet, and not yet completed. */
-static inline void usb_cancel_packet(USBPacket * p)
-{
- p->cancel_cb(p, p->cancel_opaque);
-}
-
void usb_attach(USBPort *port, USBDevice *dev);
void usb_wakeup(USBDevice *dev);
int usb_generic_handle_packet(USBDevice *s, USBPacket *p);