qemu-e2k/hw/ide
Markus Armbruster 96927c744f isa: Convert uses of isa_create() with Coccinelle
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>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200610053247.1583243-20-armbru@redhat.com>
2020-06-15 22:05:28 +02:00
..
ahci_internal.h hw/ide: Remove now unneded #include "hw/pci/pci.h" from hw/ide.h 2020-03-17 12:22:36 -04:00
ahci-allwinner.c various: Remove unnecessary OBJECT() cast 2020-05-15 07:08:14 +02:00
ahci.c hw/ide/ahci: Log lost IRQs 2020-05-18 19:05:25 +02:00
atapi.c
cmd646.c cmd646-ide: use qdev gpio rather than qemu_allocate_irqs() 2020-03-27 14:30:08 -04:00
core.c hw/ide: Let the DMAIntFunc prototype use a boolean 'is_write' argument 2020-02-20 14:47:08 +01:00
ich.c
ioport.c
isa.c isa: Convert uses of isa_create() with Coccinelle 2020-06-15 22:05:28 +02:00
Kconfig
macio.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
Makefile.objs
microdrive.c
mmio.c
pci.c hw/ide: Do ide_drive_get() within pci_ide_create_devs() 2020-03-17 12:22:36 -04:00
piix.c hw: Remove unnecessary DEVICE() cast 2020-05-15 07:08:52 +02:00
qdev.c qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
sii3112.c hw/ide/sii3112: Remove dead assignment 2020-05-04 14:43:24 +02:00
trace-events
via.c via-ide: use qdev gpio rather than qemu_allocate_irqs() 2020-03-27 14:30:08 -04:00