[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] xen: fix warnings (some errors with -Werror-implicit-function-declaration) in PCI-MSI code



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1216816613 -3600
# Node ID 268d6984c8e2b3ecf02a609dc832253b042c64da
# Parent  3bcc901cbd7a45c96520b6a99d483a349169cbd4
xen: fix warnings (some errors with -Werror-implicit-function-declaration) in 
PCI-MSI code

Plus a little bit of other cleanup.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 drivers/pci/msi-xen.c          |   25 ++++++++++++-------------
 drivers/pci/msi.h              |    5 -----
 drivers/xen/core/pci.c         |    6 ++++--
 drivers/xen/pciback/pci_stub.c |    6 +-----
 include/linux/pci.h            |    8 ++++++++
 5 files changed, 25 insertions(+), 25 deletions(-)

diff -r 3bcc901cbd7a -r 268d6984c8e2 drivers/pci/msi-xen.c
--- a/drivers/pci/msi-xen.c     Wed Jul 23 09:57:44 2008 +0100
+++ b/drivers/pci/msi-xen.c     Wed Jul 23 13:36:53 2008 +0100
@@ -116,7 +116,7 @@ static void detach_pirq_entry(int entry_
 /*
  * pciback will provide device's owner
  */
-int (*get_owner)(struct pci_dev *dev);
+static int (*get_owner)(struct pci_dev *dev);
 
 int register_msi_get_owner(int (*func)(struct pci_dev *dev))
 {
@@ -130,33 +130,32 @@ int register_msi_get_owner(int (*func)(s
 
 int unregister_msi_get_owner(int (*func)(struct pci_dev *dev))
 {
-       if (get_owner == func)
-               get_owner = NULL;
+       if (get_owner != func)
+               return -EINVAL;
+       get_owner = NULL;
        return 0;
 }
 
 static int msi_get_dev_owner(struct pci_dev *dev)
 {
-       int owner = DOMID_SELF;
+       int owner;
 
        BUG_ON(!is_initial_xendomain());
-       if (get_owner && (owner = get_owner(dev)) >=0 ) {
+       if (get_owner && (owner = get_owner(dev)) >= 0) {
                printk(KERN_INFO "get owner for dev %x get %x \n",
-                                   dev->devfn, owner);
+                      dev->devfn, owner);
                return owner;
        }
-       else
-               return DOMID_SELF;
+
+       return DOMID_SELF;
 }
 
 static int msi_unmap_pirq(struct pci_dev *dev, int pirq)
 {
        struct physdev_unmap_pirq unmap;
        int rc;
-       domid_t domid = DOMID_SELF;
-
-       domid = msi_get_dev_owner(dev);
-       unmap.domid = domid;
+
+       unmap.domid = msi_get_dev_owner(dev);
        unmap.pirq = pirq;
 
        if ((rc = HYPERVISOR_physdev_op(PHYSDEVOP_unmap_pirq, &unmap)))
@@ -164,7 +163,7 @@ static int msi_unmap_pirq(struct pci_dev
 
        if (rc < 0)
                return rc;
-    return 0;
+       return 0;
 }
 
 /*
diff -r 3bcc901cbd7a -r 268d6984c8e2 drivers/pci/msi.h
--- a/drivers/pci/msi.h Wed Jul 23 09:57:44 2008 +0100
+++ b/drivers/pci/msi.h Wed Jul 23 13:36:53 2008 +0100
@@ -84,11 +84,6 @@ extern void (*interrupt[NR_IRQS])(void);
 extern void (*interrupt[NR_IRQS])(void);
 extern int pci_vector_resources(int last, int nr_released);
 
-#ifdef CONFIG_XEN
-extern int unregister_msi_get_owner(int (*func)(struct pci_dev *dev));
-extern int register_msi_get_owner(int (*func)(struct pci_dev *dev));
-#endif
-
 /*
  * MSI-X Address Register
  */
diff -r 3bcc901cbd7a -r 268d6984c8e2 drivers/xen/core/pci.c
--- a/drivers/xen/core/pci.c    Wed Jul 23 09:57:44 2008 +0100
+++ b/drivers/xen/core/pci.c    Wed Jul 23 13:36:53 2008 +0100
@@ -24,7 +24,8 @@ static int pci_bus_probe_wrapper(struct 
 
        r = pci_bus_probe(dev);
        if (r)
-               HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove, &manage_pci);
+               WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove,
+                                             &manage_pci));
 
        return r;
 }
@@ -40,7 +41,8 @@ static int pci_bus_remove_wrapper(struct
        r = pci_bus_remove(dev);
        /* dev and pci_dev are no longer valid!! */
 
-       HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove, &manage_pci);
+       WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove,
+               &manage_pci));
        return r;
 }
 
diff -r 3bcc901cbd7a -r 268d6984c8e2 drivers/xen/pciback/pci_stub.c
--- a/drivers/xen/pciback/pci_stub.c    Wed Jul 23 09:57:44 2008 +0100
+++ b/drivers/xen/pciback/pci_stub.c    Wed Jul 23 13:36:53 2008 +0100
@@ -832,9 +832,7 @@ static void pcistub_exit(void)
        driver_remove_file(&pciback_pci_driver.driver, &driver_attr_permissive);
 
        pci_unregister_driver(&pciback_pci_driver);
-#ifdef CONFIG_PCI_MSI
-       unregister_msi_get_owner(pciback_get_owner);
-#endif
+       WARN_ON(unregister_msi_get_owner(pciback_get_owner));
 }
 
 static int __init pcistub_init(void)
@@ -892,10 +890,8 @@ static int __init pcistub_init(void)
                err = driver_create_file(&pciback_pci_driver.driver,
                                         &driver_attr_permissive);
 
-#ifdef CONFIG_PCI_MSI
        if (!err)
                err = register_msi_get_owner(pciback_get_owner);
-#endif
        if (err)
                pcistub_exit();
 
diff -r 3bcc901cbd7a -r 268d6984c8e2 include/linux/pci.h
--- a/include/linux/pci.h       Wed Jul 23 09:57:44 2008 +0100
+++ b/include/linux/pci.h       Wed Jul 23 13:36:53 2008 +0100
@@ -599,6 +599,10 @@ static inline int pci_enable_msix(struct
        struct msix_entry *entries, int nvec) {return -1;}
 static inline void pci_disable_msix(struct pci_dev *dev) {}
 static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) {}
+#ifdef CONFIG_XEN
+#define register_msi_get_owner(func) 0
+#define unregister_msi_get_owner(func) 0
+#endif
 #else
 extern void pci_scan_msi_device(struct pci_dev *dev);
 extern int pci_enable_msi(struct pci_dev *dev);
@@ -607,6 +611,10 @@ extern int pci_enable_msix(struct pci_de
        struct msix_entry *entries, int nvec);
 extern void pci_disable_msix(struct pci_dev *dev);
 extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
+#ifdef CONFIG_XEN
+extern int register_msi_get_owner(int (*func)(struct pci_dev *dev));
+extern int unregister_msi_get_owner(int (*func)(struct pci_dev *dev));
+#endif
 #endif
 
 extern void pci_block_user_cfg_access(struct pci_dev *dev);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.