PCI: PCIe portdrv: Rearrange code so that related things are together
authorRafael J. Wysocki <rjw@sisk.pl>
Thu, 1 Jan 2009 18:52:12 +0000 (19:52 +0100)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Wed, 7 Jan 2009 19:13:27 +0000 (11:13 -0800)
Rearrange code in drivers/pci/pcie/portdrv_bus.c and
drivers/pci/pcie/portdrv_core.c so that related functions and data
structures are closer together.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
drivers/pci/pcie/portdrv_bus.c
drivers/pci/pcie/portdrv_core.c

index 3a03db4323ad25f6882808f07100e4f43b04abdb..eec89b767f9f828d3389ef2584ad5fd103388869 100644 (file)
@@ -44,3 +44,13 @@ static int pcie_port_bus_match(struct device *dev, struct device_driver *drv)
 
        return 1;
 }
+
+int pcie_port_bus_register(void)
+{
+       return bus_register(&pcie_port_bus_type);
+}
+
+void pcie_port_bus_unregister(void)
+{
+       bus_unregister(&pcie_port_bus_type);
+}
index 6ca5a40cc61c19042c85d20dfa12ee121f1650ed..a0d51e3f34f4879f2ff5321caa1ff3c0a1b06eb8 100644 (file)
 
 extern int pcie_mch_quirk;     /* MSI-quirk Indicator */
 
-static int pcie_port_probe_service(struct device *dev)
-{
-       struct pcie_device *pciedev;
-       struct pcie_port_service_driver *driver;
-       int status;
-
-       if (!dev || !dev->driver)
-               return -ENODEV;
-
-       driver = to_service_driver(dev->driver);
-       if (!driver || !driver->probe)
-               return -ENODEV;
-
-       pciedev = to_pcie_device(dev);
-       status = driver->probe(pciedev, driver->id_table);
-       if (!status) {
-               dev_printk(KERN_DEBUG, dev, "service driver %s loaded\n",
-                       driver->name);
-               get_device(dev);
-       }
-       return status;
-}
-
-static int pcie_port_remove_service(struct device *dev)
-{
-       struct pcie_device *pciedev;
-       struct pcie_port_service_driver *driver;
-
-       if (!dev || !dev->driver)
-               return 0;
-
-       pciedev = to_pcie_device(dev);
-       driver = to_service_driver(dev->driver);
-       if (driver && driver->remove) { 
-               dev_printk(KERN_DEBUG, dev, "unloading service driver %s\n",
-                       driver->name);
-               driver->remove(pciedev);
-               put_device(dev);
-       }
-       return 0;
-}
-
-static void pcie_port_shutdown_service(struct device *dev) {}
-
 /**
  * release_pcie_device - free PCI Express port service device structure
  * @dev: Port service device to release
@@ -414,16 +370,50 @@ void pcie_port_device_remove(struct pci_dev *dev)
                pci_disable_msi(dev);
 }
 
-int pcie_port_bus_register(void)
+static int pcie_port_probe_service(struct device *dev)
 {
-       return bus_register(&pcie_port_bus_type);
+       struct pcie_device *pciedev;
+       struct pcie_port_service_driver *driver;
+       int status;
+
+       if (!dev || !dev->driver)
+               return -ENODEV;
+
+       driver = to_service_driver(dev->driver);
+       if (!driver || !driver->probe)
+               return -ENODEV;
+
+       pciedev = to_pcie_device(dev);
+       status = driver->probe(pciedev, driver->id_table);
+       if (!status) {
+               dev_printk(KERN_DEBUG, dev, "service driver %s loaded\n",
+                       driver->name);
+               get_device(dev);
+       }
+       return status;
 }
 
-void pcie_port_bus_unregister(void)
+static int pcie_port_remove_service(struct device *dev)
 {
-       bus_unregister(&pcie_port_bus_type);
+       struct pcie_device *pciedev;
+       struct pcie_port_service_driver *driver;
+
+       if (!dev || !dev->driver)
+               return 0;
+
+       pciedev = to_pcie_device(dev);
+       driver = to_service_driver(dev->driver);
+       if (driver && driver->remove) {
+               dev_printk(KERN_DEBUG, dev, "unloading service driver %s\n",
+                       driver->name);
+               driver->remove(pciedev);
+               put_device(dev);
+       }
+       return 0;
 }
 
+static void pcie_port_shutdown_service(struct device *dev) {}
+
 int pcie_port_service_register(struct pcie_port_service_driver *new)
 {
        new->driver.name = (char *)new->name;
@@ -435,9 +425,9 @@ int pcie_port_service_register(struct pcie_port_service_driver *new)
        return driver_register(&new->driver);
 }
 
-void pcie_port_service_unregister(struct pcie_port_service_driver *new)
+void pcie_port_service_unregister(struct pcie_port_service_driver *drv)
 {
-       driver_unregister(&new->driver);
+       driver_unregister(&drv->driver);
 }
 
 EXPORT_SYMBOL(pcie_port_service_register);