]> git.proxmox.com Git - mirror_qemu.git/commitdiff
usb: make USBDevice->attached bool
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 15 Jun 2016 09:46:56 +0000 (11:46 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 22 Jun 2016 10:53:26 +0000 (12:53 +0200)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1465984019-28963-3-git-send-email-kraxel@redhat.com

hw/usb/bus.c
include/hw/usb.h

index 16c3461d99717642b6b0ab13357fc7325a1dbc56..afd70ea5997fa4b4391fdd0586ae8647e8467d5c 100644 (file)
@@ -55,9 +55,9 @@ static int usb_device_post_load(void *opaque, int version_id)
     USBDevice *dev = opaque;
 
     if (dev->state == USB_STATE_NOTATTACHED) {
-        dev->attached = 0;
+        dev->attached = false;
     } else {
-        dev->attached = 1;
+        dev->attached = true;
     }
     if (dev->setup_index < 0 ||
         dev->setup_len < 0 ||
@@ -533,7 +533,7 @@ void usb_device_attach(USBDevice *dev, Error **errp)
         return;
     }
 
-    dev->attached++;
+    dev->attached = true;
     usb_attach(port);
 }
 
@@ -547,7 +547,7 @@ int usb_device_detach(USBDevice *dev)
     trace_usb_port_detach(bus->busnr, port->path);
 
     usb_detach(port);
-    dev->attached--;
+    dev->attached = false;
     return 0;
 }
 
index 163fe0490bc60a43971a3e186698e0cb43e1e31c..8f3947069e1d60e04e99c0c3cd1d06ce4ffc74a2 100644 (file)
@@ -235,7 +235,7 @@ struct USBDevice {
     uint8_t addr;
     char product_desc[32];
     int auto_attach;
-    int attached;
+    bool attached;
 
     int32_t state;
     uint8_t setup_buf[8];