yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
958e1b
From eccc9faa264d2228126d4fccc5a603b70b02cc9c Mon Sep 17 00:00:00 2001
958e1b
From: Gerd Hoffmann <kraxel@redhat.com>
958e1b
Date: Fri, 11 Jul 2014 14:20:54 +0200
958e1b
Subject: [PATCH 20/43] usb: Add usb_device_alloc/free_streams
958e1b
958e1b
Message-id: <1405088470-24115-22-git-send-email-kraxel@redhat.com>
958e1b
Patchwork-id: 59833
958e1b
O-Subject: [RHEL-7.1 qemu-kvm PATCH 21/37] usb: Add usb_device_alloc/free_streams
958e1b
Bugzilla: 1111450
958e1b
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
958e1b
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
958e1b
958e1b
From: Hans de Goede <hdegoede@redhat.com>
958e1b
958e1b
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
958e1b
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
958e1b
(cherry picked from commit 3b444eadf7726d976be4ac89e8e742cb7eb7a5ee)
958e1b
---
958e1b
 hw/usb/bus.c     | 18 ++++++++++++++++++
958e1b
 include/hw/usb.h | 12 ++++++++++++
958e1b
 2 files changed, 30 insertions(+)
958e1b
958e1b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
---
958e1b
 hw/usb/bus.c     | 18 ++++++++++++++++++
958e1b
 include/hw/usb.h | 12 ++++++++++++
958e1b
 2 files changed, 30 insertions(+)
958e1b
958e1b
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
958e1b
index f4eeb5e..12641fe 100644
958e1b
--- a/hw/usb/bus.c
958e1b
+++ b/hw/usb/bus.c
958e1b
@@ -206,6 +206,24 @@ void usb_device_ep_stopped(USBDevice *dev, USBEndpoint *ep)
958e1b
     }
958e1b
 }
958e1b
 
958e1b
+int usb_device_alloc_streams(USBDevice *dev, USBEndpoint **eps, int nr_eps,
958e1b
+                             int streams)
958e1b
+{
958e1b
+    USBDeviceClass *klass = USB_DEVICE_GET_CLASS(dev);
958e1b
+    if (klass->alloc_streams) {
958e1b
+        return klass->alloc_streams(dev, eps, nr_eps, streams);
958e1b
+    }
958e1b
+    return 0;
958e1b
+}
958e1b
+
958e1b
+void usb_device_free_streams(USBDevice *dev, USBEndpoint **eps, int nr_eps)
958e1b
+{
958e1b
+    USBDeviceClass *klass = USB_DEVICE_GET_CLASS(dev);
958e1b
+    if (klass->free_streams) {
958e1b
+        klass->free_streams(dev, eps, nr_eps);
958e1b
+    }
958e1b
+}
958e1b
+
958e1b
 static int usb_qdev_init(DeviceState *qdev)
958e1b
 {
958e1b
     USBDevice *dev = USB_DEVICE(qdev);
958e1b
diff --git a/include/hw/usb.h b/include/hw/usb.h
958e1b
index 116293e..000001b 100644
958e1b
--- a/include/hw/usb.h
958e1b
+++ b/include/hw/usb.h
958e1b
@@ -327,6 +327,14 @@ typedef struct USBDeviceClass {
958e1b
      */
958e1b
     void (*ep_stopped)(USBDevice *dev, USBEndpoint *ep);
958e1b
 
958e1b
+    /*
958e1b
+     * Called by the hcd to alloc / free streams on a bulk endpoint.
958e1b
+     * Optional may be NULL.
958e1b
+     */
958e1b
+    int (*alloc_streams)(USBDevice *dev, USBEndpoint **eps, int nr_eps,
958e1b
+                         int streams);
958e1b
+    void (*free_streams)(USBDevice *dev, USBEndpoint **eps, int nr_eps);
958e1b
+
958e1b
     const char *product_desc;
958e1b
     const USBDesc *usb_desc;
958e1b
 } USBDeviceClass;
958e1b
@@ -564,6 +572,10 @@ void usb_device_flush_ep_queue(USBDevice *dev, USBEndpoint *ep);
958e1b
 
958e1b
 void usb_device_ep_stopped(USBDevice *dev, USBEndpoint *ep);
958e1b
 
958e1b
+int usb_device_alloc_streams(USBDevice *dev, USBEndpoint **eps, int nr_eps,
958e1b
+                             int streams);
958e1b
+void usb_device_free_streams(USBDevice *dev, USBEndpoint **eps, int nr_eps);
958e1b
+
958e1b
 const char *usb_device_get_product_desc(USBDevice *dev);
958e1b
 
958e1b
 const USBDesc *usb_device_get_usb_desc(USBDevice *dev);
958e1b
-- 
958e1b
1.8.3.1
958e1b