WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] linux: fix warnings (some errors with -Werror-implic

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] linux: fix warnings (some errors with -Werror-implicit-function-declaration) in PCI-MSI code
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Wed, 23 Jul 2008 13:26:46 +0100
Delivery-date: Wed, 23 Jul 2008 05:26:44 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Plus a little bit of other cleanup.

As usual, written and tested on 2.6.26 and made apply to the 2.6.18
tree without further testing.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: head-2008-07-21/drivers/pci/msi.h
===================================================================
--- head-2008-07-21.orig/drivers/pci/msi.h      2008-07-22 10:40:56.000000000 
+0200
+++ head-2008-07-21/drivers/pci/msi.h   2008-07-22 10:23:23.000000000 +0200
@@ -84,11 +84,6 @@
 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
  */
Index: head-2008-07-21/drivers/pci/msi-xen.c
===================================================================
--- head-2008-07-21.orig/drivers/pci/msi-xen.c  2008-07-22 10:40:56.000000000 
+0200
+++ head-2008-07-21/drivers/pci/msi-xen.c       2008-07-22 10:34:02.000000000 
+0200
@@ -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 @@ EXPORT_SYMBOL(register_msi_get_owner);
 
 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;
 }
 
 /*
Index: head-2008-07-21/drivers/xen/core/pci.c
===================================================================
--- head-2008-07-21.orig/drivers/xen/core/pci.c 2008-07-22 10:40:56.000000000 
+0200
+++ head-2008-07-21/drivers/xen/core/pci.c      2008-07-22 10:19:07.000000000 
+0200
@@ -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;
 }
 
Index: head-2008-07-21/drivers/xen/pciback/pci_stub.c
===================================================================
--- head-2008-07-21.orig/drivers/xen/pciback/pci_stub.c 2008-07-22 
10:40:56.000000000 +0200
+++ head-2008-07-21/drivers/xen/pciback/pci_stub.c      2008-07-22 
10:25:42.000000000 +0200
@@ -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();
 
Index: head-2008-07-21/include/linux/pci.h
===================================================================
--- head-2008-07-21.orig/include/linux/pci.h    2008-07-22 10:40:56.000000000 
+0200
+++ head-2008-07-21/include/linux/pci.h 2008-07-22 10:41:49.000000000 +0200
@@ -599,6 +599,10 @@ static inline void msi_remove_pci_irq_ve
        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 void pci_msix_shutdown(struct pci
        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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] linux: fix warnings (some errors with -Werror-implicit-function-declaration) in PCI-MSI code, Jan Beulich <=