diff mbox

usb: Use usb_bus_find(-1) instead of usb_enabled() in usb_device_add/usb_device_del

Message ID 1433404534-12003-1-git-send-email-lma@suse.com
State New
Headers show

Commit Message

Lin Ma June 4, 2015, 7:55 a.m. UTC
Without usb=on machine option, usb_device_add/usb_device_del don't work,
Even if there are virtual usb controllers presented.

This patch fixes it.

Signed-off-by: Lin Ma <lma@suse.com>
---
 vl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Gerd Hoffmann June 16, 2015, 1:31 p.m. UTC | #1
On Do, 2015-06-04 at 15:55 +0800, Lin Ma wrote:
> Without usb=on machine option, usb_device_add/usb_device_del don't work,
> Even if there are virtual usb controllers presented.

If you use -device to add your usb host controllers, you should likewise
use -device (or device_add monitor cmd) to add your usb devices.

-usbdevice is legacy syntax and only there for backward compatibility.

cheers,
  Gerd
diff mbox

Patch

diff --git a/vl.c b/vl.c
index 1d4c089..26fab83 100644
--- a/vl.c
+++ b/vl.c
@@ -1234,7 +1234,7 @@  static int usb_device_add(const char *devname)
     const char *p;
 #endif
 
-    if (!usb_enabled()) {
+    if (!usb_bus_find(-1)) {
         return -1;
     }
 
@@ -1266,7 +1266,7 @@  static int usb_device_del(const char *devname)
         return -1;
     }
 
-    if (!usb_enabled()) {
+    if (!usb_bus_find(-1)) {
         return -1;
     }