mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
hw: Use PFLASH_CFI0{1,2} and TYPE_PFLASH_CFI0{1,2}
We have two open-coded copies of macro PFLASH_CFI01(). Move the macro to the header, so we can ditch the copies. Move PFLASH_CFI02() to the header for symmetry. We define macros TYPE_PFLASH_CFI01 and TYPE_PFLASH_CFI02 for type name strings, then mostly use the strings. If the macros are worth defining, they are worth using. Replace the strings by the macros. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20190308094610.21210-6-armbru@redhat.com>
This commit is contained in:
parent
e7b6274197
commit
81c7db723e
6 changed files with 10 additions and 11 deletions
|
@ -167,7 +167,7 @@ static PFlashCFI01 *xtfpga_flash_init(MemoryRegion *address_space,
|
|||
DriveInfo *dinfo, int be)
|
||||
{
|
||||
SysBusDevice *s;
|
||||
DeviceState *dev = qdev_create(NULL, "cfi.pflash01");
|
||||
DeviceState *dev = qdev_create(NULL, TYPE_PFLASH_CFI01);
|
||||
|
||||
qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(dinfo),
|
||||
&error_abort);
|
||||
|
@ -181,7 +181,7 @@ static PFlashCFI01 *xtfpga_flash_init(MemoryRegion *address_space,
|
|||
s = SYS_BUS_DEVICE(dev);
|
||||
memory_region_add_subregion(address_space, board->flash->base,
|
||||
sysbus_mmio_get_region(s, 0));
|
||||
return OBJECT_CHECK(PFlashCFI01, (dev), "cfi.pflash01");
|
||||
return PFLASH_CFI01(dev);
|
||||
}
|
||||
|
||||
static uint64_t translate_phys_addr(void *opaque, uint64_t addr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue