[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH-for-5.1 v3 03/24] hw/arm/allwinner-a10: Move some code from reali
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH-for-5.1 v3 03/24] hw/arm/allwinner-a10: Move some code from realize() to init() |
Date: |
Mon, 13 Apr 2020 00:35:58 +0200 |
Coccinelle reported:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/arm/allwinner-a10.c
>>> possible moves from aw_a10_init() to aw_a10_realize() in
./hw/arm/allwinner-a10.c:77
Move the calls using &error_fatal which don't depend on input
updated before realize() to init().
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
v3: Typo 'depend of' -> 'depend on' (eblake)
---
hw/arm/allwinner-a10.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
index 62a67a3e1a..f41395734a 100644
--- a/hw/arm/allwinner-a10.c
+++ b/hw/arm/allwinner-a10.c
@@ -60,10 +60,18 @@ static void aw_a10_init(Object *obj)
int i;
for (i = 0; i < AW_A10_NUM_USB; i++) {
+ char bus[16];
+
sysbus_init_child_obj(obj, "ehci[*]", OBJECT(&s->ehci[i]),
sizeof(s->ehci[i]), TYPE_PLATFORM_EHCI);
sysbus_init_child_obj(obj, "ohci[*]", OBJECT(&s->ohci[i]),
sizeof(s->ohci[i]), TYPE_SYSBUS_OHCI);
+ object_property_set_bool(OBJECT(&s->ehci[i]), true,
+ "companion-enable", &error_fatal);
+
+ sprintf(bus, "usb-bus.%d", i);
+ object_property_set_str(OBJECT(&s->ohci[i]), bus, "masterbus",
+ &error_fatal);
}
}
@@ -72,6 +80,11 @@ static void aw_a10_init(Object *obj)
sysbus_init_child_obj(obj, "rtc", &s->rtc, sizeof(s->rtc),
TYPE_AW_RTC_SUN4I);
+
+ memory_region_init_ram(&s->sram_a, obj, "sram A", 48 * KiB,
+ &error_fatal);
+ memory_region_add_subregion(get_system_memory(), 0x00000000, &s->sram_a);
+ create_unimplemented_device("a10-sram-ctrl", 0x01c00000, 4 * KiB);
}
static void aw_a10_realize(DeviceState *dev, Error **errp)
@@ -113,11 +126,6 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
sysbus_connect_irq(sysbusdev, 4, qdev_get_gpio_in(dev, 67));
sysbus_connect_irq(sysbusdev, 5, qdev_get_gpio_in(dev, 68));
- memory_region_init_ram(&s->sram_a, OBJECT(dev), "sram A", 48 * KiB,
- &error_fatal);
- memory_region_add_subregion(get_system_memory(), 0x00000000, &s->sram_a);
- create_unimplemented_device("a10-sram-ctrl", 0x01c00000, 4 * KiB);
-
/* FIXME use qdev NIC properties instead of nd_table[] */
if (nd_table[0].used) {
qemu_check_nic_model(&nd_table[0], TYPE_AW_EMAC);
@@ -149,12 +157,6 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
int i;
for (i = 0; i < AW_A10_NUM_USB; i++) {
- char bus[16];
-
- sprintf(bus, "usb-bus.%d", i);
-
- object_property_set_bool(OBJECT(&s->ehci[i]), true,
- "companion-enable", &error_fatal);
object_property_set_bool(OBJECT(&s->ehci[i]), true, "realized",
&error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(&s->ehci[i]), 0,
@@ -162,8 +164,6 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
sysbus_connect_irq(SYS_BUS_DEVICE(&s->ehci[i]), 0,
qdev_get_gpio_in(dev, 39 + i));
- object_property_set_str(OBJECT(&s->ohci[i]), bus, "masterbus",
- &error_fatal);
object_property_set_bool(OBJECT(&s->ohci[i]), true, "realized",
&error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(&s->ohci[i]), 0,
--
2.21.1
[PATCH-for-5.1 v3 01/24] various: Remove suspicious '\' character outside of #define in C code, Philippe Mathieu-Daudé, 2020/04/12
[PATCH-for-5.1 v3 03/24] hw/arm/allwinner-a10: Move some code from realize() to init(),
Philippe Mathieu-Daudé <=
[PATCH-for-5.1 v3 04/24] hw/arm/aspeed_ast2600: Simplify use of Error*, Philippe Mathieu-Daudé, 2020/04/12
[PATCH-for-5.1 v3 05/24] hw/arm/aspeed_ast2600: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/12
[PATCH-for-5.1 v3 06/24] hw/arm/aspeed_soc: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/12
[PATCH-for-5.1 v3 07/24] hw/arm/aspeed_soc: Simplify use of Error*, Philippe Mathieu-Daudé, 2020/04/12
[PATCH-for-5.1 v3 08/24] hw/arm/fsl-imx6: Simplify checks on 'smp_cpus' count, Philippe Mathieu-Daudé, 2020/04/12
[PATCH-for-5.1 v3 09/24] hw/arm/fsl-imx6: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/12
[PATCH-for-5.1 v3 10/24] hw/arm/fsl-imx31: Move some code from realize() to init(), Philippe Mathieu-Daudé, 2020/04/12
[PATCH-for-5.1 v3 11/24] hw/arm/msf2-soc: Store MemoryRegion in MSF2State, Philippe Mathieu-Daudé, 2020/04/12