From patchwork Thu Oct 11 11:40:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 190874 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EEAAE2C008E for ; Thu, 11 Oct 2012 22:40:55 +1100 (EST) Received: from localhost ([::1]:54644 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMH8H-000315-QN for incoming@patchwork.ozlabs.org; Thu, 11 Oct 2012 07:40:53 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44058) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMH7q-0002hx-TO for qemu-devel@nongnu.org; Thu, 11 Oct 2012 07:40:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TMH7q-0008Ob-0Z for qemu-devel@nongnu.org; Thu, 11 Oct 2012 07:40:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8678) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMH7p-0008Ni-Mu for qemu-devel@nongnu.org; Thu, 11 Oct 2012 07:40:25 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9BBeOCj002125 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 11 Oct 2012 07:40:24 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-28.ams2.redhat.com [10.36.116.28]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q9BBeNqh032699; Thu, 11 Oct 2012 07:40:24 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id D4C7E4165B; Thu, 11 Oct 2012 13:40:22 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 11 Oct 2012 13:40:20 +0200 Message-Id: <1349955622-15183-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1349955622-15183-1-git-send-email-kraxel@redhat.com> References: <1349955622-15183-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Hans de Goede , Gerd Hoffmann Subject: [Qemu-devel] [PATCH 1/3] usb-redir: Change usbredir_open_chardev into usbredir_create_parser 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 From: Hans de Goede As we need to create the parser at more places. Signed-off-by: Hans de Goede Signed-off-by: Gerd Hoffmann --- hw/usb/redirect.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index b10241a..5e0f98d 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -862,15 +862,11 @@ static void usbredir_chardev_close_bh(void *opaque) } } -static void usbredir_chardev_open(USBRedirDevice *dev) +static void usbredir_create_parser(USBRedirDevice *dev) { uint32_t caps[USB_REDIR_CAPS_SIZE] = { 0, }; int flags = 0; - /* Make sure any pending closes are handled (no-op if none pending) */ - usbredir_chardev_close_bh(dev); - qemu_bh_cancel(dev->chardev_close_bh); - DPRINTF("creating usbredirparser\n"); dev->parser = qemu_oom_check(usbredirparser_create()); @@ -982,7 +978,10 @@ static void usbredir_chardev_event(void *opaque, int event) switch (event) { case CHR_EVENT_OPENED: DPRINTF("chardev open\n"); - usbredir_chardev_open(dev); + /* Make sure any pending closes are handled (no-op if none pending) */ + usbredir_chardev_close_bh(dev); + qemu_bh_cancel(dev->chardev_close_bh); + usbredir_create_parser(dev); break; case CHR_EVENT_CLOSED: DPRINTF("chardev close\n");