All of lore.kernel.org
 help / color / mirror / Atom feed
From: xiaoqiang zhao <zxq_yx_007@163.com>
To: qemu-devel@nongnu.org
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
Date: Thu, 17 Mar 2016 17:06:15 +0800	[thread overview]
Message-ID: <1458205576-21646-4-git-send-email-zxq_yx_007@163.com> (raw)
In-Reply-To: <1458205576-21646-1-git-send-email-zxq_yx_007@163.com>

use DeviceClass::realize instead of DeviceClass::init

Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
---
 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;
-- 
2.1.4

  parent reply	other threads:[~2016-03-17  9:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-17  9:06 [Qemu-devel] [RESEND PATCH v2 0/4] QOM'ify hw/audio files xiaoqiang zhao
2016-03-17  9:06 ` [Qemu-devel] [RESEND PATCH v2 1/4] hw/audio: QOM'ify cs4231.c xiaoqiang zhao
2016-03-17  9:06 ` [Qemu-devel] [RESEND PATCH v2 2/4] hw/audio: QOM cleanup for intel-hda xiaoqiang zhao
2016-03-17  9:06 ` xiaoqiang zhao [this message]
2016-05-11 11:27   ` [Qemu-devel] [RESEND PATCH v2 3/4] hw/audio: QOM'ify intel-hda Gerd Hoffmann
2016-05-11 11:47     ` xiaoqiang zhao
2016-03-17  9:06 ` [Qemu-devel] [RESEND PATCH v2 4/4] hw/audio: QOM'ify milkymist-ac97.c xiaoqiang zhao
2016-05-09  9:03   ` michael
2016-03-29  7:28 ` [Qemu-devel] [RESEND PATCH v2 0/4] QOM'ify hw/audio files zxq_yx_007
2016-05-05 10:42 ` 赵小强

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1458205576-21646-4-git-send-email-zxq_yx_007@163.com \
    --to=zxq_yx_007@163.com \
    --cc=afaerber@suse.de \
    --cc=kraxel@redhat.com \
    --cc=michael@walle.cc \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.