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 5/8] [xen/pci] Switch over from pci_frontend_* to xen

    [xen/pcifront] Register pci_frontend_[enable|disable]_[msi|msix] functions.
    
    Take advantage of the new registration mechanism.
    Remove the EXPORT_SYMBOL and alter the four functions to be static.

diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index cc3b51b..f262b6b 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -256,8 +256,8 @@ struct pci_ops pcifront_bus_ops = {
 };
 
 #ifdef CONFIG_PCI_MSI
-int pci_frontend_enable_msix(struct pci_dev *dev,
-               int **vector, int nvec)
+static int pci_frontend_enable_msix(struct pci_dev *dev,
+                                   int **vector, int nvec)
 {
        int err;
        int i;
@@ -304,9 +304,8 @@ int pci_frontend_enable_msix(struct pci_dev *dev,
                return err;
        }
 }
-EXPORT_SYMBOL_GPL(pci_frontend_enable_msix);
 
-void pci_frontend_disable_msix(struct pci_dev *dev)
+static void pci_frontend_disable_msix(struct pci_dev *dev)
 {
        int err;
        struct xen_pci_op op = {
@@ -324,9 +323,8 @@ void pci_frontend_disable_msix(struct pci_dev *dev)
        if (err)
                dev_err(&dev->dev, "pci_disable_msix get err %x\n", err);
 }
-EXPORT_SYMBOL_GPL(pci_frontend_disable_msix);
 
-int pci_frontend_enable_msi(struct pci_dev *dev, int **vector)
+static int pci_frontend_enable_msi(struct pci_dev *dev, int **vector)
 {
        int err;
        struct xen_pci_op op = {
@@ -348,9 +346,8 @@ int pci_frontend_enable_msi(struct pci_dev *dev, int 
**vector)
        }
        return err;
 }
-EXPORT_SYMBOL(pci_frontend_enable_msi);
 
-void pci_frontend_disable_msi(struct pci_dev *dev)
+static void pci_frontend_disable_msi(struct pci_dev *dev)
 {
        int err;
        struct xen_pci_op op = {
@@ -372,7 +369,24 @@ void pci_frontend_disable_msi(struct pci_dev *dev)
                /* how can pciback notify us fail? */
                printk(KERN_DEBUG "get fake response frombackend \n");
 }
-EXPORT_SYMBOL_GPL(pci_frontend_disable_msi);
+
+static void pci_frontend_registrar(int enable)
+{
+
+       struct xen_pci_frontend_ops pci_frontend_ops = {
+               .enable_msi = pci_frontend_enable_msi,
+               .disable_msi = pci_frontend_disable_msi,
+               .enable_msix = pci_frontend_enable_msix,
+               .disable_msix = pci_frontend_disable_msix,
+       };
+
+       if (enable)
+               xen_pci_frontend = &pci_frontend_ops;
+       else
+               xen_pci_frontend = NULL;
+};
+#else
+static inline void pci_frontend_registrar(int enable) { };
 #endif /* CONFIG_PCI_MSI */
 
 /* Claim resources for the PCI frontend as-is, backend won't allow changes */
@@ -1119,12 +1133,15 @@ static int __init pcifront_init(void)
        if (!xen_domain())
                return -ENODEV;
 
+       pci_frontend_registrar(1 /* enable */);
+
        return xenbus_register_frontend(&xenbus_pcifront_driver);
 }
 
 static void __exit pcifront_cleanup(void)
 {
        xenbus_unregister_driver(&xenbus_pcifront_driver);
+       pci_frontend_registrar(0 /* disable */);
 }
 module_init(pcifront_init);
 module_exit(pcifront_cleanup);

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