Skip to contentSkip to conversation

hw/ide: Remove duplicated definitions from ahci_internal.h

PATCH Applied Thomas Huth 2 participants 5 messages Dec 5, 2017 – Jan 19, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hw/ide: Remove duplicated definitions from ahci_internal.h

The same definitions can also be found in include/hw/ide/ahci.h so let's remove these #defines from ahci_internal.h.

---
v2: Also remove TYPE_ICH9_AHCI as suggested by John

 hw/ide/ahci_internal.h | 12 ------------
 1 file changed, 12 deletions(-)
hw/ide/ahci_internal.h +0 -12
index ce2e818..e3e3ed2 100644
@@ -311,11 +311,6 @@ struct AHCIPCIState {
     AHCIState ahci;
 };
 
-#define TYPE_ICH9_AHCI "ich9-ahci"
-
-#define ICH_AHCI(obj) \
-    OBJECT_CHECK(AHCIPCIState, (obj), TYPE_ICH9_AHCI)
-
 extern const VMStateDescription vmstate_ahci;
 
 #define VMSTATE_AHCI(_field, _state) {                               \
@@ -375,11 +370,4 @@ void ahci_uninit(AHCIState *s);
 
 void ahci_reset(AHCIState *s);
 
-#define TYPE_SYSBUS_AHCI "sysbus-ahci"
-#define SYSBUS_AHCI(obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI)
-
-#define TYPE_ALLWINNER_AHCI "allwinner-ahci"
-#define ALLWINNER_AHCI(obj) OBJECT_CHECK(AllwinnerAHCIState, (obj), \
-                       TYPE_ALLWINNER_AHCI)
-
 #endif /* HW_IDE_AHCI_H */
Signature · 1 line
1.8.3.1
#1 lore raw

I tweaked this again, sorry:

The names need to stay public, but the wrappers to manipulate the objects can stay internal. Minor difference.

If that's okay, I'll just merge this in.
OK?

--js

hw/ide/ahci_internal.h +0 -3
index ce2e818c8c..8c755d4ca1 100644
@@ -311,8 +311,6 @@ struct AHCIPCIState {
     AHCIState ahci;
 };
 
-#define TYPE_ICH9_AHCI "ich9-ahci"
-
 #define ICH_AHCI(obj) \
     OBJECT_CHECK(AHCIPCIState, (obj), TYPE_ICH9_AHCI)
 
@@ -375,10 +373,8 @@ void ahci_uninit(AHCIState *s);
 
 void ahci_reset(AHCIState *s);
 
-#define TYPE_SYSBUS_AHCI "sysbus-ahci"
 #define SYSBUS_AHCI(obj) OBJECT_CHECK(SysbusAHCIState, (obj),

TYPE_SYSBUS_AHCI)

-#define TYPE_ALLWINNER_AHCI "allwinner-ahci"
#define ALLWINNER_AHCI(obj) OBJECT_CHECK(AllwinnerAHCIState, (obj), \
TYPE_ALLWINNER_AHCI)

include/hw/ide/ahci.h +0 -4
index 5a06537e6b..b7bb2b02d6 100644
@@ -54,14 +54,10 @@ typedef struct AHCIPCIState AHCIPCIState;
 
 #define TYPE_ICH9_AHCI "ich9-ahci"
 
-#define ICH_AHCI(obj) \
-    OBJECT_CHECK(AHCIPCIState, (obj), TYPE_ICH9_AHCI)
-
 int32_t ahci_get_num_ports(PCIDevice *dev);
 void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd);
 
 #define TYPE_SYSBUS_AHCI "sysbus-ahci"
-#define SYSBUS_AHCI(obj) OBJECT_CHECK(SysbusAHCIState, (obj),

TYPE_SYSBUS_AHCI)

 typedef struct SysbusAHCIState {
     /*< private >*/

@@ -73,8 +69,6 @@ typedef struct SysbusAHCIState {
} SysbusAHCIState;

#define TYPE_ALLWINNER_AHCI "allwinner-ahci"
-#define ALLWINNER_AHCI(obj) OBJECT_CHECK(AllwinnerAHCIState, (obj), \
- TYPE_ALLWINNER_AHCI)

#define ALLWINNER_AHCI_MMIO_OFF 0x80
#define ALLWINNER_AHCI_MMIO_SIZE 0x80

Quoted 39 lines · Thomas Huth

The same definitions can also be found in include/hw/ide/ahci.h so let's remove these #defines from ahci_internal.h.

---
v2: Also remove TYPE_ICH9_AHCI as suggested by John

 hw/ide/ahci_internal.h | 12 ------------
 1 file changed, 12 deletions(-)
hw/ide/ahci_internal.h +0 -12
index ce2e818..e3e3ed2 100644
@@ -311,11 +311,6 @@ struct AHCIPCIState {
     AHCIState ahci;
 };
 
-#define TYPE_ICH9_AHCI "ich9-ahci"
-
-#define ICH_AHCI(obj) \
-    OBJECT_CHECK(AHCIPCIState, (obj), TYPE_ICH9_AHCI)
-
 extern const VMStateDescription vmstate_ahci;
 
 #define VMSTATE_AHCI(_field, _state) {                               \
@@ -375,11 +370,4 @@ void ahci_uninit(AHCIState *s);
 
 void ahci_reset(AHCIState *s);
 
-#define TYPE_SYSBUS_AHCI "sysbus-ahci"
-#define SYSBUS_AHCI(obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI)
-
-#define TYPE_ALLWINNER_AHCI "allwinner-ahci"
-#define ALLWINNER_AHCI(obj) OBJECT_CHECK(AllwinnerAHCIState, (obj), \
-                       TYPE_ALLWINNER_AHCI)
-
 #endif /* HW_IDE_AHCI_H */
#2 lore raw
Quoted 7 lines · John Snow

I tweaked this again, sorry:

The names need to stay public, but the wrappers to manipulate the objects can stay internal. Minor difference.

If that's okay, I'll just merge this in.
OK?

Sure. Feel also free to replace my "Signed-off-by" with "Reported-by" in that case if you like.

Thomas

#3 lore raw
Quoted 6 lines · Thomas Huth
Quoted 5 lines · John Snow

I tweaked this again, sorry:

The names need to stay public, but the wrappers to manipulate the objects can stay internal. Minor difference.

Quoted 8 lines
Quoted 2 lines

If that's okay, I'll just merge this in.
OK?

Sure. Feel also free to replace my "Signed-off-by" with "Reported-by" in that case if you like.

Thomas

I forgot about this. Sending the PR now.

Applied
#4 lore raw
In reply to Thomas Huth
Quoted 29 lines · Thomas Huth

The same definitions can also be found in include/hw/ide/ahci.h so let's remove these #defines from ahci_internal.h.

---
v2: Also remove TYPE_ICH9_AHCI as suggested by John

 hw/ide/ahci_internal.h | 12 ------------
 1 file changed, 12 deletions(-)
hw/ide/ahci_internal.h +0 -5
index ce2e818..e3e3ed2 100644
@@ -311,11 +311,6 @@ struct AHCIPCIState {
     AHCIState ahci;
 };
 
-#define TYPE_ICH9_AHCI "ich9-ahci"
-
-#define ICH_AHCI(obj) \
-    OBJECT_CHECK(AHCIPCIState, (obj), TYPE_ICH9_AHCI)
-
 extern const VMStateDescription vmstate_ahci;
 
 #define VMSTATE_AHCI(_field, _state) {                               \
@@ -375,11 +370,4 @@ void ahci_uninit(AHCIState *s);
 

hw/ide/ahci_internal.h void ahci_uninit(AHCIState *s); · line 373

Quoted 10 lines
hw/ide/ahci_internal.h +0 -7
 void ahci_reset(AHCIState *s);
 
-#define TYPE_SYSBUS_AHCI "sysbus-ahci"
-#define SYSBUS_AHCI(obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI)
-
-#define TYPE_ALLWINNER_AHCI "allwinner-ahci"
-#define ALLWINNER_AHCI(obj) OBJECT_CHECK(AllwinnerAHCIState, (obj), \
-                       TYPE_ALLWINNER_AHCI)
-
 #endif /* HW_IDE_AHCI_H */

With edits:

Thanks, applied to my IDE tree:

https://github.com/jnsnow/qemu/commits/ide
https://github.com/jnsnow/qemu.git

--js

(PR will be sent when 2.12 opens; there's time to fiddle with it.)