From patchwork Thu Mar 17 09:06:15 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: 8608461 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 23F029F6E1 for ; Thu, 17 Mar 2016 09:10:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7EE39202E6 for ; Thu, 17 Mar 2016 09:10: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 D651D2026F for ; Thu, 17 Mar 2016 09:10:07 +0000 (UTC) Received: from localhost ([::1]:33563 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agTwV-0007TH-3k for patchwork-qemu-devel@patchwork.kernel.org; Thu, 17 Mar 2016 05:10:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agTuO-0003YX-QX for qemu-devel@nongnu.org; Thu, 17 Mar 2016 05:08:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agTuN-0004b3-E9 for qemu-devel@nongnu.org; Thu, 17 Mar 2016 05:07:56 -0400 Received: from m12-17.163.com ([220.181.12.17]:49224) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agTuL-0004Zm-S8 for qemu-devel@nongnu.org; Thu, 17 Mar 2016 05:07:55 -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=Q3Uho97tshOCC2sXMcxvyDopOqj7KnIBNn wcX8o2/zYA9Aj5dcdiYmnphbMRmpXUXKrwRj3A8GE3VQkdHTrLfno8e92+YYngoF 17yaSoNn+LSWTO5pHgq8kJSwUi8ck2Wxq2j/CSaXbLGjzwJNm9Uz4evioqvabWjn 6RhU1ldpY= Received: from localhost.localdomain (unknown [118.187.28.42]) by smtp13 (Coremail) with SMTP id EcCowADn0SzUc+pWwyspAw--.30326S5; Thu, 17 Mar 2016 17:07:48 +0800 (CST) From: xiaoqiang zhao To: qemu-devel@nongnu.org Date: Thu, 17 Mar 2016 17:06:15 +0800 Message-Id: <1458205576-21646-4-git-send-email-zxq_yx_007@163.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1458205576-21646-1-git-send-email-zxq_yx_007@163.com> References: <1458205576-21646-1-git-send-email-zxq_yx_007@163.com> X-CM-TRANSID: EcCowADn0SzUc+pWwyspAw--.30326S5 X-Coremail-Antispam: 1Uf129KBjvJXoW7Cr1rJr4rZry7Zr18uw45Jrb_yoW8XF1xpF ykuF95CFy3Gan2yFs2vFs8Ca15Ar95J3WrK3yftw1SkrW2grWrJF1vvrW5Zas7KrZYyayF qrWDZayUJa12vr7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07b8xhdUUUUU= X-Originating-IP: [118.187.28.42] X-CM-SenderInfo: 520ts5t0bqili6rwjhhfrp/1tbiTAMvxlSIN8px+QABsO X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 220.181.12.17 Cc: pbonzini@redhat.com, michael@walle.cc, kraxel@redhat.com, afaerber@suse.de Subject: [Qemu-devel] [RESEND 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;