diff mbox series

[for-6.2,09/12] npcm7xx_otp: Use DECLARE_CLASS_CHECKERS

Message ID 20210806211127.646908-10-ehabkost@redhat.com
State New
Headers show
Series qom: Get rid of all manual usage of OBJECT_CHECK & friends | expand

Commit Message

Eduardo Habkost Aug. 6, 2021, 9:11 p.m. UTC
Use DECLARE_CLASS_CHECKERS instead of defining the
NPCM7XX_OTP_CLASS and NPCM7XX_OTP_GET_CLASS macros manually.

These changes had to be done manually because the typedef and the
existing macro definitions were in different files.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Havard Skinnemoen <hskinnemoen@google.com>
Cc: Tyrone Ting <kfting@nuvoton.com>
Cc: qemu-arm@nongnu.org
Cc: qemu-devel@nongnu.org
---
 include/hw/nvram/npcm7xx_otp.h | 5 +++--
 hw/nvram/npcm7xx_otp.c         | 5 -----
 2 files changed, 3 insertions(+), 7 deletions(-)

Comments

Philippe Mathieu-Daudé Aug. 7, 2021, 8 a.m. UTC | #1
On 8/6/21 11:11 PM, Eduardo Habkost wrote:
> Use DECLARE_CLASS_CHECKERS instead of defining the
> NPCM7XX_OTP_CLASS and NPCM7XX_OTP_GET_CLASS macros manually.
> 
> These changes had to be done manually because the typedef and the
> existing macro definitions were in different files.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Cc: Havard Skinnemoen <hskinnemoen@google.com>
> Cc: Tyrone Ting <kfting@nuvoton.com>
> Cc: qemu-arm@nongnu.org
> Cc: qemu-devel@nongnu.org
> ---
>  include/hw/nvram/npcm7xx_otp.h | 5 +++--
>  hw/nvram/npcm7xx_otp.c         | 5 -----
>  2 files changed, 3 insertions(+), 7 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
diff mbox series

Patch

diff --git a/include/hw/nvram/npcm7xx_otp.h b/include/hw/nvram/npcm7xx_otp.h
index 4cfc6577e87..0a3ebb091d5 100644
--- a/include/hw/nvram/npcm7xx_otp.h
+++ b/include/hw/nvram/npcm7xx_otp.h
@@ -60,12 +60,13 @@  typedef struct NPCM7xxOTPState NPCM7xxOTPState;
 #define TYPE_NPCM7XX_OTP "npcm7xx-otp"
 DECLARE_INSTANCE_CHECKER(NPCM7xxOTPState, NPCM7XX_OTP,
                          TYPE_NPCM7XX_OTP)
+typedef struct NPCM7xxOTPClass NPCM7xxOTPClass;
+DECLARE_CLASS_CHECKERS(NPCM7xxOTPClass, NPCM7XX_OTP,
+                       TYPE_NPCM7XX_OTP)
 
 #define TYPE_NPCM7XX_KEY_STORAGE "npcm7xx-key-storage"
 #define TYPE_NPCM7XX_FUSE_ARRAY "npcm7xx-fuse-array"
 
-typedef struct NPCM7xxOTPClass NPCM7xxOTPClass;
-
 /**
  * npcm7xx_otp_array_write - ECC encode and write data to OTP array.
  * @s: OTP module.
diff --git a/hw/nvram/npcm7xx_otp.c b/hw/nvram/npcm7xx_otp.c
index 52b9482419e..61085c5228b 100644
--- a/hw/nvram/npcm7xx_otp.c
+++ b/hw/nvram/npcm7xx_otp.c
@@ -73,11 +73,6 @@  struct NPCM7xxOTPClass {
     const MemoryRegionOps *mmio_ops;
 };
 
-#define NPCM7XX_OTP_CLASS(klass) \
-    OBJECT_CLASS_CHECK(NPCM7xxOTPClass, (klass), TYPE_NPCM7XX_OTP)
-#define NPCM7XX_OTP_GET_CLASS(obj) \
-    OBJECT_GET_CLASS(NPCM7xxOTPClass, (obj), TYPE_NPCM7XX_OTP)
-
 static uint8_t ecc_encode_nibble(uint8_t n)
 {
     uint8_t result = n;