diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2009-01-01 13:52:12 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-01-07 14:13:27 -0500 |
commit | fa6c993736cb8cc18af86b8d17b608efa7882ab5 (patch) | |
tree | 7ec2c443fab2049ca49f5bf6060eec2ca5985d07 /drivers | |
parent | e7ae88486670f3904f187d0fff9dcf469bcdd8ba (diff) |
PCI: PCIe portdrv: Rearrange code so that related things are together
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pci/pcie/portdrv_bus.c | 10 | ||||
-rw-r--r-- | drivers/pci/pcie/portdrv_core.c | 90 |
2 files changed, 50 insertions, 50 deletions
diff --git a/drivers/pci/pcie/portdrv_bus.c b/drivers/pci/pcie/portdrv_bus.c index 3a03db4323ad..eec89b767f9f 100644 --- a/drivers/pci/pcie/portdrv_bus.c +++ b/drivers/pci/pcie/portdrv_bus.c | |||
@@ -44,3 +44,13 @@ static int pcie_port_bus_match(struct device *dev, struct device_driver *drv) | |||
44 | 44 | ||
45 | return 1; | 45 | return 1; |
46 | } | 46 | } |
47 | |||
48 | int pcie_port_bus_register(void) | ||
49 | { | ||
50 | return bus_register(&pcie_port_bus_type); | ||
51 | } | ||
52 | |||
53 | void pcie_port_bus_unregister(void) | ||
54 | { | ||
55 | bus_unregister(&pcie_port_bus_type); | ||
56 | } | ||
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 6ca5a40cc61c..a0d51e3f34f4 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c | |||
@@ -19,50 +19,6 @@ | |||
19 | 19 | ||
20 | extern int pcie_mch_quirk; /* MSI-quirk Indicator */ | 20 | extern int pcie_mch_quirk; /* MSI-quirk Indicator */ |
21 | 21 | ||
22 | static int pcie_port_probe_service(struct device *dev) | ||
23 | { | ||
24 | struct pcie_device *pciedev; | ||
25 | struct pcie_port_service_driver *driver; | ||
26 | int status; | ||
27 | |||
28 | if (!dev || !dev->driver) | ||
29 | return -ENODEV; | ||
30 | |||
31 | driver = to_service_driver(dev->driver); | ||
32 | if (!driver || !driver->probe) | ||
33 | return -ENODEV; | ||
34 | |||
35 | pciedev = to_pcie_device(dev); | ||
36 | status = driver->probe(pciedev, driver->id_table); | ||
37 | if (!status) { | ||
38 | dev_printk(KERN_DEBUG, dev, "service driver %s loaded\n", | ||
39 | driver->name); | ||
40 | get_device(dev); | ||
41 | } | ||
42 | return status; | ||
43 | } | ||
44 | |||
45 | static int pcie_port_remove_service(struct device *dev) | ||
46 | { | ||
47 | struct pcie_device *pciedev; | ||
48 | struct pcie_port_service_driver *driver; | ||
49 | |||
50 | if (!dev || !dev->driver) | ||
51 | return 0; | ||
52 | |||
53 | pciedev = to_pcie_device(dev); | ||
54 | driver = to_service_driver(dev->driver); | ||
55 | if (driver && driver->remove) { | ||
56 | dev_printk(KERN_DEBUG, dev, "unloading service driver %s\n", | ||
57 | driver->name); | ||
58 | driver->remove(pciedev); | ||
59 | put_device(dev); | ||
60 | } | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | static void pcie_port_shutdown_service(struct device *dev) {} | ||
65 | |||
66 | /** | 22 | /** |
67 | * release_pcie_device - free PCI Express port service device structure | 23 | * release_pcie_device - free PCI Express port service device structure |
68 | * @dev: Port service device to release | 24 | * @dev: Port service device to release |
@@ -414,16 +370,50 @@ void pcie_port_device_remove(struct pci_dev *dev) | |||
414 | pci_disable_msi(dev); | 370 | pci_disable_msi(dev); |
415 | } | 371 | } |
416 | 372 | ||
417 | int pcie_port_bus_register(void) | 373 | static int pcie_port_probe_service(struct device *dev) |
418 | { | 374 | { |
419 | return bus_register(&pcie_port_bus_type); | 375 | struct pcie_device *pciedev; |
376 | struct pcie_port_service_driver *driver; | ||
377 | int status; | ||
378 | |||
379 | if (!dev || !dev->driver) | ||
380 | return -ENODEV; | ||
381 | |||
382 | driver = to_service_driver(dev->driver); | ||
383 | if (!driver || !driver->probe) | ||
384 | return -ENODEV; | ||
385 | |||
386 | pciedev = to_pcie_device(dev); | ||
387 | status = driver->probe(pciedev, driver->id_table); | ||
388 | if (!status) { | ||
389 | dev_printk(KERN_DEBUG, dev, "service driver %s loaded\n", | ||
390 | driver->name); | ||
391 | get_device(dev); | ||
392 | } | ||
393 | return status; | ||
420 | } | 394 | } |
421 | 395 | ||
422 | void pcie_port_bus_unregister(void) | 396 | static int pcie_port_remove_service(struct device *dev) |
423 | { | 397 | { |
424 | bus_unregister(&pcie_port_bus_type); | 398 | struct pcie_device *pciedev; |
399 | struct pcie_port_service_driver *driver; | ||
400 | |||
401 | if (!dev || !dev->driver) | ||
402 | return 0; | ||
403 | |||
404 | pciedev = to_pcie_device(dev); | ||
405 | driver = to_service_driver(dev->driver); | ||
406 | if (driver && driver->remove) { | ||
407 | dev_printk(KERN_DEBUG, dev, "unloading service driver %s\n", | ||
408 | driver->name); | ||
409 | driver->remove(pciedev); | ||
410 | put_device(dev); | ||
411 | } | ||
412 | return 0; | ||
425 | } | 413 | } |
426 | 414 | ||
415 | static void pcie_port_shutdown_service(struct device *dev) {} | ||
416 | |||
427 | int pcie_port_service_register(struct pcie_port_service_driver *new) | 417 | int pcie_port_service_register(struct pcie_port_service_driver *new) |
428 | { | 418 | { |
429 | new->driver.name = (char *)new->name; | 419 | new->driver.name = (char *)new->name; |
@@ -435,9 +425,9 @@ int pcie_port_service_register(struct pcie_port_service_driver *new) | |||
435 | return driver_register(&new->driver); | 425 | return driver_register(&new->driver); |
436 | } | 426 | } |
437 | 427 | ||
438 | void pcie_port_service_unregister(struct pcie_port_service_driver *new) | 428 | void pcie_port_service_unregister(struct pcie_port_service_driver *drv) |
439 | { | 429 | { |
440 | driver_unregister(&new->driver); | 430 | driver_unregister(&drv->driver); |
441 | } | 431 | } |
442 | 432 | ||
443 | EXPORT_SYMBOL(pcie_port_service_register); | 433 | EXPORT_SYMBOL(pcie_port_service_register); |