aboutsummaryrefslogtreecommitdiff
path: root/hw/display
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-06-10 07:31:59 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-06-15 22:05:08 +0200
commitdf70796916ebbafe262a01c1c4dc6d7af805de24 (patch)
tree67c5b6e80f36502d9e653f4ae826b9304d1d95de /hw/display
parent3e80f6902c13f6edb6675c0f33edcbbf0163ec32 (diff)
qdev: Convert uses of qdev_create() manually
Same transformation as in the previous commit. Manual, because convincing Coccinelle to transform these cases is somewhere between not worthwhile and infeasible (at least for me). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20200610053247.1583243-11-armbru@redhat.com>
Diffstat (limited to 'hw/display')
-rw-r--r--hw/display/ati.c5
-rw-r--r--hw/display/sm501.c5
-rw-r--r--hw/display/xlnx_dp.c5
3 files changed, 7 insertions, 8 deletions
diff --git a/hw/display/ati.c b/hw/display/ati.c
index 1d9df92b96..7216f7e08f 100644
--- a/hw/display/ati.c
+++ b/hw/display/ati.c
@@ -933,10 +933,9 @@ static void ati_vga_realize(PCIDevice *dev, Error **errp)
/* ddc, edid */
I2CBus *i2cbus = i2c_init_bus(DEVICE(s), "ati-vga.ddc");
bitbang_i2c_init(&s->bbi2c, i2cbus);
- I2CSlave *i2cddc = I2C_SLAVE(qdev_create(BUS(i2cbus), TYPE_I2CDDC));
+ I2CSlave *i2cddc = I2C_SLAVE(qdev_new(TYPE_I2CDDC));
i2c_set_slave_address(i2cddc, 0x50);
- object_property_set_bool(OBJECT(i2cddc), true, "realized",
- &error_abort);
+ qdev_realize_and_unref(DEVICE(i2cddc), BUS(i2cbus), &error_abort);
/* mmio register space */
memory_region_init_io(&s->mm, OBJECT(s), &ati_mm_ops, s,
diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index 7ff14fd474..3e62eca3de 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -1831,10 +1831,9 @@ static void sm501_init(SM501State *s, DeviceState *dev,
/* i2c */
s->i2c_bus = i2c_init_bus(dev, "sm501.i2c");
/* ddc */
- I2CDDCState *ddc = I2CDDC(qdev_create(BUS(s->i2c_bus), TYPE_I2CDDC));
+ I2CDDCState *ddc = I2CDDC(qdev_new(TYPE_I2CDDC));
i2c_set_slave_address(I2C_SLAVE(ddc), 0x50);
- object_property_set_bool(OBJECT(ddc), true, "realized",
- &error_abort);
+ qdev_realize_and_unref(DEVICE(ddc), BUS(s->i2c_bus), &error_abort);
/* mmio */
memory_region_init(&s->mmio_region, OBJECT(dev), "sm501.mmio", MMIO_SIZE);
diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c
index 5210412e55..6e9793584a 100644
--- a/hw/display/xlnx_dp.c
+++ b/hw/display/xlnx_dp.c
@@ -1252,7 +1252,7 @@ static void xlnx_dp_init(Object *obj)
s->dpcd = DPCD(aux_create_slave(s->aux_bus, "dpcd"));
object_property_add_child(OBJECT(s), "dpcd", OBJECT(s->dpcd));
- s->edid = I2CDDC(qdev_create(BUS(aux_get_i2c_bus(s->aux_bus)), "i2c-ddc"));
+ s->edid = I2CDDC(qdev_new("i2c-ddc"));
i2c_set_slave_address(I2C_SLAVE(s->edid), 0x50);
object_property_add_child(OBJECT(s), "edid", OBJECT(s->edid));
@@ -1271,7 +1271,8 @@ static void xlnx_dp_realize(DeviceState *dev, Error **errp)
qdev_init_nofail(DEVICE(s->dpcd));
aux_map_slave(AUX_SLAVE(s->dpcd), 0x0000);
- qdev_init_nofail(DEVICE(s->edid));
+ qdev_realize_and_unref(DEVICE(s->edid), BUS(aux_get_i2c_bus(s->aux_bus)),
+ &error_fatal);
s->console = graphic_console_init(dev, 0, &xlnx_dp_gfx_ops, s);
surface = qemu_console_surface(s->console);