audio/intel-hda: QOM casting sweep
Define and use standard QOM cast macro. Remove usages of DO_UPCAST and direct -> style casting. Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 96f00396338321f5a76c9b86c629b69895e4d2d0.1370496582.git.peter.crosthwaite@xilinx.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
062db74023
commit
52bb7c6a06
|
@ -191,6 +191,9 @@ struct IntelHDAState {
|
||||||
|
|
||||||
#define TYPE_INTEL_HDA_GENERIC "intel-hda-generic"
|
#define TYPE_INTEL_HDA_GENERIC "intel-hda-generic"
|
||||||
|
|
||||||
|
#define INTEL_HDA(obj) \
|
||||||
|
OBJECT_CHECK(IntelHDAState, (obj), TYPE_INTEL_HDA_GENERIC)
|
||||||
|
|
||||||
struct IntelHDAReg {
|
struct IntelHDAReg {
|
||||||
const char *name; /* register name */
|
const char *name; /* register name */
|
||||||
uint32_t size; /* size in bytes */
|
uint32_t size; /* size in bytes */
|
||||||
|
@ -500,7 +503,7 @@ static void intel_hda_notify_codecs(IntelHDAState *d, uint32_t stream, bool runn
|
||||||
static void intel_hda_set_g_ctl(IntelHDAState *d, const IntelHDAReg *reg, uint32_t old)
|
static void intel_hda_set_g_ctl(IntelHDAState *d, const IntelHDAReg *reg, uint32_t old)
|
||||||
{
|
{
|
||||||
if ((d->g_ctl & ICH6_GCTL_RESET) == 0) {
|
if ((d->g_ctl & ICH6_GCTL_RESET) == 0) {
|
||||||
intel_hda_reset(&d->pci.qdev);
|
intel_hda_reset(DEVICE(d));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1104,7 +1107,7 @@ static const MemoryRegionOps intel_hda_mmio_ops = {
|
||||||
static void intel_hda_reset(DeviceState *dev)
|
static void intel_hda_reset(DeviceState *dev)
|
||||||
{
|
{
|
||||||
BusChild *kid;
|
BusChild *kid;
|
||||||
IntelHDAState *d = DO_UPCAST(IntelHDAState, pci.qdev, dev);
|
IntelHDAState *d = INTEL_HDA(dev);
|
||||||
HDACodecDevice *cdev;
|
HDACodecDevice *cdev;
|
||||||
|
|
||||||
intel_hda_regs_reset(d);
|
intel_hda_regs_reset(d);
|
||||||
|
@ -1122,7 +1125,7 @@ static void intel_hda_reset(DeviceState *dev)
|
||||||
|
|
||||||
static int intel_hda_init(PCIDevice *pci)
|
static int intel_hda_init(PCIDevice *pci)
|
||||||
{
|
{
|
||||||
IntelHDAState *d = DO_UPCAST(IntelHDAState, pci, pci);
|
IntelHDAState *d = INTEL_HDA(pci);
|
||||||
uint8_t *conf = d->pci.config;
|
uint8_t *conf = d->pci.config;
|
||||||
|
|
||||||
d->name = object_get_typename(OBJECT(d));
|
d->name = object_get_typename(OBJECT(d));
|
||||||
|
@ -1139,7 +1142,7 @@ static int intel_hda_init(PCIDevice *pci)
|
||||||
msi_init(&d->pci, 0x50, 1, true, false);
|
msi_init(&d->pci, 0x50, 1, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
hda_codec_bus_init(&d->pci.qdev, &d->codecs,
|
hda_codec_bus_init(DEVICE(pci), &d->codecs,
|
||||||
intel_hda_response, intel_hda_xfer);
|
intel_hda_response, intel_hda_xfer);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1147,7 +1150,7 @@ static int intel_hda_init(PCIDevice *pci)
|
||||||
|
|
||||||
static void intel_hda_exit(PCIDevice *pci)
|
static void intel_hda_exit(PCIDevice *pci)
|
||||||
{
|
{
|
||||||
IntelHDAState *d = DO_UPCAST(IntelHDAState, pci, pci);
|
IntelHDAState *d = INTEL_HDA(pci);
|
||||||
|
|
||||||
msi_uninit(&d->pci);
|
msi_uninit(&d->pci);
|
||||||
memory_region_destroy(&d->mmio);
|
memory_region_destroy(&d->mmio);
|
||||||
|
@ -1312,12 +1315,12 @@ static const TypeInfo hda_codec_device_type_info = {
|
||||||
*/
|
*/
|
||||||
static int intel_hda_and_codec_init(PCIBus *bus)
|
static int intel_hda_and_codec_init(PCIBus *bus)
|
||||||
{
|
{
|
||||||
PCIDevice *controller;
|
DeviceState *controller;
|
||||||
BusState *hdabus;
|
BusState *hdabus;
|
||||||
DeviceState *codec;
|
DeviceState *codec;
|
||||||
|
|
||||||
controller = pci_create_simple(bus, -1, "intel-hda");
|
controller = DEVICE(pci_create_simple(bus, -1, "intel-hda"));
|
||||||
hdabus = QLIST_FIRST(&controller->qdev.child_bus);
|
hdabus = QLIST_FIRST(&controller->child_bus);
|
||||||
codec = qdev_create(hdabus, "hda-duplex");
|
codec = qdev_create(hdabus, "hda-duplex");
|
||||||
qdev_init_nofail(codec);
|
qdev_init_nofail(codec);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue