Skip to contentSkip to conversation

linux-2.6.18: pcifront/MSI: cleanup interface

PATCH New Jan Beulich 1 participant 1 message Apr 11, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-2.6.18: pcifront/MSI: cleanup interface

- declare functions in a header included by both producer and consumer(s)
- don't define private items in global header
- no need to (re-)declare pci_bus_sem

drivers/pci/msi-xen.c +1 -5
@@ -17,6 +17,7 @@
 
 #include <xen/interface/physdev.h>
 #include <xen/evtchn.h>
+#include <xen/pcifront.h>
 
 #include <asm/errno.h>
 #include <asm/io.h>
@@ -605,7 +606,6 @@ static int msix_capability_init(struct p
  * indicates the successful setup of an entry zero with the new MSI
  * vector or non-zero for otherwise.
  **/
-extern int pci_frontend_enable_msi(struct pci_dev *dev);
 int pci_enable_msi(struct pci_dev* dev)
 {
 	struct pci_bus *bus;
@@ -669,7 +669,6 @@ int pci_enable_msi(struct pci_dev* dev)
 	return status;
 }
 
-extern void pci_frontend_disable_msi(struct pci_dev* dev);
 void pci_disable_msi(struct pci_dev* dev)
 {
 	int pos;
@@ -730,8 +729,6 @@ void pci_disable_msi(struct pci_dev* dev
  * of vectors available. Driver should use the returned value to re-send
  * its request.
  **/
-extern int pci_frontend_enable_msix(struct pci_dev *dev,
-		struct msix_entry *entries, int nvec);
 int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
 {
 	struct pci_bus *bus;
@@ -831,7 +828,6 @@ int pci_enable_msix(struct pci_dev* dev,
 	return status;
 }
 
-extern void pci_frontend_disable_msix(struct pci_dev* dev);
 void pci_disable_msix(struct pci_dev* dev)
 {
 	int pos;
drivers/xen/pcifront/pcifront.h +31 -1
@@ -7,7 +7,6 @@
 #define __XEN_PCIFRONT_H__
 
 #include <linux/spinlock.h>
-#include <linux/pci.h>
 #include <xen/xenbus.h>
 #include <xen/interface/io/pciif.h>
 #include <linux/interrupt.h>
@@ -53,4 +52,35 @@ void pcifront_do_aer( void *data);
 
 irqreturn_t pcifront_handler_aer(int irq, void *dev, struct pt_regs *regs);
 
+#ifndef __ia64__
+
+static inline struct pcifront_device *
+pcifront_get_pdev(struct pcifront_sd *sd)
+{
+	return sd->pdev;
+}
+
+static inline void pcifront_setup_root_resources(struct pci_bus *bus,
+						 struct pcifront_sd *sd)
+{
+}
+
+#else /* __ia64__ */
+
+#define pcifront_sd pci_controller
+
+static inline struct pcifront_device *
+pcifront_get_pdev(struct pcifront_sd *sd)
+{
+	return (struct pcifront_device *)sd->platform_data;
+}
+
+static inline void pcifront_setup_root_resources(struct pci_bus *bus,
+						 struct pcifront_sd *sd)
+{
+	xen_pcibios_setup_root_windows(bus, sd);
+}
+
+#endif /* __ia64__ */
+
 #endif	/* __XEN_PCIFRONT_H__ */
include/xen/pcifront.h +7 -32
@@ -6,26 +6,22 @@
 #ifndef __XEN_ASM_PCIFRONT_H__
 #define __XEN_ASM_PCIFRONT_H__
 
-#include <linux/spinlock.h>
-
 #ifdef __KERNEL__
 
-#ifndef __ia64__
+#include <linux/pci.h>
 
-struct pcifront_device;
-struct pci_bus;
+int pci_frontend_enable_msi(struct pci_dev *);
+void pci_frontend_disable_msi(struct pci_dev *);
+int pci_frontend_enable_msix(struct pci_dev *, struct msix_entry *, int nvec);
+void pci_frontend_disable_msix(struct pci_dev *);
+
+#ifndef __ia64__
 
 struct pcifront_sd {
 	int domain;
 	struct pcifront_device *pdev;
 };
 
-static inline struct pcifront_device *
-pcifront_get_pdev(struct pcifront_sd *sd)
-{
-	return sd->pdev;
-}
-
 #if defined(CONFIG_PCI_DOMAINS)
 static inline int pci_domain_nr(struct pci_bus *bus)
 {
@@ -38,38 +34,17 @@ static inline int pci_proc_domain(struct
 }
 #endif /* CONFIG_PCI_DOMAINS */
 
-static inline void pcifront_setup_root_resources(struct pci_bus *bus,
-						 struct pcifront_sd *sd)
-{
-}
-
 #else /* __ia64__ */
 
 #include <linux/acpi.h>
-#include <asm/pci.h>
-#define pcifront_sd pci_controller
 
 extern void xen_add_resource(struct pci_controller *, unsigned int,
 			     unsigned int, struct acpi_resource *);
 extern void xen_pcibios_setup_root_windows(struct pci_bus *,
 					   struct pci_controller *);
 
-static inline struct pcifront_device *
-pcifront_get_pdev(struct pcifront_sd *sd)
-{
-	return (struct pcifront_device *)sd->platform_data;
-}
-
-static inline void pcifront_setup_root_resources(struct pci_bus *bus,
-						 struct pcifront_sd *sd)
-{
-	xen_pcibios_setup_root_windows(bus, sd);
-}
-
 #endif /* __ia64__ */
 
-extern struct rw_semaphore pci_bus_sem;
-
 #endif /* __KERNEL__ */
 
 #endif /* __XEN_ASM_PCIFRONT_H__ */

pcifront/MSI: cleanup interface

- declare functions in a header included by both producer and consumer(s)
- don't define private items in global header
- no need to (re-)declare pci_bus_sem

drivers/pci/msi-xen.c +1 -5
@@ -17,6 +17,7 @@
 
 #include <xen/interface/physdev.h>
 #include <xen/evtchn.h>
+#include <xen/pcifront.h>
 
 #include <asm/errno.h>
 #include <asm/io.h>
@@ -605,7 +606,6 @@ static int msix_capability_init(struct p
  * indicates the successful setup of an entry zero with the new MSI
  * vector or non-zero for otherwise.
  **/
-extern int pci_frontend_enable_msi(struct pci_dev *dev);
 int pci_enable_msi(struct pci_dev* dev)
 {
 	struct pci_bus *bus;
@@ -669,7 +669,6 @@ int pci_enable_msi(struct pci_dev* dev)
 	return status;
 }
 
-extern void pci_frontend_disable_msi(struct pci_dev* dev);
 void pci_disable_msi(struct pci_dev* dev)
 {
 	int pos;
@@ -730,8 +729,6 @@ void pci_disable_msi(struct pci_dev* dev
  * of vectors available. Driver should use the returned value to re-send
  * its request.
  **/
-extern int pci_frontend_enable_msix(struct pci_dev *dev,
-		struct msix_entry *entries, int nvec);
 int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
 {
 	struct pci_bus *bus;
@@ -831,7 +828,6 @@ int pci_enable_msix(struct pci_dev* dev,
 	return status;
 }
 
-extern void pci_frontend_disable_msix(struct pci_dev* dev);
 void pci_disable_msix(struct pci_dev* dev)
 {
 	int pos;
drivers/xen/pcifront/pcifront.h +31 -1
@@ -7,7 +7,6 @@
 #define __XEN_PCIFRONT_H__
 
 #include <linux/spinlock.h>
-#include <linux/pci.h>
 #include <xen/xenbus.h>
 #include <xen/interface/io/pciif.h>
 #include <linux/interrupt.h>
@@ -53,4 +52,35 @@ void pcifront_do_aer( void *data);
 
 irqreturn_t pcifront_handler_aer(int irq, void *dev, struct pt_regs *regs);
 
+#ifndef __ia64__
+
+static inline struct pcifront_device *
+pcifront_get_pdev(struct pcifront_sd *sd)
+{
+	return sd->pdev;
+}
+
+static inline void pcifront_setup_root_resources(struct pci_bus *bus,
+						 struct pcifront_sd *sd)
+{
+}
+
+#else /* __ia64__ */
+
+#define pcifront_sd pci_controller
+
+static inline struct pcifront_device *
+pcifront_get_pdev(struct pcifront_sd *sd)
+{
+	return (struct pcifront_device *)sd->platform_data;
+}
+
+static inline void pcifront_setup_root_resources(struct pci_bus *bus,
+						 struct pcifront_sd *sd)
+{
+	xen_pcibios_setup_root_windows(bus, sd);
+}
+
+#endif /* __ia64__ */
+
 #endif	/* __XEN_PCIFRONT_H__ */
include/xen/pcifront.h +7 -32
@@ -6,26 +6,22 @@
 #ifndef __XEN_ASM_PCIFRONT_H__
 #define __XEN_ASM_PCIFRONT_H__
 
-#include <linux/spinlock.h>
-
 #ifdef __KERNEL__
 
-#ifndef __ia64__
+#include <linux/pci.h>
 
-struct pcifront_device;
-struct pci_bus;
+int pci_frontend_enable_msi(struct pci_dev *);
+void pci_frontend_disable_msi(struct pci_dev *);
+int pci_frontend_enable_msix(struct pci_dev *, struct msix_entry *, int nvec);
+void pci_frontend_disable_msix(struct pci_dev *);
+
+#ifndef __ia64__
 
 struct pcifront_sd {
 	int domain;
 	struct pcifront_device *pdev;
 };
 
-static inline struct pcifront_device *
-pcifront_get_pdev(struct pcifront_sd *sd)
-{
-	return sd->pdev;
-}
-
 #if defined(CONFIG_PCI_DOMAINS)
 static inline int pci_domain_nr(struct pci_bus *bus)
 {
@@ -38,38 +34,17 @@ static inline int pci_proc_domain(struct
 }
 #endif /* CONFIG_PCI_DOMAINS */
 
-static inline void pcifront_setup_root_resources(struct pci_bus *bus,
-						 struct pcifront_sd *sd)
-{
-}
-
 #else /* __ia64__ */
 
 #include <linux/acpi.h>
-#include <asm/pci.h>
-#define pcifront_sd pci_controller
 
 extern void xen_add_resource(struct pci_controller *, unsigned int,
 			     unsigned int, struct acpi_resource *);
 extern void xen_pcibios_setup_root_windows(struct pci_bus *,
 					   struct pci_controller *);
 
-static inline struct pcifront_device *
-pcifront_get_pdev(struct pcifront_sd *sd)
-{
-	return (struct pcifront_device *)sd->platform_data;
-}
-
-static inline void pcifront_setup_root_resources(struct pci_bus *bus,
-						 struct pcifront_sd *sd)
-{
-	xen_pcibios_setup_root_windows(bus, sd);
-}
-
 #endif /* __ia64__ */
 
-extern struct rw_semaphore pci_bus_sem;
-
 #endif /* __KERNEL__ */
 
 #endif /* __XEN_ASM_PCIFRONT_H__ */

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel