Skip to contentSkip to conversation

Fix pciehp driver on non ACPI systems

PATCH In review Anton Blanchard 6 participants 9 messages Apr 6, 2006 – Apr 12, 2006 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix pciehp driver on non ACPI systems

Wrap some ACPI specific headers. ACPI hasnt taken over the whole world yet.

---

drivers/pci/hotplug/pciehp_hpc.c +4 -0
Index: kernel/drivers/pci/hotplug/pciehp_hpc.c
===================================================================
@@ -38,10 +38,14 @@
 
 #include "../pci.h"
 #include "pciehp.h"
+
+#ifdef CONFIG_ACPI
 #include <acpi/acpi.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/actypes.h>
 #include <linux/pci-acpi.h>
+#endif
+
 #ifdef DEBUG
 #define DBG_K_TRACE_ENTRY      ((unsigned int)0x00000001)	/* On function entry */
 #define DBG_K_TRACE_EXIT       ((unsigned int)0x00000002)	/* On function exit */
#1 lore raw
Quoted 11 lines · Anton Blanchard

Wrap some ACPI specific headers. ACPI hasnt taken over the whole world yet.

---

Index: kernel/drivers/pci/hotplug/pciehp_hpc.c
===================================================================

drivers/pci/hotplug/pciehp_hpc.c line 47

Quoted 10 lines
drivers/pci/hotplug/pciehp_hpc.c +3 -0
@@ -38,10 +38,14 @@
 
 #include "../pci.h"
 #include "pciehp.h"
+
+#ifdef CONFIG_ACPI
 #include <acpi/acpi.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/actypes.h>
 #include <linux/pci-acpi.h>
+#endif

Shouldn't the ACPI headers handle it if CONFIG_ACPI is not enabled? All other header files work that way, and we shouldn't have to add this to the .c files.

thanks,

greg k-h

#2 lore raw
Quoted 13 lines · On Thu, 6 Apr 2006 09:05:27 -0700 Greg KH wrote:
Quoted 12 lines · Anton Blanchard

Wrap some ACPI specific headers. ACPI hasnt taken over the whole world yet.

---

Index: kernel/drivers/pci/hotplug/pciehp_hpc.c
===================================================================

drivers/pci/hotplug/pciehp_hpc.c +0 -0
@@ -38,10 +38,14 @@
 
Quoted 13 lines

drivers/pci/hotplug/pciehp_hpc.c line 47

Quoted 9 lines
drivers/pci/hotplug/pciehp_hpc.c +3 -0
 #include "../pci.h"
 #include "pciehp.h"
+
+#ifdef CONFIG_ACPI
 #include <acpi/acpi.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/actypes.h>
 #include <linux/pci-acpi.h>
+#endif

Shouldn't the ACPI headers handle it if CONFIG_ACPI is not enabled? All other header files work that way, and we shouldn't have to add this to the .c files.

maybe the C file could just #include <linux/acpi.h> ?

---
~Randy

#3 lore raw
Quoted 9 lines · Randy.Dunlap
Quoted 7 lines · On Thu, 6 Apr 2006 09:05:27 -0700 Greg KH wrote:
Quoted 6 lines · Anton Blanchard

Wrap some ACPI specific headers. ACPI hasnt taken over the whole world yet.

---

Quoted 7 lines
Quoted 7 lines

drivers/pci/hotplug/pciehp_hpc.c line 39

Quoted 7 lines

Index: kernel/drivers/pci/hotplug/pciehp_hpc.c
===================================================================

drivers/pci/hotplug/pciehp_hpc.c +0 -0
@@ -38,10 +38,14 @@
 
 #include "../pci.h"

When one introdues relative apths like the above this is a good sign that the header file ought to move to a common place somewhere in include/.

Sam

#4 lore raw
Quoted 16 lines · Sam Ravnborg
Quoted 15 lines · Randy.Dunlap
Quoted 13 lines · On Thu, 6 Apr 2006 09:05:27 -0700 Greg KH wrote:
Quoted 12 lines · Anton Blanchard

Wrap some ACPI specific headers. ACPI hasnt taken over the whole world yet.

---

Index: kernel/drivers/pci/hotplug/pciehp_hpc.c
===================================================================

drivers/pci/hotplug/pciehp_hpc.c +0 -0
@@ -38,10 +38,14 @@
 
Quoted 5 lines
Quoted 1 line
Quoted 1 line

drivers/pci/hotplug/pciehp_hpc.c line 39

Quoted 1 line
drivers/pci/hotplug/pciehp_hpc.c +0 -0
 #include "../pci.h"

When one introdues relative apths like the above this is a good sign that the header file ought to move to a common place somewhere in include/.

No, this is a pci-core only header file. I really don't want to have these in include/linux/pci.h as no one other than the pci core, or pci hotplug drivers need to use it.

I guess I could create, include/linux/pci-core-only-dont-use-unless-you-really-know-what-you-are-doing.h but that might be a bit rude :)

thanks,

greg k-h

#5 lore raw
Quoted 9 lines · Greg KH
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

#include "../pci.h"

When one introdues relative apths like the above this is a good sign that the header file ought to move to a common place somewhere in include/.

No, this is a pci-core only header file. I really don't want to have these in include/linux/pci.h as no one other than the pci core, or pci hotplug drivers need to use it.

But that hold true for other stuff in include/* also.

The guideline is (my understanding):
- Use .h files only when declarations are shared by more than one .c file
- Put the .h file in same dir as the .c files, iff the .c files are all in same dir (and include using #include "file.h")
- For bigger subsystems create an include/<subsystem> dir for shared .h files (and include using #include <file.h>)
- For smaller subsystems create an include/linux/<subsystem> dir for shared .h files (and include using #include <file.h>)

And then we also have:
- For Greg's pci-core keep the shared .h file with the .c files (and include using #include "../file.h")

See why this sticks out a bit.

Not that I imply the above guidlines are strictly followed - but thats the best I have seen.

Sam

#7 lore raw
In reply to Randy.Dunlap
Quoted 29 lines · Randy.Dunlap
Quoted 13 lines · On Thu, 6 Apr 2006 09:05:27 -0700 Greg KH wrote:
Quoted 12 lines · Anton Blanchard

Wrap some ACPI specific headers. ACPI hasnt taken over the whole world yet.

---

Index: kernel/drivers/pci/hotplug/pciehp_hpc.c
===================================================================

drivers/pci/hotplug/pciehp_hpc.c +0 -0
@@ -38,10 +38,14 @@
 
Quoted 13 lines

drivers/pci/hotplug/pciehp_hpc.c line 47

Quoted 9 lines
drivers/pci/hotplug/pciehp_hpc.c +3 -0
 #include "../pci.h"
 #include "pciehp.h"
+
+#ifdef CONFIG_ACPI
 #include <acpi/acpi.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/actypes.h>
 #include <linux/pci-acpi.h>
+#endif

Shouldn't the ACPI headers handle it if CONFIG_ACPI is not enabled? All other header files work that way, and we shouldn't have to add this to the .c files.

Quoted 1 line

maybe the C file could just #include <linux/acpi.h> ?

Would that solve this issue? I'm guessing that they are being included as it needs something in those headers...

thanks,

greg k-h

#8 lore raw
Quoted 2 lines · Greg KH

Would that solve this issue? I'm guessing that they are being included as it needs something in those headers...

There's another #ifdef CONFIG_ACPI area in the .c file. I doubt anything else in there really needs ACPI. Maybe the #ifdef'd area could go into its own _acpi.c file?

-- Dave

#6 lore raw
In reply to Sam Ravnborg
Quoted 23 lines · Sam Ravnborg
Quoted 9 lines · Greg KH
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

#include "../pci.h"

When one introdues relative apths like the above this is a good sign that the header file ought to move to a common place somewhere in include/.

No, this is a pci-core only header file. I really don't want to have these in include/linux/pci.h as no one other than the pci core, or pci hotplug drivers need to use it.

But that hold true for other stuff in include/* also.

The guideline is (my understanding):
- Use .h files only when declarations are shared by more than one .c file
- Put the .h file in same dir as the .c files, iff the .c files are all in same dir (and include using #include "file.h")
- For bigger subsystems create an include/<subsystem> dir for shared .h files (and include using #include <file.h>)
- For smaller subsystems create an include/linux/<subsystem> dir for shared .h files (and include using #include <file.h>)

Quoted 3 lines

And then we also have:
- For Greg's pci-core keep the shared .h file with the .c files (and include using #include "../file.h")

Ok, sometimes I feel special, but never that "special" :) If you note, USB also does this for its core files, so there is precidence...

Anyway, is include/linux/pci/pci.h really necessary for just one file? I guess I could put the msi stuff in there, but again, I really don't want any driver including it, like they have tried to do so in the past...

thanks,

greg k-h