From patchwork Tue Mar 29 07:47:25 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: 8683581 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EE3D8C0553 for ; Tue, 29 Mar 2016 07:49:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4DBA320109 for ; Tue, 29 Mar 2016 07:49:33 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A279B200FF for ; Tue, 29 Mar 2016 07:49:32 +0000 (UTC) Received: from localhost ([::1]:44951 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akoP6-00086e-3i for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Mar 2016 03:49:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46392) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akoOn-0007zM-RL for qemu-devel@nongnu.org; Tue, 29 Mar 2016 03:49:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1akoOk-0000Nl-1T for qemu-devel@nongnu.org; Tue, 29 Mar 2016 03:49:13 -0400 Received: from m12-18.163.com ([220.181.12.18]:47801) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akoOi-0000Lv-UB for qemu-devel@nongnu.org; Tue, 29 Mar 2016 03:49:09 -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=SlRSMG7DGi8TaMh9anc+M1IiVf3BT+GgOJ LsTPAJGH0D+tZVfSJ+CAm8eqPhodY8Iwtruca2GLuQEIuh6AIVOwQF3rpt/2oetz +U/KsMv3n7ynu7/57lgZwQvN+6tmlfuw5M03Orl4QAqqnfvN042xzo1D0k3G02I7 ZbddFwKts= Received: from localhost.localdomain (unknown [118.187.28.42]) by smtp14 (Coremail) with SMTP id EsCowEA5HERdM_pWCG9bAA--.33092S8; Tue, 29 Mar 2016 15:48:59 +0800 (CST) From: xiaoqiang zhao To: qemu-devel@nongnu.org Date: Tue, 29 Mar 2016 15:47:25 +0800 Message-Id: <1459237645-17227-7-git-send-email-zxq_yx_007@163.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1459237645-17227-1-git-send-email-zxq_yx_007@163.com> References: <1459237645-17227-1-git-send-email-zxq_yx_007@163.com> X-CM-TRANSID: EsCowEA5HERdM_pWCG9bAA--.33092S8 X-Coremail-Antispam: 1Uf129KBjvJXoW7tw45XF1ktr43Ar1DXrWUArb_yoW8Zw43p3 sxGayakay5tFn0qryrJF17Kr1kJr18JFyqkanrC3WxX3Z5Gr48uF17G3WF9ay5JFy0yrW5 J3WYg3WjyFyUJrJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j4VbgUUUUU= X-Originating-IP: [118.187.28.42] X-CM-SenderInfo: 520ts5t0bqili6rwjhhfrp/1tbiOws7xlXlSosk4QAAs5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 220.181.12.18 Cc: cornelia.huck@de.ibm.com, pbonzini@redhat.com, michael@walle.cc, agraf@suse.de, edgar.iglesias@gmail.com Subject: [Qemu-devel] [PATCH v2 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;