[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/18] usb-linux: track aurbs in list
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 10/18] usb-linux: track aurbs in list |
Date: |
Mon, 16 May 2011 21:56:14 +0200 |
This patch adds code to track all async urbs in a linked list,
so we can find them without having to pass around a opaque
pointer to them. Prerequisite for the cleanups.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
usb-linux.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/usb-linux.c b/usb-linux.c
index b75c48b..3c5a248 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -121,6 +121,7 @@ typedef struct USBHostDevice {
Notifier exit;
struct endp_data endp_table[MAX_ENDPOINTS];
+ QLIST_HEAD(, AsyncURB) aurbs;
/* Host side address */
int bus_num;
@@ -223,22 +224,27 @@ struct AsyncURB
{
struct usbdevfs_urb urb;
struct usbdevfs_iso_packet_desc isocpd[ISO_FRAME_DESC_PER_URB];
+ USBHostDevice *hdev;
+ QLIST_ENTRY(AsyncURB) next;
/* For regular async urbs */
USBPacket *packet;
- USBHostDevice *hdev;
/* For buffered iso handling */
int iso_frame_idx; /* -1 means in flight */
};
-static AsyncURB *async_alloc(void)
+static AsyncURB *async_alloc(USBHostDevice *s)
{
- return (AsyncURB *) qemu_mallocz(sizeof(AsyncURB));
+ AsyncURB *aurb = qemu_mallocz(sizeof(AsyncURB));
+ aurb->hdev = s;
+ QLIST_INSERT_HEAD(&s->aurbs, aurb, next);
+ return aurb;
}
static void async_free(AsyncURB *aurb)
{
+ QLIST_REMOVE(aurb, next);
qemu_free(aurb);
}
@@ -661,8 +667,7 @@ static int usb_host_handle_data(USBDevice *dev, USBPacket
*p)
return usb_host_handle_iso_data(s, p, p->pid == USB_TOKEN_IN);
}
- aurb = async_alloc();
- aurb->hdev = s;
+ aurb = async_alloc(s);
aurb->packet = p;
urb = &aurb->urb;
@@ -787,8 +792,7 @@ static int usb_host_handle_control(USBDevice *dev,
USBPacket *p,
return USB_RET_STALL;
}
- aurb = async_alloc();
- aurb->hdev = s;
+ aurb = async_alloc(s);
aurb->packet = p;
/*
--
1.7.1
- [Qemu-devel] [PATCH 00/18] usb patch queue: add usb 2.0, Gerd Hoffmann, 2011/05/16
- [Qemu-devel] [PATCH 06/18] usb: Pass the packet to the device's handle_control callback, Gerd Hoffmann, 2011/05/16
- [Qemu-devel] [PATCH 01/18] usb: Add Interface Association Descriptor descriptor type, Gerd Hoffmann, 2011/05/16
- [Qemu-devel] [PATCH 13/18] usb-linux: fix max_packet_size for highspeed., Gerd Hoffmann, 2011/05/16
- [Qemu-devel] [PATCH 03/18] usb: remove fallback to bNumInterfaces if no .nif, Gerd Hoffmann, 2011/05/16
- [Qemu-devel] [PATCH 09/18] usb-linux: add hostport property, Gerd Hoffmann, 2011/05/16
- [Qemu-devel] [PATCH 05/18] Bug #757654: UHCI fails to signal stall response patch, Gerd Hoffmann, 2011/05/16
- [Qemu-devel] [PATCH 10/18] usb-linux: track aurbs in list,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 11/18] usb-linux: walk async urb list in cancel, Gerd Hoffmann, 2011/05/16
- [Qemu-devel] [PATCH 14/18] usb: add usb_handle_packet, Gerd Hoffmann, 2011/05/16
- [Qemu-devel] [PATCH 02/18] usb: update config descriptors to identify number of interfaces, Gerd Hoffmann, 2011/05/16
- [Qemu-devel] [PATCH 12/18] usb-linux: split large xfers, Gerd Hoffmann, 2011/05/16
- [Qemu-devel] [PATCH 08/18] usb-linux: fix device path aka physical port handling, Gerd Hoffmann, 2011/05/16
- [Qemu-devel] [PATCH 04/18] usb: add support for "grouped" interfaces and the Interface Association Descriptor, Gerd Hoffmann, 2011/05/16
- [Qemu-devel] [PATCH 17/18] usb-storage: don't call usb_packet_complete twice, Gerd Hoffmann, 2011/05/16