[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/18] aspeed/smc: Remove the 'flash' attribute from AspeedSMCFlas
From: |
Cédric Le Goater |
Subject: |
[PULL 05/18] aspeed/smc: Remove the 'flash' attribute from AspeedSMCFlash |
Date: |
Tue, 12 Oct 2021 09:37:15 +0200 |
There is no need to keep a reference of the flash qdev in the AspeedSMCFlash
state: the SPI bus takes ownership and will release its resources. Remove
AspeedSMCFlash::flash.
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
include/hw/ssi/aspeed_smc.h | 1 -
hw/arm/aspeed.c | 11 +++++------
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/include/hw/ssi/aspeed_smc.h b/include/hw/ssi/aspeed_smc.h
index 0ea536a44c3a..f32f66f9a838 100644
--- a/include/hw/ssi/aspeed_smc.h
+++ b/include/hw/ssi/aspeed_smc.h
@@ -37,7 +37,6 @@ typedef struct AspeedSMCFlash {
uint32_t size;
MemoryRegion mmio;
- DeviceState *flash;
} AspeedSMCFlash;
#define TYPE_ASPEED_SMC "aspeed.smc"
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index ba5f1dc5af78..854413594d9e 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -274,18 +274,17 @@ static void aspeed_board_init_flashes(AspeedSMCState *s,
int i ;
for (i = 0; i < s->num_cs; ++i) {
- AspeedSMCFlash *fl = &s->flashes[i];
DriveInfo *dinfo = drive_get_next(IF_MTD);
qemu_irq cs_line;
+ DeviceState *dev;
- fl->flash = qdev_new(flashtype);
+ dev = qdev_new(flashtype);
if (dinfo) {
- qdev_prop_set_drive(fl->flash, "drive",
- blk_by_legacy_dinfo(dinfo));
+ qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(dinfo));
}
- qdev_realize_and_unref(fl->flash, BUS(s->spi), &error_fatal);
+ qdev_realize_and_unref(dev, BUS(s->spi), &error_fatal);
- cs_line = qdev_get_gpio_in_named(fl->flash, SSI_GPIO_CS, 0);
+ cs_line = qdev_get_gpio_in_named(dev, SSI_GPIO_CS, 0);
sysbus_connect_irq(SYS_BUS_DEVICE(s), i + 1, cs_line);
}
}
--
2.31.1
- [PULL 00/18] aspeed queue, Cédric Le Goater, 2021/10/12
- [PULL 05/18] aspeed/smc: Remove the 'flash' attribute from AspeedSMCFlash,
Cédric Le Goater <=
- [PULL 11/18] aspeed/smc: Remove unused attribute 'irqline', Cédric Le Goater, 2021/10/12
- [PULL 18/18] aspeed/smc: Dump address offset in trace events, Cédric Le Goater, 2021/10/12
- [PULL 07/18] aspeed/smc: Rename AspeedSMCFlash 'id' to 'cs', Cédric Le Goater, 2021/10/12
- [PULL 10/18] aspeed/smc: Introduce a new addr_width() class handler, Cédric Le Goater, 2021/10/12
- [PULL 13/18] hw: aspeed_gpio: Fix pin I/O type declarations, Cédric Le Goater, 2021/10/12
- [PULL 16/18] hw/arm: Integrate ADC model into Aspeed SoC, Cédric Le Goater, 2021/10/12
- [PULL 09/18] aspeed/smc: Add default reset values, Cédric Le Goater, 2021/10/12
- [PULL 14/18] hw: aspeed_gpio: Fix GPIO array indexing, Cédric Le Goater, 2021/10/12
- [PULL 17/18] aspeed/wdt: Add trace events, Cédric Le Goater, 2021/10/12
- [PULL 01/18] aspeed/smc: Add watchdog Control/Status Registers, Cédric Le Goater, 2021/10/12