From patchwork Wed Mar 27 19:29:41 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: 231814 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 316242C008C for ; Thu, 28 Mar 2013 06:27:21 +1100 (EST) Received: from localhost ([::1]:36950 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKw0D-0005W7-Oo for incoming@patchwork.ozlabs.org; Wed, 27 Mar 2013 15:27:17 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKvzc-0005P5-5v for qemu-devel@nongnu.org; Wed, 27 Mar 2013 15:26:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKvza-0002OU-1l for qemu-devel@nongnu.org; Wed, 27 Mar 2013 15:26:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46422) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKvzZ-0002OJ-Qt for qemu-devel@nongnu.org; Wed, 27 Mar 2013 15:26:37 -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 r2RJQKMn025402 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 27 Mar 2013 15:26:20 -0400 Received: from shalem.localdomain.com (vpn1-6-32.ams2.redhat.com [10.36.6.32]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2RJQDDE010123; Wed, 27 Mar 2013 15:26:18 -0400 From: Hans de Goede To: qemu-devel@nongnu.org Date: Wed, 27 Mar 2013 20:29:41 +0100 Message-Id: <1364412581-3672-4-git-send-email-hdegoede@redhat.com> In-Reply-To: <1364412581-3672-1-git-send-email-hdegoede@redhat.com> References: <1364412581-3672-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Paolo Bonzini , Alberto Garcia , Hans de Goede Subject: [Qemu-devel] [PATCH 3/3] ipoctal232: Convert to use chardev properties directly 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 Signed-off-by: Hans de Goede Cc: Alberto Garcia Signed-off-by: Anthony Liguori Signed-off-by: Alberto Garcia --- hw/ipoctal232.c | 43 ++++++++++++++----------------------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/hw/ipoctal232.c b/hw/ipoctal232.c index 345efae..685fee2 100644 --- a/hw/ipoctal232.c +++ b/hw/ipoctal232.c @@ -93,7 +93,6 @@ typedef struct SCC2698Block SCC2698Block; struct SCC2698Channel { IPOctalState *ipoctal; CharDriverState *dev; - char *devpath; bool rx_enabled; uint8_t mr[2]; uint8_t mr_idx; @@ -545,26 +544,12 @@ static int ipoctal_init(IPackDevice *ip) ch->ipoctal = s; /* Redirect IP-Octal channels to host character devices */ - if (ch->devpath) { - const char chr_name[] = "ipoctal"; - char label[ARRAY_SIZE(chr_name) + 2]; - static int index; - - snprintf(label, sizeof(label), "%s%d", chr_name, index); - - ch->dev = qemu_chr_new(label, ch->devpath, NULL); - - if (ch->dev) { - index++; - qemu_chr_fe_claim_no_fail(ch->dev); - qemu_chr_add_handlers(ch->dev, hostdev_can_receive, - hostdev_receive, hostdev_event, ch); - DPRINTF("Redirecting channel %u to %s (%s)\n", - i, ch->devpath, label); - } else { - DPRINTF("Could not redirect channel %u to %s\n", - i, ch->devpath); - } + if (ch->dev) { + qemu_chr_add_handlers(ch->dev, hostdev_can_receive, + hostdev_receive, hostdev_event, ch); + DPRINTF("Redirecting channel %u to %s\n", i, ch->dev->label); + } else { + DPRINTF("Could not redirect channel %u, no chardev set\n", i); } } @@ -572,14 +557,14 @@ static int ipoctal_init(IPackDevice *ip) } static Property ipoctal_properties[] = { - DEFINE_PROP_STRING("serial0", IPOctalState, ch[0].devpath), - DEFINE_PROP_STRING("serial1", IPOctalState, ch[1].devpath), - DEFINE_PROP_STRING("serial2", IPOctalState, ch[2].devpath), - DEFINE_PROP_STRING("serial3", IPOctalState, ch[3].devpath), - DEFINE_PROP_STRING("serial4", IPOctalState, ch[4].devpath), - DEFINE_PROP_STRING("serial5", IPOctalState, ch[5].devpath), - DEFINE_PROP_STRING("serial6", IPOctalState, ch[6].devpath), - DEFINE_PROP_STRING("serial7", IPOctalState, ch[7].devpath), + DEFINE_PROP_CHR("chardev0", IPOctalState, ch[0].dev), + DEFINE_PROP_CHR("chardev1", IPOctalState, ch[1].dev), + DEFINE_PROP_CHR("chardev2", IPOctalState, ch[2].dev), + DEFINE_PROP_CHR("chardev3", IPOctalState, ch[3].dev), + DEFINE_PROP_CHR("chardev4", IPOctalState, ch[4].dev), + DEFINE_PROP_CHR("chardev5", IPOctalState, ch[5].dev), + DEFINE_PROP_CHR("chardev6", IPOctalState, ch[6].dev), + DEFINE_PROP_CHR("chardev7", IPOctalState, ch[7].dev), DEFINE_PROP_END_OF_LIST(), };