diff mbox series

[1/4] hw/southbridge/piix: Use OBJECT_DECLARE_SIMPLE_TYPE() macro

Message ID 20230210165754.34342-2-philmd@linaro.org
State Superseded
Headers show
Series hw/isa/piix: Housekeeping QOM names / macros | expand

Commit Message

Philippe Mathieu-Daudé Feb. 10, 2023, 4:57 p.m. UTC
Manually convert to OBJECT_DECLARE_SIMPLE_TYPE() macro,
similarly to automatic conversion from commit 8063396bf3
("Use OBJECT_DECLARE_SIMPLE_TYPE when possible").

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/southbridge/piix.h | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Bernhard Beschow Feb. 28, 2023, 9:35 p.m. UTC | #1
Am 10. Februar 2023 16:57:51 UTC schrieb "Philippe Mathieu-Daudé" <philmd@linaro.org>:
>Manually convert to OBJECT_DECLARE_SIMPLE_TYPE() macro,
>similarly to automatic conversion from commit 8063396bf3
>("Use OBJECT_DECLARE_SIMPLE_TYPE when possible").
>
>Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>---
> include/hw/southbridge/piix.h | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
>diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h
>index 0bf48e936d..a58bf13a41 100644
>--- a/include/hw/southbridge/piix.h
>+++ b/include/hw/southbridge/piix.h
>@@ -29,7 +29,7 @@
> #define PIIX_NUM_PIC_IRQS       16      /* i8259 * 2 */
> #define PIIX_NUM_PIRQS          4ULL    /* PIRQ[A-D] */
> 
>-struct PIIXState {
>+struct PIIX3State {
>     PCIDevice dev;
> 
>     /*
>@@ -57,14 +57,12 @@ struct PIIXState {
>     /* IO memory region for Reset Control Register (PIIX_RCR_IOPORT) */
>     MemoryRegion rcr_mem;
> };
>-typedef struct PIIXState PIIX3State;
> 
> #define TYPE_PIIX3_PCI_DEVICE "pci-piix3"
>-DECLARE_INSTANCE_CHECKER(PIIX3State, PIIX3_PCI_DEVICE,
>-                         TYPE_PIIX3_PCI_DEVICE)
>-
> #define TYPE_PIIX3_DEVICE "PIIX3"
> #define TYPE_PIIX3_XEN_DEVICE "PIIX3-xen"
> #define TYPE_PIIX4_PCI_DEVICE "piix4-isa"
> 
>+OBJECT_DECLARE_SIMPLE_TYPE(PIIX3State, PIIX3_PCI_DEVICE)
>+
> #endif

The PIIX consolidation series drops the "3" for reuse by PIIX4. Do we really need this?
Philippe Mathieu-Daudé Feb. 28, 2023, 10:28 p.m. UTC | #2
On 28/2/23 22:35, Bernhard Beschow wrote:
> 
> 
> Am 10. Februar 2023 16:57:51 UTC schrieb "Philippe Mathieu-Daudé" <philmd@linaro.org>:
>> Manually convert to OBJECT_DECLARE_SIMPLE_TYPE() macro,
>> similarly to automatic conversion from commit 8063396bf3
>> ("Use OBJECT_DECLARE_SIMPLE_TYPE when possible").
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> include/hw/southbridge/piix.h | 8 +++-----
>> 1 file changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h
>> index 0bf48e936d..a58bf13a41 100644
>> --- a/include/hw/southbridge/piix.h
>> +++ b/include/hw/southbridge/piix.h
>> @@ -29,7 +29,7 @@
>> #define PIIX_NUM_PIC_IRQS       16      /* i8259 * 2 */
>> #define PIIX_NUM_PIRQS          4ULL    /* PIRQ[A-D] */
>>
>> -struct PIIXState {
>> +struct PIIX3State {
>>      PCIDevice dev;
>>
>>      /*
>> @@ -57,14 +57,12 @@ struct PIIXState {
>>      /* IO memory region for Reset Control Register (PIIX_RCR_IOPORT) */
>>      MemoryRegion rcr_mem;
>> };
>> -typedef struct PIIXState PIIX3State;
>>
>> #define TYPE_PIIX3_PCI_DEVICE "pci-piix3"
>> -DECLARE_INSTANCE_CHECKER(PIIX3State, PIIX3_PCI_DEVICE,
>> -                         TYPE_PIIX3_PCI_DEVICE)
>> -
>> #define TYPE_PIIX3_DEVICE "PIIX3"
>> #define TYPE_PIIX3_XEN_DEVICE "PIIX3-xen"
>> #define TYPE_PIIX4_PCI_DEVICE "piix4-isa"
>>
>> +OBJECT_DECLARE_SIMPLE_TYPE(PIIX3State, PIIX3_PCI_DEVICE)
>> +
>> #endif
> 
> The PIIX consolidation series drops the "3" for reuse by PIIX4. Do we really need this?

Unfortunately we do to be able to use the OBJECT_DECLARE_SIMPLE_TYPE()
macro which generates the typedefs. When I get to your patches later
this indeed ends as (PIIXState, PIIX_PCI_DEVICE).
diff mbox series

Patch

diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h
index 0bf48e936d..a58bf13a41 100644
--- a/include/hw/southbridge/piix.h
+++ b/include/hw/southbridge/piix.h
@@ -29,7 +29,7 @@ 
 #define PIIX_NUM_PIC_IRQS       16      /* i8259 * 2 */
 #define PIIX_NUM_PIRQS          4ULL    /* PIRQ[A-D] */
 
-struct PIIXState {
+struct PIIX3State {
     PCIDevice dev;
 
     /*
@@ -57,14 +57,12 @@  struct PIIXState {
     /* IO memory region for Reset Control Register (PIIX_RCR_IOPORT) */
     MemoryRegion rcr_mem;
 };
-typedef struct PIIXState PIIX3State;
 
 #define TYPE_PIIX3_PCI_DEVICE "pci-piix3"
-DECLARE_INSTANCE_CHECKER(PIIX3State, PIIX3_PCI_DEVICE,
-                         TYPE_PIIX3_PCI_DEVICE)
-
 #define TYPE_PIIX3_DEVICE "PIIX3"
 #define TYPE_PIIX3_XEN_DEVICE "PIIX3-xen"
 #define TYPE_PIIX4_PCI_DEVICE "piix4-isa"
 
+OBJECT_DECLARE_SIMPLE_TYPE(PIIX3State, PIIX3_PCI_DEVICE)
+
 #endif