From patchwork Thu Mar 17 08:15:16 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: 8607801 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 B0D6BC0553 for ; Thu, 17 Mar 2016 08:17:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1AA4B201C8 for ; Thu, 17 Mar 2016 08:17:39 +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 74989201DD for ; Thu, 17 Mar 2016 08:17:38 +0000 (UTC) Received: from localhost ([::1]:33224 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agT7h-00043I-Mm for patchwork-qemu-devel@patchwork.kernel.org; Thu, 17 Mar 2016 04:17:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34161) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agT7V-0003ye-6q for qemu-devel@nongnu.org; Thu, 17 Mar 2016 04:17:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agT7R-0004xU-Sq for qemu-devel@nongnu.org; Thu, 17 Mar 2016 04:17:25 -0400 Received: from m12-16.163.com ([220.181.12.16]:37850) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agT7R-0004wp-BK for qemu-devel@nongnu.org; Thu, 17 Mar 2016 04:17:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=sIhr9c4aehWLmXy5nM p7Bygr7k+3Gyc7YuGBr2EjmdQ=; b=puo0Gxbntpu+fY+exujCcmSswG7ERJMixD cJ1QAbZZiV34iGKHm7cKzEA+B1QK6Zn1LwB7OIQCqmqoYrkShJ+DSfrUQn4lZdOK kP3J86M7cFKl+kEvidokB3kquODDseWTcjt+IAu4d9XWUIMw77/jOsY+v1V1Vgsz YtW3ufwsI= Received: from localhost.localdomain (unknown [101.254.142.162]) by smtp12 (Coremail) with SMTP id EMCowEDp6kLjZ+pWZ0wrAA--.19252S5; Thu, 17 Mar 2016 16:17:19 +0800 (CST) From: xiaoqiang zhao To: qemu-devel@nongnu.org Date: Thu, 17 Mar 2016 16:15:16 +0800 Message-Id: <1458202517-3701-4-git-send-email-zxq_yx_007@163.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1458202517-3701-1-git-send-email-zxq_yx_007@163.com> References: <1458202517-3701-1-git-send-email-zxq_yx_007@163.com> X-CM-TRANSID: EMCowEDp6kLjZ+pWZ0wrAA--.19252S5 X-Coremail-Antispam: 1Uf129KBjvJXoW7Cr1rJr4rZry7Zr18uw45Jrb_yoW8XF1xpF ykuF95CFy3Gan2yFs2vFs8Ca15Ar95J3WrK3yftw1SkrW2grWrJF1vvrW5Zas7KrZYyayF qrWDZayUJa12vr7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j9sqXUUUUU= X-Originating-IP: [101.254.142.162] X-CM-SenderInfo: 520ts5t0bqili6rwjhhfrp/1tbiEA8vxlWBUPResQAAsp X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 220.181.12.16 Cc: pbonzini@redhat.com, michael@walle.cc, kraxel@redhat.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH v2 3/4] hw/audio: QOM'ify intel-hda 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 use DeviceClass::realize instead of DeviceClass::init Signed-off-by: xiaoqiang zhao --- hw/audio/intel-hda.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c index 5b1e760..36afbf2 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -50,7 +50,7 @@ void hda_codec_bus_init(DeviceState *dev, HDACodecBus *bus, size_t bus_size, bus->xfer = xfer; } -static int hda_codec_dev_init(DeviceState *qdev) +static void hda_codec_dev_realize(DeviceState *qdev, Error **errp) { HDACodecBus *bus = HDA_BUS(qdev->parent_bus); HDACodecDevice *dev = HDA_CODEC_DEVICE(qdev); @@ -60,10 +60,12 @@ static int hda_codec_dev_init(DeviceState *qdev) dev->cad = bus->next_cad; } if (dev->cad >= 15) { - return -1; + error_setg(errp, "HDA audio codec address is full!"); + return; } bus->next_cad = dev->cad + 1; - return cdc->init(dev); + if (cdc->init(dev) != 0) + error_setg(errp, "HDA audio init failed."); } static int hda_codec_dev_exit(DeviceState *qdev) @@ -1298,7 +1300,7 @@ static const TypeInfo intel_hda_info_ich9 = { static void hda_codec_device_class_init(ObjectClass *klass, void *data) { DeviceClass *k = DEVICE_CLASS(klass); - k->init = hda_codec_dev_init; + k->realize = hda_codec_dev_realize; k->exit = hda_codec_dev_exit; set_bit(DEVICE_CATEGORY_SOUND, k->categories); k->bus_type = TYPE_HDA_BUS;