From patchwork Wed Mar 16 09:24:03 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: 8596961 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E8A639F44D for ; Wed, 16 Mar 2016 09:26:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EB8182034B for ; Wed, 16 Mar 2016 09:26:08 +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 4DE4E2026C for ; Wed, 16 Mar 2016 09:26:08 +0000 (UTC) Received: from localhost ([::1]:54088 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag7iR-0000oc-L2 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 16 Mar 2016 05:26:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag7iD-0000jT-V8 for qemu-devel@nongnu.org; Wed, 16 Mar 2016 05:25:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ag7i9-0004KE-Fv for qemu-devel@nongnu.org; Wed, 16 Mar 2016 05:25:53 -0400 Received: from m12-13.163.com ([220.181.12.13]:58076) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag7i8-0004Gc-N0 for qemu-devel@nongnu.org; Wed, 16 Mar 2016 05:25:49 -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=i+IipbPsV6Xlaw9Ns8dI+faEbgLSorZICR a5t4cOjOjgLYSUMXA8UJG58JnccrOjMDIuTS79RcF2COHawtOrS76E43AhpHPrOJ mDfZn5gUJJOSXmSCfTd/2FfLe/LUqEqQXtvCo9Q5Ex8ADUzXqeH7RaXyJzTkP4Kn 4Y+fnAutg= Received: from localhost.localdomain (unknown [101.254.142.162]) by smtp9 (Coremail) with SMTP id DcCowACndU2BJulW1f_qAA--.46101S5; Wed, 16 Mar 2016 17:25:40 +0800 (CST) From: xiaoqiang zhao To: qemu-devel@nongnu.org Date: Wed, 16 Mar 2016 17:24:03 +0800 Message-Id: <1458120244-30976-4-git-send-email-zxq_yx_007@163.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1458120244-30976-1-git-send-email-zxq_yx_007@163.com> References: <1458120244-30976-1-git-send-email-zxq_yx_007@163.com> X-CM-TRANSID: DcCowACndU2BJulW1f_qAA--.46101S5 X-Coremail-Antispam: 1Uf129KBjvJXoW7Cr1rJr4rZry7Zr18uw45Jrb_yoW8XF1xpF ykuF95CFy3Gan2yFs2vFs8Ca15Ar95J3WrK3yftw1SkrW2grWrJF1vvrW5Zas7KrZYyayF qrWDZayUJa12vr7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j9sqXUUUUU= X-Originating-IP: [101.254.142.162] X-CM-SenderInfo: 520ts5t0bqili6rwjhhfrp/1tbiOxQuxlXlSXRU4gAAs8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 220.181.12.13 Cc: michael@walle.cc, kraxel@redhat.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH 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;