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> --- include/hw/block/flash.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/hw/block') diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h index 333005d..aeea3ca9 100644 --- a/include/hw/block/flash.h +++ b/include/hw/block/flash.h @@ -8,6 +8,8 @@ /* pflash_cfi01.c */ #define TYPE_PFLASH_CFI01 "cfi.pflash01" +#define PFLASH_CFI01(obj) \ + OBJECT_CHECK(PFlashCFI01, (obj), TYPE_PFLASH_CFI01) typedef struct PFlashCFI01 PFlashCFI01; @@ -25,6 +27,8 @@ MemoryRegion *pflash_cfi01_get_memory(PFlashCFI01 *fl); /* pflash_cfi02.c */ #define TYPE_PFLASH_CFI02 "cfi.pflash02" +#define PFLASH_CFI02(obj) \ + OBJECT_CHECK(PFlashCFI02, (obj), TYPE_PFLASH_CFI02) typedef struct PFlashCFI02 PFlashCFI02; -- cgit v1.1