From patchwork Thu Mar 17 09:20:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhao xiao qiang X-Patchwork-Id: 598957 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 3qQjfS45lzz9sCZ for ; Thu, 17 Mar 2016 20:26:40 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=163.com header.i=@163.com header.b=ajnKa3EH; dkim-atps=neutral Received: from localhost ([::1]:33653 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agUCU-0004WQ-Lc for incoming@patchwork.ozlabs.org; Thu, 17 Mar 2016 05:26:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48065) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agU8C-0005RC-T7 for qemu-devel@nongnu.org; Thu, 17 Mar 2016 05:22:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agU8A-0007Wz-CC for qemu-devel@nongnu.org; Thu, 17 Mar 2016 05:22:12 -0400 Received: from m12-11.163.com ([220.181.12.11]:51230) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agU89-0007WB-Vb for qemu-devel@nongnu.org; Thu, 17 Mar 2016 05:22:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=XJqRzs+nq070inSAWO 6KerlsQ88RNFAKsA4ePNth5x4=; b=ajnKa3EHlQbGReoKjP7CeWlWXlfI+h7wO9 KvRGgyIffbanNPVbjQdyYZyHsWLw+Zf9PwIo9bQXljxaHIqzsUHoY5iMf0gqpLhw qMXHIJ/vp/PPbBRmNmggXzqBFbuC+nIyuZCUf/QXVzCnGIaKwY4z+DrmDjhUG2FL 2XR21CCQc= Received: from localhost.localdomain (unknown [118.187.28.42]) by smtp7 (Coremail) with SMTP id C8CowABHoWwpd+pWo3YaAw--.26085S8; Thu, 17 Mar 2016 17:21:56 +0800 (CST) From: xiaoqiang zhao To: qemu-devel@nongnu.org Date: Thu, 17 Mar 2016 17:20:30 +0800 Message-Id: <1458206430-21917-7-git-send-email-zxq_yx_007@163.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1458206430-21917-1-git-send-email-zxq_yx_007@163.com> References: <1458206430-21917-1-git-send-email-zxq_yx_007@163.com> X-CM-TRANSID: C8CowABHoWwpd+pWo3YaAw--.26085S8 X-Coremail-Antispam: 1Uf129KBjvJXoW7tw45XF1ktr43Ar1DXrWUArb_yoW8Zw43p3 sxGayakay5tFn0qryrJF17Kr1kJr18JFyqkanrC3WxX3Z5Gr48uF17G3WF9ay5JFy0yrW5 J3WYg3WjyFyUJrJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jLR6wUUUUU= X-Originating-IP: [118.187.28.42] X-CM-SenderInfo: 520ts5t0bqili6rwjhhfrp/xtbBEhUvxlZXwpsQrwAAsJ X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 220.181.12.11 Cc: cornelia.huck@de.ibm.com, pbonzini@redhat.com, michael@walle.cc, agraf@suse.de, edgar.iglesias@gmail.com Subject: [Qemu-devel] [PATCH 6/6] hw/char: QOM'ify sclpconsole.c 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 Drop the DO_UPCAST macro Signed-off-by: xiaoqiang zhao --- hw/char/sclpconsole.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c index 45997ff..15a5b2b 100644 --- a/hw/char/sclpconsole.c +++ b/hw/char/sclpconsole.c @@ -40,6 +40,10 @@ typedef struct SCLPConsole { bool notify; /* qemu_notify_event() req'd if true */ } SCLPConsole; +#define TYPE_SCLP_CONSOLE "sclpconsole" +#define SCLP_CONSOLE(obj) \ + OBJECT_CHECK(SCLPConsole, (obj), TYPE_SCLP_CONSOLE) + /* character layer call-back functions */ /* Return number of bytes that fit into iov buffer */ @@ -95,7 +99,7 @@ static unsigned int receive_mask(void) static void get_console_data(SCLPEvent *event, uint8_t *buf, size_t *size, int avail) { - SCLPConsole *cons = DO_UPCAST(SCLPConsole, event, event); + SCLPConsole *cons = SCLP_CONSOLE(event); /* first byte is hex 0 saying an ascii string follows */ *buf++ = '\0'; @@ -157,7 +161,7 @@ static int read_event_data(SCLPEvent *event, EventBufferHeader *evt_buf_hdr, static ssize_t write_console_data(SCLPEvent *event, const uint8_t *buf, size_t len) { - SCLPConsole *scon = DO_UPCAST(SCLPConsole, event, event); + SCLPConsole *scon = SCLP_CONSOLE(event); if (!scon->chr) { /* If there's no backend, we can just say we consumed all data. */ @@ -214,7 +218,7 @@ static int console_init(SCLPEvent *event) { static bool console_available; - SCLPConsole *scon = DO_UPCAST(SCLPConsole, event, event); + SCLPConsole *scon = SCLP_CONSOLE(event); if (console_available) { error_report("Multiple VT220 operator consoles are not supported"); @@ -232,7 +236,7 @@ static int console_init(SCLPEvent *event) static void console_reset(DeviceState *dev) { SCLPEvent *event = SCLP_EVENT(dev); - SCLPConsole *scon = DO_UPCAST(SCLPConsole, event, event); + SCLPConsole *scon = SCLP_CONSOLE(event); event->event_pending = false; scon->iov_sclp = 0;