[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 19/58] isa: Convert uses of isa_create() with Coccinelle
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v2 19/58] isa: Convert uses of isa_create() with Coccinelle |
Date: |
Sat, 30 May 2020 07:07:37 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Markus Armbruster <armbru@redhat.com> writes:
> Replace
>
> dev = isa_create(bus, type_name);
> ...
> qdev_init_nofail(dev);
>
> by
>
> dev = isa_new(type_name);
> ...
> isa_realize_and_unref(dev, bus, &error_fatal);
>
> Recent commit "qdev: New qdev_new(), qdev_realize(), etc." explains
> why.
>
> Coccinelle script:
>
> @@
> expression dev, bus, expr;
> expression list args;
> expression d;
> @@
> - dev = isa_create(bus, args);
> + dev = isa_new(args);
> (
> d = &dev->qdev;
> |
> d = DEVICE(dev);
> )
> ... when != dev = expr
> - qdev_init_nofail(d);
> + isa_realize_and_unref(dev, bus, &error_fatal);
>
> @@
> expression dev, bus, expr;
> expression list args;
> @@
> - dev = isa_create(bus, args);
> + dev = isa_new(args);
> ... when != dev = expr
> - qdev_init_nofail(DEVICE(dev));
> + isa_realize_and_unref(dev, bus, &error_fatal);
>
> @@
> expression dev, bus, expr;
> expression list args;
> @@
> - dev = DEVICE(isa_create(bus, args));
> + ISADevice *isa_dev; // TODO move
> + isa_dev = isa_new(args);
> + dev = DEVICE(isa_dev);
> ... when != dev = expr
> - qdev_init_nofail(dev);
> + isa_realize_and_unref(isa_dev, bus, &error_fatal);
>
> Missing #include "qapi/error.h" added manually, whitespace changes
> minimized manually.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Squash in:
>From 82cd9900d9c24048bc4cc0c22568af4d1ea663c2 Mon Sep 17 00:00:00 2001
From: Markus Armbruster <armbru@redhat.com>
Date: Sat, 30 May 2020 07:06:06 +0200
Subject: [PATCH] fixup! isa: Convert uses of isa_create() with Coccinelle
---
hw/rtc/m48t59-isa.c | 2 +-
hw/sparc64/sun4u.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/rtc/m48t59-isa.c b/hw/rtc/m48t59-isa.c
index f641225301..50430b7a85 100644
--- a/hw/rtc/m48t59-isa.c
+++ b/hw/rtc/m48t59-isa.c
@@ -62,6 +62,7 @@ static M48txxInfo m48txx_isa_info[] = {
Nvram *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size,
int base_year, int model)
{
+ ISADevice *isa_dev;
DeviceState *dev;
int i;
@@ -71,7 +72,6 @@ Nvram *m48t59_init_isa(ISABus *bus, uint32_t io_base,
uint16_t size,
continue;
}
- ISADevice *isa_dev; // TODO move
isa_dev = isa_new(m48txx_isa_info[i].bus_name);
dev = DEVICE(isa_dev);
qdev_prop_set_uint32(dev, "iobase", io_base);
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 11440e7457..97e6d3a025 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -300,6 +300,7 @@ static void ebus_isa_irq_handler(void *opaque, int n, int
level)
static void ebus_realize(PCIDevice *pci_dev, Error **errp)
{
EbusState *s = EBUS(pci_dev);
+ ISADevice *isa_dev;
SysBusDevice *sbd;
DeviceState *dev;
qemu_irq *isa_irq;
@@ -338,7 +339,6 @@ static void ebus_realize(PCIDevice *pci_dev, Error **errp)
for (i = 0; i < MAX_FD; i++) {
fd[i] = drive_get(IF_FLOPPY, 0, i);
}
- ISADevice *isa_dev; // TODO move
isa_dev = isa_new(TYPE_ISA_FDC);
dev = DEVICE(isa_dev);
if (fd[0]) {
--
2.21.3
- [PATCH v2 02/58] Revert "hw/prep: realize the PCI root bus as part of the prep init", (continued)
- [PATCH v2 02/58] Revert "hw/prep: realize the PCI root bus as part of the prep init", Markus Armbruster, 2020/05/29
- [PATCH v2 10/58] qdev: Convert uses of qdev_create() manually, Markus Armbruster, 2020/05/29
- [PATCH v2 08/58] qdev: Convert to qdev_unrealize() manually, Markus Armbruster, 2020/05/29
- [PATCH v2 07/58] qdev: Convert to qdev_unrealize() with Coccinelle, Markus Armbruster, 2020/05/29
- [PATCH v2 03/58] Revert "hw/versatile: realize the PCI root bus as part of the versatile init", Markus Armbruster, 2020/05/29
- [PATCH v2 25/58] ssi: ssi_create_slave_no_init() is now unused, drop, Markus Armbruster, 2020/05/29
- [PATCH v2 14/58] hw/ppc: Eliminate two superfluous QOM casts, Markus Armbruster, 2020/05/29
- [PATCH v2 30/58] qdev: qdev_create(), qdev_try_create() are now unused, drop, Markus Armbruster, 2020/05/29
- [PATCH v2 12/58] qdev: Convert uses of qdev_set_parent_bus() manually, Markus Armbruster, 2020/05/29
- [PATCH v2 19/58] isa: Convert uses of isa_create() with Coccinelle, Markus Armbruster, 2020/05/29
- Re: [PATCH v2 19/58] isa: Convert uses of isa_create() with Coccinelle,
Markus Armbruster <=
- [PATCH v2 21/58] isa: isa_create(), isa_try_create() are now unused, drop, Markus Armbruster, 2020/05/29
- [PATCH v2 22/58] ssi: ssi_auto_connect_slaves() never does anything, drop, Markus Armbruster, 2020/05/29
- [PATCH v2 31/58] auxbus: Rename aux_init_bus() to aux_bus_init(), Markus Armbruster, 2020/05/29
- [PATCH v2 34/58] auxbus: Eliminate aux_create_slave(), Markus Armbruster, 2020/05/29
- [PATCH v2 38/58] macio: Eliminate macio_init_child_obj(), Markus Armbruster, 2020/05/29
- [PATCH v2 32/58] auxbus: New aux_bus_realize(), pairing with aux_bus_init(), Markus Armbruster, 2020/05/29
- [PATCH v2 35/58] qom: Tidy up a few object_initialize_child() calls, Markus Armbruster, 2020/05/29
- [PATCH v2 33/58] auxbus: Convert a use of qdev_set_parent_bus(), Markus Armbruster, 2020/05/29
- [PATCH v2 15/58] pci: Convert uses of pci_create() etc. with Coccinelle, Markus Armbruster, 2020/05/29
- [PATCH v2 37/58] macio: Convert use of qdev_set_parent_bus(), Markus Armbruster, 2020/05/29