qemu/include/hw/timer
Markus Armbruster 3e80f6902c qdev: Convert uses of qdev_create() with Coccinelle
This is the transformation explained in the commit before previous.
Takes care of just one pattern that needs conversion.  More to come in
this series.

Coccinelle script:

    @ depends on !(file in "hw/arm/highbank.c")@
    expression bus, type_name, dev, expr;
    @@
    -    dev = qdev_create(bus, type_name);
    +    dev = qdev_new(type_name);
         ... when != dev = expr
    -    qdev_init_nofail(dev);
    +    qdev_realize_and_unref(dev, bus, &error_fatal);

    @@
    expression bus, type_name, dev, expr;
    identifier DOWN;
    @@
    -    dev = DOWN(qdev_create(bus, type_name));
    +    dev = DOWN(qdev_new(type_name));
         ... when != dev = expr
    -    qdev_init_nofail(DEVICE(dev));
    +    qdev_realize_and_unref(DEVICE(dev), bus, &error_fatal);

    @@
    expression bus, type_name, expr;
    identifier dev;
    @@
    -    DeviceState *dev = qdev_create(bus, type_name);
    +    DeviceState *dev = qdev_new(type_name);
         ... when != dev = expr
    -    qdev_init_nofail(dev);
    +    qdev_realize_and_unref(dev, bus, &error_fatal);

    @@
    expression bus, type_name, dev, expr, errp;
    symbol true;
    @@
    -    dev = qdev_create(bus, type_name);
    +    dev = qdev_new(type_name);
         ... when != dev = expr
    -    object_property_set_bool(OBJECT(dev), true, "realized", errp);
    +    qdev_realize_and_unref(dev, bus, errp);

    @@
    expression bus, type_name, expr, errp;
    identifier dev;
    symbol true;
    @@
    -    DeviceState *dev = qdev_create(bus, type_name);
    +    DeviceState *dev = qdev_new(type_name);
         ... when != dev = expr
    -    object_property_set_bool(OBJECT(dev), true, "realized", errp);
    +    qdev_realize_and_unref(dev, bus, errp);

The first rule exempts hw/arm/highbank.c, because it matches along two
control flow paths there, with different @type_name.  Covered by the
next commit's manual conversions.

Missing #include "qapi/error.h" added manually.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200610053247.1583243-10-armbru@redhat.com>
[Conflicts in hw/misc/empty_slot.c and hw/sparc/leon3.c resolved]
2020-06-15 22:00:10 +02:00
..
a9gtimer.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
allwinner-a10-pit.h include: Make headers more self-contained 2019-08-16 13:31:51 +02:00
arm_mptimer.h arm_mptimer: Convert to use ptimer 2016-10-24 16:26:53 +01:00
armv7m_systick.h arm: Move system_clock_scale to armv7m_systick.h 2019-05-23 14:47:43 +01:00
aspeed_timer.h aspeed/timer: Add support for IRQ status register on the AST2600 2019-10-15 18:09:04 +01:00
bcm2835_systmr.h hw/timer/bcm2835: Add the BCM2835 SYS_timer 2019-10-25 13:09:27 +01:00
cmsdk-apb-dualtimer.h hw/timer/cmsdk-apb-dualtimer: Implement CMSDK dual timer module 2018-08-24 13:17:41 +01:00
cmsdk-apb-timer.h qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
digic-timer.h Use scripts/clean-includes to drop redundant qemu/typedefs.h 2016-03-22 22:20:16 +01:00
hpet.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
i8254_internal.h Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
i8254.h Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
imx_epit.h i.MX: Split the CCM class into an abstract base class and a concrete class 2015-12-17 13:37:15 +00:00
imx_gpt.h i.MX: Add i.MX7 GPT variant 2018-02-09 10:40:30 +00:00
mips_gictimer.h hw/mips_gictimer: provide API for retrieving frequency 2017-02-21 22:24:58 +00:00
mss-timer.h hw/timer/mss-timerc: Switch to transaction-based ptimer API 2019-10-15 18:09:03 +01:00
nrf51_timer.h hw/timer/nrf51_timer: Display timer ID in trace events 2020-05-11 11:05:52 +01:00
stm32f2xx_timer.h Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00