qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 12/30] usb: move USB_REQ_SET_ADDRESS handling to common code
Date: Fri, 17 Dec 2010 12:26:28 +0100	[thread overview]
Message-ID: <1292585206-24862-13-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1292585206-24862-1-git-send-email-kraxel@redhat.com>

USB_REQ_SET_ADDRESS handling is identical in *all* emulated devices.
Move it to common code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb-bt.c     |    4 ----
 hw/usb-desc.c   |    6 ++++++
 hw/usb-hid.c    |    4 ----
 hw/usb-hub.c    |    4 ----
 hw/usb-msd.c    |    4 ----
 hw/usb-net.c    |    5 -----
 hw/usb-serial.c |    4 ----
 hw/usb-wacom.c  |    4 ----
 trace-events    |    1 +
 9 files changed, 7 insertions(+), 29 deletions(-)

diff --git a/hw/usb-bt.c b/hw/usb-bt.c
index d7959ad..c0bfc35 100644
--- a/hw/usb-bt.c
+++ b/hw/usb-bt.c
@@ -413,10 +413,6 @@ static int usb_bt_handle_control(USBDevice *dev, int request, int value,
         }
         ret = 0;
         break;
-    case DeviceOutRequest | USB_REQ_SET_ADDRESS:
-        dev->addr = value;
-        ret = 0;
-        break;
     case DeviceRequest | USB_REQ_GET_CONFIGURATION:
         data[0] = 1;
         ret = 1;
diff --git a/hw/usb-desc.c b/hw/usb-desc.c
index 69ab207..3e87f46 100644
--- a/hw/usb-desc.c
+++ b/hw/usb-desc.c
@@ -266,6 +266,12 @@ int usb_desc_handle_control(USBDevice *dev, int request, int value,
 
     assert(desc != NULL);
     switch(request) {
+    case DeviceOutRequest | USB_REQ_SET_ADDRESS:
+        dev->addr = value;
+        trace_usb_set_addr(dev->addr);
+        ret = 0;
+        break;
+
     case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
         ret = usb_desc_get_descriptor(dev, value, data, length);
         break;
diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index 74d17fc..72daddf 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -695,10 +695,6 @@ static int usb_hid_handle_control(USBDevice *dev, int request, int value,
         }
         ret = 0;
         break;
-    case DeviceOutRequest | USB_REQ_SET_ADDRESS:
-        dev->addr = value;
-        ret = 0;
-        break;
     case DeviceRequest | USB_REQ_GET_CONFIGURATION:
         data[0] = 1;
         ret = 1;
diff --git a/hw/usb-hub.c b/hw/usb-hub.c
index 0f8d060..51a67a2 100644
--- a/hw/usb-hub.c
+++ b/hw/usb-hub.c
@@ -297,10 +297,6 @@ static int usb_hub_handle_control(USBDevice *dev, int request, int value,
         }
         ret = 0;
         break;
-    case DeviceOutRequest | USB_REQ_SET_ADDRESS:
-        dev->addr = value;
-        ret = 0;
-        break;
     case DeviceRequest | USB_REQ_GET_CONFIGURATION:
         data[0] = 1;
         ret = 1;
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index 9aa8888..b54ccbc 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -261,10 +261,6 @@ static int usb_msd_handle_control(USBDevice *dev, int request, int value,
         }
         ret = 0;
         break;
-    case DeviceOutRequest | USB_REQ_SET_ADDRESS:
-        dev->addr = value;
-        ret = 0;
-        break;
     case DeviceRequest | USB_REQ_GET_CONFIGURATION:
         data[0] = 1;
         ret = 1;
diff --git a/hw/usb-net.c b/hw/usb-net.c
index 3a34414..1a57ef7 100644
--- a/hw/usb-net.c
+++ b/hw/usb-net.c
@@ -1075,11 +1075,6 @@ static int usb_net_handle_control(USBDevice *dev, int request, int value,
         ret = 0;
         break;
 
-    case DeviceOutRequest | USB_REQ_SET_ADDRESS:
-        dev->addr = value;
-        ret = 0;
-        break;
-
     case ClassInterfaceOutRequest | USB_CDC_SEND_ENCAPSULATED_COMMAND:
         if (!s->rndis || value || index != 0)
             goto fail;
diff --git a/hw/usb-serial.c b/hw/usb-serial.c
index f89eb9b..c1f31c7 100644
--- a/hw/usb-serial.c
+++ b/hw/usb-serial.c
@@ -254,10 +254,6 @@ static int usb_serial_handle_control(USBDevice *dev, int request, int value,
         }
         ret = 0;
         break;
-    case DeviceOutRequest | USB_REQ_SET_ADDRESS:
-        dev->addr = value;
-        ret = 0;
-        break;
     case DeviceRequest | USB_REQ_GET_CONFIGURATION:
         data[0] = 1;
         ret = 1;
diff --git a/hw/usb-wacom.c b/hw/usb-wacom.c
index ffe6ac7..ad1c3ae 100644
--- a/hw/usb-wacom.c
+++ b/hw/usb-wacom.c
@@ -284,10 +284,6 @@ static int usb_wacom_handle_control(USBDevice *dev, int request, int value,
         }
         ret = 0;
         break;
-    case DeviceOutRequest | USB_REQ_SET_ADDRESS:
-        dev->addr = value;
-        ret = 0;
-        break;
     case DeviceRequest | USB_REQ_GET_CONFIGURATION:
         data[0] = 1;
         ret = 1;
diff --git a/trace-events b/trace-events
index 23303c4..3372b78 100644
--- a/trace-events
+++ b/trace-events
@@ -194,6 +194,7 @@ disable sun4m_iommu_bad_addr(uint64_t addr) "bad addr %"PRIx64""
 disable usb_desc_device(int addr, int len, int ret) "dev %d query device, len %d, ret %d"
 disable usb_desc_config(int addr, int index, int len, int ret) "dev %d query config %d, len %d, ret %d"
 disable usb_desc_string(int addr, int index, int len, int ret) "dev %d query string %d, len %d, ret %d"
+disable usb_set_addr(int addr) "dev %d"
 
 # vl.c
 disable vm_state_notify(int running, int reason) "running %d reason %d"
-- 
1.7.1

  parent reply	other threads:[~2010-12-17 11:27 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-17 11:26 [Qemu-devel] [PATCH 00/30] usb descriptor overhaul + more Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 01/30] usb: update MAINTAINERS Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 02/30] usb: data structs and helpers for usb descriptors Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 03/30] usb hid: use new descriptor infrastructure Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 04/30] usb serial: " Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 05/30] usb storage: " Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 06/30] usb wacom: " Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 07/30] usb bluetooth: " Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 08/30] usb hub: " Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 09/30] usb descriptors: add settable strings Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 10/30] usb storage: serial number support Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 11/30] usb network: use new descriptor infrastructure Gerd Hoffmann
2010-12-17 11:26 ` Gerd Hoffmann [this message]
2010-12-17 11:26 ` [Qemu-devel] [PATCH 13/30] usb: move USB_REQ_{GET, SET}_CONFIGURATION handling to common code Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 14/30] usb: move remote wakeup " Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 15/30] usb: create USBPortOps, move attach there Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 16/30] usb: rework attach/detach workflow Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 17/30] usb: add usb_wakeup() + wakeup callback to port ops Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 18/30] usb: uhci: remote wakeup support Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 19/30] usb: hub: " Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 20/30] usb: hid: " Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 21/30] usb: hid: change serial number to "42" Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 22/30] usb: add speed mask to ports Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 23/30] usb: add attach callback Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 24/30] usb: add usb_desc_attach Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 25/30] usb: add device qualifier support Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 26/30] usb storage: high speed support Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 27/30] usb storage: fix status reporting Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 28/30] usb storage: handle long responses Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 29/30] usb: keep track of physical port address Gerd Hoffmann
2010-12-17 11:26 ` [Qemu-devel] [PATCH 30/30] usb: add port property Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1292585206-24862-13-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).