diff mbox series

[6/5] include/hw/cxl: Break inclusion loop

Message ID 875yekehnx.fsf@pond.sub.org
State New
Headers show
Series include/hw/pci include/hw/cxl: Clean up includes | expand

Commit Message

Markus Armbruster Dec. 9, 2022, 3:11 p.m. UTC
hw/cxl/cxl_pci.h and hw/cxl/cxl_cdat.h include each other.  Neither
header actually needs the other one.  Drop both #include directives.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 include/hw/cxl/cxl_cdat.h | 1 -
 include/hw/cxl/cxl_pci.h  | 1 -
 2 files changed, 2 deletions(-)

Comments

Markus Armbruster Dec. 10, 2022, 7:09 a.m. UTC | #1
Markus Armbruster <armbru@redhat.com> writes:

> hw/cxl/cxl_pci.h and hw/cxl/cxl_cdat.h include each other.  Neither
> header actually needs the other one.  Drop both #include directives.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  include/hw/cxl/cxl_cdat.h | 1 -
>  include/hw/cxl/cxl_pci.h  | 1 -
>  2 files changed, 2 deletions(-)
>
> diff --git a/include/hw/cxl/cxl_cdat.h b/include/hw/cxl/cxl_cdat.h
> index 7f67638685..e3fd737f9d 100644
> --- a/include/hw/cxl/cxl_cdat.h
> +++ b/include/hw/cxl/cxl_cdat.h
> @@ -10,7 +10,6 @@
>  #ifndef CXL_CDAT_H
>  #define CXL_CDAT_H
>  
> -#include "hw/cxl/cxl_pci.h"
>  #include "hw/pci/pcie_doe.h"
>  
>  /*
> diff --git a/include/hw/cxl/cxl_pci.h b/include/hw/cxl/cxl_pci.h
> index aca14845ab..01e15ed5b4 100644
> --- a/include/hw/cxl/cxl_pci.h
> +++ b/include/hw/cxl/cxl_pci.h
> @@ -11,7 +11,6 @@
>  #define CXL_PCI_H
>  
>  #include "qemu/compiler.h"
> -#include "hw/cxl/cxl_cdat.h"
>  
>  #define CXL_VENDOR_ID 0x1e98

Friday afternoon post with insufficient testing...  Everything still
builds fine, but cxl_component.h is no longer self-contained.  I'll
squash in the appended patch and revise the commit message.


diff --git a/include/hw/cxl/cxl_component.h b/include/hw/cxl/cxl_component.h
index 5dca21e95b..78f83ed742 100644
--- a/include/hw/cxl/cxl_component.h
+++ b/include/hw/cxl/cxl_component.h
@@ -19,6 +19,7 @@
 #include "qemu/range.h"
 #include "qemu/typedefs.h"
 #include "hw/cxl/cxl_cdat.h"
+#include "hw/cxl/cxl_pci.h"
 #include "hw/register.h"
 #include "qapi/error.h"
Markus Armbruster Dec. 15, 2022, 7:34 a.m. UTC | #2
Jonathan Cameron <Jonathan.Cameron@Huawei.com> writes:

> On Sat, 10 Dec 2022 08:09:06 +0100
> Markus Armbruster <armbru@redhat.com> wrote:
>
>> Markus Armbruster <armbru@redhat.com> writes:
>> 
>> > hw/cxl/cxl_pci.h and hw/cxl/cxl_cdat.h include each other.  Neither
>> > header actually needs the other one.  Drop both #include directives.
>> >
>> > Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> > ---
>> >  include/hw/cxl/cxl_cdat.h | 1 -
>> >  include/hw/cxl/cxl_pci.h  | 1 -
>> >  2 files changed, 2 deletions(-)
>> >
>> > diff --git a/include/hw/cxl/cxl_cdat.h b/include/hw/cxl/cxl_cdat.h
>> > index 7f67638685..e3fd737f9d 100644
>> > --- a/include/hw/cxl/cxl_cdat.h
>> > +++ b/include/hw/cxl/cxl_cdat.h
>> > @@ -10,7 +10,6 @@
>> >  #ifndef CXL_CDAT_H
>> >  #define CXL_CDAT_H
>> >  
>> > -#include "hw/cxl/cxl_pci.h"
>> >  #include "hw/pci/pcie_doe.h"
>
> The include was to get to CXL_VENDOR_ID which is in hw/cxl/cxl_pci.h
> Can move that elsewhere perhaps, though I don't think we need to
> if we break the loop by dropping the other one.

It's used only in a macro.  If you use the macro, you need to include
cxl_pci.h.

Would you like me to keep this #include?

>> >  /*
>> > diff --git a/include/hw/cxl/cxl_pci.h b/include/hw/cxl/cxl_pci.h
>> > index aca14845ab..01e15ed5b4 100644
>> > --- a/include/hw/cxl/cxl_pci.h
>> > +++ b/include/hw/cxl/cxl_pci.h
>> > @@ -11,7 +11,6 @@
>> >  #define CXL_PCI_H
>> >  
>> >  #include "qemu/compiler.h"
>> > -#include "hw/cxl/cxl_cdat.h"
> Guess that's a left over of some earlier refactoring. Good to get rid
> of this one.
>
>> >  
>> >  #define CXL_VENDOR_ID 0x1e98  
>> 
>> Friday afternoon post with insufficient testing...  Everything still
>> builds fine, but cxl_component.h is no longer self-contained.  I'll
>> squash in the appended patch and revise the commit message.
>
> By staring at the code rather than any automation I'm failing to spot
> what it needs from cxl_pci.h.  Can you add that info to the commit message?

It's CXL20_MAX_DVSEC.

>> diff --git a/include/hw/cxl/cxl_component.h b/include/hw/cxl/cxl_component.h
>> index 5dca21e95b..78f83ed742 100644
>> --- a/include/hw/cxl/cxl_component.h
>> +++ b/include/hw/cxl/cxl_component.h
>> @@ -19,6 +19,7 @@
>>  #include "qemu/range.h"
>>  #include "qemu/typedefs.h"
>>  #include "hw/cxl/cxl_cdat.h"
>> +#include "hw/cxl/cxl_pci.h"
>>  #include "hw/register.h"
>>  #include "qapi/error.h"
>>  
>>
diff mbox series

Patch

diff --git a/include/hw/cxl/cxl_cdat.h b/include/hw/cxl/cxl_cdat.h
index 7f67638685..e3fd737f9d 100644
--- a/include/hw/cxl/cxl_cdat.h
+++ b/include/hw/cxl/cxl_cdat.h
@@ -10,7 +10,6 @@ 
 #ifndef CXL_CDAT_H
 #define CXL_CDAT_H
 
-#include "hw/cxl/cxl_pci.h"
 #include "hw/pci/pcie_doe.h"
 
 /*
diff --git a/include/hw/cxl/cxl_pci.h b/include/hw/cxl/cxl_pci.h
index aca14845ab..01e15ed5b4 100644
--- a/include/hw/cxl/cxl_pci.h
+++ b/include/hw/cxl/cxl_pci.h
@@ -11,7 +11,6 @@ 
 #define CXL_PCI_H
 
 #include "qemu/compiler.h"
-#include "hw/cxl/cxl_cdat.h"
 
 #define CXL_VENDOR_ID 0x1e98