summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--hw/usb-msd.c6
-rw-r--r--hw/usb-net.c5
-rw-r--r--hw/usb-ohci.c2
-rw-r--r--hw/usb.h4
4 files changed, 7 insertions, 10 deletions
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index e9235eaf67..c1c2537475 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -327,14 +327,12 @@ static int usb_msd_handle_control(USBDevice *dev, int request, int value,
         ret = 0;
         break;
         /* Class specific requests.  */
-    case (((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8) | MassStorageReset):
-    case MassStorageReset:
+    case ClassInterfaceOutRequest | MassStorageReset:
         /* Reset state ready for the next CBW.  */
         s->mode = USB_MSDM_CBW;
         ret = 0;
         break;
-    case (((USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8) | GetMaxLun):
-    case GetMaxLun:
+    case ClassInterfaceRequest | GetMaxLun:
         data[0] = 0;
         ret = 1;
         break;
diff --git a/hw/usb-net.c b/hw/usb-net.c
index 4c17435c84..ff0ca44237 100644
--- a/hw/usb-net.c
+++ b/hw/usb-net.c
@@ -71,11 +71,6 @@ enum usbstring_idx {
 #define USB_DT_CS_INTERFACE		0x24
 #define USB_DT_CS_ENDPOINT		0x25
 
-#define ClassInterfaceRequest		\
-    ((USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8)
-#define ClassInterfaceOutRequest	\
-    ((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8)
-
 #define USB_CDC_SEND_ENCAPSULATED_COMMAND	0x00
 #define USB_CDC_GET_ENCAPSULATED_RESPONSE	0x01
 #define USB_CDC_REQ_SET_LINE_CODING		0x20
diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index 93f7d79483..61ad6142c5 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -907,7 +907,7 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed)
     flag_r = (td.flags & OHCI_TD_R) != 0;
 #ifdef DEBUG_PACKET
     DPRINTF(" TD @ 0x%.8x %" PRId64 " bytes %s r=%d cbp=0x%.8x be=0x%.8x\n",
-            addr, len, str, flag_r, td.cbp, td.be);
+            addr, (int64_t)len, str, flag_r, td.cbp, td.be);
 
     if (len > 0 && dir != OHCI_TD_DIR_IN) {
         DPRINTF("  data:");
diff --git a/hw/usb.h b/hw/usb.h
index 106d1744f1..00d2802206 100644
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -91,6 +91,10 @@
 #define EndpointRequest ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_ENDPOINT)<<8)
 #define EndpointOutRequest \
         ((USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_ENDPOINT)<<8)
+#define ClassInterfaceRequest \
+        ((USB_DIR_IN|USB_TYPE_CLASS|USB_RECIP_INTERFACE)<<8)
+#define ClassInterfaceOutRequest \
+        ((USB_DIR_OUT|USB_TYPE_CLASS|USB_RECIP_INTERFACE)<<8)
 
 #define USB_REQ_GET_STATUS		0x00
 #define USB_REQ_CLEAR_FEATURE		0x01