[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 4/5] hw/audio: QOM'ify intel-hda
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 4/5] hw/audio: QOM'ify intel-hda |
Date: |
Mon, 6 Jun 2016 09:02:58 +0200 |
From: xiaoqiang zhao <address@hidden>
* use DeviceClass::realize instead of DeviceClass::init
Signed-off-by: xiaoqiang zhao <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/audio/intel-hda.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
index 5b1e760..93d7669 100644
--- a/hw/audio/intel-hda.c
+++ b/hw/audio/intel-hda.c
@@ -26,6 +26,7 @@
#include "intel-hda.h"
#include "intel-hda-defs.h"
#include "sysemu/dma.h"
+#include "qapi/error.h"
/* --------------------------------------------------------------------- */
/* hda bus */
@@ -50,7 +51,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 +61,13 @@ 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 +1302,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;
--
1.8.3.1
- [Qemu-devel] [PULL 0/5] audio patch queue, Gerd Hoffmann, 2016/06/06
- [Qemu-devel] [PULL 5/5] hw/audio: QOM'ify milkymist-ac97.c, Gerd Hoffmann, 2016/06/06
- [Qemu-devel] [PULL 3/5] hw/audio: QOM cleanup for intel-hda, Gerd Hoffmann, 2016/06/06
- [Qemu-devel] [PULL 2/5] hw/audio: QOM'ify cs4231.c, Gerd Hoffmann, 2016/06/06
- [Qemu-devel] [PULL 1/5] audio: pa: Set volume of recording stream instead of recording device, Gerd Hoffmann, 2016/06/06
- [Qemu-devel] [PULL 4/5] hw/audio: QOM'ify intel-hda,
Gerd Hoffmann <=
- Re: [Qemu-devel] [PULL 0/5] audio patch queue, Peter Maydell, 2016/06/06