mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-01-04 05:30:31 -07:00
qdev: Put qdev_new() to use with Coccinelle
Let's start simple and put qdev_new() to use. Coccinelle script:
@ depends on !(file in "hw/core/qdev.c")@
expression type_name;
@@
- DEVICE(object_new(type_name))
+ qdev_new(type_name)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200610053247.1583243-6-armbru@redhat.com>
This commit is contained in:
parent
9940b2cfbc
commit
4e3a6778b0
3 changed files with 3 additions and 3 deletions
|
|
@ -644,7 +644,7 @@ DeviceState *nand_init(BlockBackend *blk, int manf_id, int chip_id)
|
|||
if (nand_flash_ids[chip_id].size == 0) {
|
||||
hw_error("%s: Unsupported NAND chip ID.\n", __func__);
|
||||
}
|
||||
dev = DEVICE(object_new(TYPE_NAND));
|
||||
dev = qdev_new(TYPE_NAND);
|
||||
qdev_prop_set_uint8(dev, "manufacturer_id", manf_id);
|
||||
qdev_prop_set_uint8(dev, "chip_id", chip_id);
|
||||
if (blk) {
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ DeviceState *aux_create_slave(AUXBus *bus, const char *type)
|
|||
{
|
||||
DeviceState *dev;
|
||||
|
||||
dev = DEVICE(object_new(type));
|
||||
dev = qdev_new(type);
|
||||
assert(dev);
|
||||
qdev_set_parent_bus(dev, &bus->qbus);
|
||||
return dev;
|
||||
|
|
|
|||
|
|
@ -652,7 +652,7 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
|
|||
}
|
||||
|
||||
/* create device */
|
||||
dev = DEVICE(object_new(driver));
|
||||
dev = qdev_new(driver);
|
||||
|
||||
/* Check whether the hotplug is allowed by the machine */
|
||||
if (qdev_hotplug && !qdev_hotplug_allowed(dev, &err)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue