From patchwork Thu Jun 4 07:55:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lin Ma X-Patchwork-Id: 480548 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id CD971140213 for ; Thu, 4 Jun 2015 17:56:56 +1000 (AEST) Received: from localhost ([::1]:40940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0Q1F-0008Dp-CI for incoming@patchwork.ozlabs.org; Thu, 04 Jun 2015 03:56:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0Q0u-0007lw-QR for qemu-devel@nongnu.org; Thu, 04 Jun 2015 03:56:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0Q0q-00063H-Pq for qemu-devel@nongnu.org; Thu, 04 Jun 2015 03:56:32 -0400 Received: from smtp.nue.novell.com ([195.135.221.5]:60415) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0Q0q-0005ut-JX for qemu-devel@nongnu.org; Thu, 04 Jun 2015 03:56:28 -0400 Received: from linux-wc25.site (ip-203-192-156-9.asianetcom.net [203.192.156.9]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Thu, 04 Jun 2015 09:56:23 +0200 From: Lin Ma To: qemu-devel@nongnu.org, kraxel@redhat.com Date: Thu, 4 Jun 2015 15:55:34 +0800 Message-Id: <1433404534-12003-1-git-send-email-lma@suse.com> X-Mailer: git-send-email 2.1.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.135.221.5 Cc: Lin Ma Subject: [Qemu-devel] [PATCH] usb: Use usb_bus_find(-1) instead of usb_enabled() in usb_device_add/usb_device_del X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- vl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; }