From 81c7db723ebd0c677784a728020c7e8845868daf Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 8 Mar 2019 10:46:00 +0100 Subject: hw: Use PFLASH_CFI0{1,2} and TYPE_PFLASH_CFI0{1,2} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Laszlo Ersek Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée Message-Id: <20190308094610.21210-6-armbru@redhat.com> --- hw/arm/vexpress.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hw/arm/vexpress.c') diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index ed46d2e..f07134c 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -515,7 +515,7 @@ static void vexpress_modify_dtb(const struct arm_boot_info *info, void *fdt) static PFlashCFI01 *ve_pflash_cfi01_register(hwaddr base, const char *name, DriveInfo *di) { - DeviceState *dev = qdev_create(NULL, "cfi.pflash01"); + DeviceState *dev = qdev_create(NULL, TYPE_PFLASH_CFI01); if (di) { qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(di), @@ -536,7 +536,7 @@ static PFlashCFI01 *ve_pflash_cfi01_register(hwaddr base, const char *name, qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); - return OBJECT_CHECK(PFlashCFI01, (dev), "cfi.pflash01"); + return PFLASH_CFI01(dev); } static void vexpress_common_init(MachineState *machine) -- cgit v1.1