From patchwork Tue Mar 26 10:07:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 231153 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 56C0B2C00C3 for ; Tue, 26 Mar 2013 21:13:28 +1100 (EST) Received: from localhost ([::1]:52659 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKQp0-0001UG-Rz for incoming@patchwork.ozlabs.org; Tue, 26 Mar 2013 06:09:38 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56409) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKQkN-0002qV-IO for qemu-devel@nongnu.org; Tue, 26 Mar 2013 06:04:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKQkL-0007GJ-OO for qemu-devel@nongnu.org; Tue, 26 Mar 2013 06:04:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7883) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKQkL-0007Fr-Hg for qemu-devel@nongnu.org; Tue, 26 Mar 2013 06:04:49 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2QA4nMC027749 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 26 Mar 2013 06:04:49 -0400 Received: from shalem.localdomain.com (vpn1-6-123.ams2.redhat.com [10.36.6.123]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r2QA4ag0014732; Tue, 26 Mar 2013 06:04:47 -0400 From: Hans de Goede To: qemu-devel@nongnu.org Date: Tue, 26 Mar 2013 11:07:59 +0100 Message-Id: <1364292483-16564-8-git-send-email-hdegoede@redhat.com> In-Reply-To: <1364292483-16564-1-git-send-email-hdegoede@redhat.com> References: <1364292483-16564-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Amit Shah , Hans de Goede , Gerd Hoffmann Subject: [Qemu-devel] [PATCH 07/11] qemu-char: Move incrementing of avail_connections to qdev-properties-system 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 The decrement of avail_connections is done in qdev-properties-system move the increment there too for proper balancing of the calls. Signed-off-by: Hans de Goede --- hw/qdev-properties-system.c | 6 ++++-- qemu-char.c | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/qdev-properties-system.c b/hw/qdev-properties-system.c index 8795144..12a87d5 100644 --- a/hw/qdev-properties-system.c +++ b/hw/qdev-properties-system.c @@ -136,9 +136,11 @@ static void release_chr(Object *obj, const char *name, void *opaque) DeviceState *dev = DEVICE(obj); Property *prop = opaque; CharDriverState **ptr = qdev_get_prop_ptr(dev, prop); + CharDriverState *chr = *ptr; - if (*ptr) { - qemu_chr_add_handlers(*ptr, NULL, NULL, NULL, NULL); + if (chr) { + qemu_chr_add_handlers(chr, NULL, NULL, NULL, NULL); + ++chr->avail_connections; } } diff --git a/qemu-char.c b/qemu-char.c index 8a66627..368e7f5 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -197,8 +197,6 @@ void qemu_chr_add_handlers(CharDriverState *s, int fe_open; if (!opaque && !fd_can_read && !fd_read && !fd_event) { - /* chr driver being released. */ - ++s->avail_connections; fe_open = 0; } else { fe_open = 1;