diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2009-02-15 16:32:48 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-03-20 13:47:49 -0400 |
commit | 3a3c244c9a355105bc193fde873c73727bf87192 (patch) | |
tree | cabffedef7a283c8caa6618e46a57660068cde99 /drivers | |
parent | ae40582e9959cdb7bfe4b918be8e3d19f9511798 (diff) |
PCI: PCIe portdrv: Implement pm object
Implement pm object for the PCI Express port driver in order to use
the new power management framework and reduce the code size.
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/hotplug/pciehp_core.c | 4 | ||||
-rw-r--r-- | drivers/pci/pcie/aer/aerdrv.c | 6 | ||||
-rw-r--r-- | drivers/pci/pcie/portdrv.h | 4 | ||||
-rw-r--r-- | drivers/pci/pcie/portdrv_core.c | 14 | ||||
-rw-r--r-- | drivers/pci/pcie/portdrv_pci.c | 31 |
5 files changed, 25 insertions, 34 deletions
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 3d21bbba3308..fb254b2454de 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
@@ -475,7 +475,7 @@ static void pciehp_remove (struct pcie_device *dev) | |||
475 | } | 475 | } |
476 | 476 | ||
477 | #ifdef CONFIG_PM | 477 | #ifdef CONFIG_PM |
478 | static int pciehp_suspend (struct pcie_device *dev, pm_message_t state) | 478 | static int pciehp_suspend (struct pcie_device *dev) |
479 | { | 479 | { |
480 | dev_info(&dev->device, "%s ENTRY\n", __func__); | 480 | dev_info(&dev->device, "%s ENTRY\n", __func__); |
481 | return 0; | 481 | return 0; |
@@ -503,7 +503,7 @@ static int pciehp_resume (struct pcie_device *dev) | |||
503 | } | 503 | } |
504 | return 0; | 504 | return 0; |
505 | } | 505 | } |
506 | #endif | 506 | #endif /* PM */ |
507 | 507 | ||
508 | static struct pcie_port_service_driver hpdriver_portdrv = { | 508 | static struct pcie_port_service_driver hpdriver_portdrv = { |
509 | .name = PCIE_MODULE_NAME, | 509 | .name = PCIE_MODULE_NAME, |
diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c index e11c03194063..32ade5af927e 100644 --- a/drivers/pci/pcie/aer/aerdrv.c +++ b/drivers/pci/pcie/aer/aerdrv.c | |||
@@ -40,9 +40,6 @@ MODULE_LICENSE("GPL"); | |||
40 | 40 | ||
41 | static int __devinit aer_probe (struct pcie_device *dev); | 41 | static int __devinit aer_probe (struct pcie_device *dev); |
42 | static void aer_remove(struct pcie_device *dev); | 42 | static void aer_remove(struct pcie_device *dev); |
43 | static int aer_suspend(struct pcie_device *dev, pm_message_t state) | ||
44 | {return 0;} | ||
45 | static int aer_resume(struct pcie_device *dev) {return 0;} | ||
46 | static pci_ers_result_t aer_error_detected(struct pci_dev *dev, | 43 | static pci_ers_result_t aer_error_detected(struct pci_dev *dev, |
47 | enum pci_channel_state error); | 44 | enum pci_channel_state error); |
48 | static void aer_error_resume(struct pci_dev *dev); | 45 | static void aer_error_resume(struct pci_dev *dev); |
@@ -61,9 +58,6 @@ static struct pcie_port_service_driver aerdriver = { | |||
61 | .probe = aer_probe, | 58 | .probe = aer_probe, |
62 | .remove = aer_remove, | 59 | .remove = aer_remove, |
63 | 60 | ||
64 | .suspend = aer_suspend, | ||
65 | .resume = aer_resume, | ||
66 | |||
67 | .err_handler = &aer_error_handlers, | 61 | .err_handler = &aer_error_handlers, |
68 | 62 | ||
69 | .reset_link = aer_root_reset, | 63 | .reset_link = aer_root_reset, |
diff --git a/drivers/pci/pcie/portdrv.h b/drivers/pci/pcie/portdrv.h index 5b818bd835ef..17ad53868f9f 100644 --- a/drivers/pci/pcie/portdrv.h +++ b/drivers/pci/pcie/portdrv.h | |||
@@ -38,8 +38,8 @@ extern struct bus_type pcie_port_bus_type; | |||
38 | extern int pcie_port_device_probe(struct pci_dev *dev); | 38 | extern int pcie_port_device_probe(struct pci_dev *dev); |
39 | extern int pcie_port_device_register(struct pci_dev *dev); | 39 | extern int pcie_port_device_register(struct pci_dev *dev); |
40 | #ifdef CONFIG_PM | 40 | #ifdef CONFIG_PM |
41 | extern int pcie_port_device_suspend(struct pci_dev *dev, pm_message_t state); | 41 | extern int pcie_port_device_suspend(struct device *dev); |
42 | extern int pcie_port_device_resume(struct pci_dev *dev); | 42 | extern int pcie_port_device_resume(struct device *dev); |
43 | #endif | 43 | #endif |
44 | extern void pcie_port_device_remove(struct pci_dev *dev); | 44 | extern void pcie_port_device_remove(struct pci_dev *dev); |
45 | extern int __must_check pcie_port_bus_register(void); | 45 | extern int __must_check pcie_port_bus_register(void); |
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 569af0015fce..5a5bfe7cdf5f 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c | |||
@@ -410,13 +410,12 @@ int pcie_port_device_register(struct pci_dev *dev) | |||
410 | static int suspend_iter(struct device *dev, void *data) | 410 | static int suspend_iter(struct device *dev, void *data) |
411 | { | 411 | { |
412 | struct pcie_port_service_driver *service_driver; | 412 | struct pcie_port_service_driver *service_driver; |
413 | pm_message_t state = * (pm_message_t *) data; | ||
414 | 413 | ||
415 | if ((dev->bus == &pcie_port_bus_type) && | 414 | if ((dev->bus == &pcie_port_bus_type) && |
416 | (dev->driver)) { | 415 | (dev->driver)) { |
417 | service_driver = to_service_driver(dev->driver); | 416 | service_driver = to_service_driver(dev->driver); |
418 | if (service_driver->suspend) | 417 | if (service_driver->suspend) |
419 | service_driver->suspend(to_pcie_device(dev), state); | 418 | service_driver->suspend(to_pcie_device(dev)); |
420 | } | 419 | } |
421 | return 0; | 420 | return 0; |
422 | } | 421 | } |
@@ -424,11 +423,10 @@ static int suspend_iter(struct device *dev, void *data) | |||
424 | /** | 423 | /** |
425 | * pcie_port_device_suspend - suspend port services associated with a PCIe port | 424 | * pcie_port_device_suspend - suspend port services associated with a PCIe port |
426 | * @dev: PCI Express port to handle | 425 | * @dev: PCI Express port to handle |
427 | * @state: Representation of system power management transition in progress | ||
428 | */ | 426 | */ |
429 | int pcie_port_device_suspend(struct pci_dev *dev, pm_message_t state) | 427 | int pcie_port_device_suspend(struct device *dev) |
430 | { | 428 | { |
431 | return device_for_each_child(&dev->dev, &state, suspend_iter); | 429 | return device_for_each_child(dev, NULL, suspend_iter); |
432 | } | 430 | } |
433 | 431 | ||
434 | static int resume_iter(struct device *dev, void *data) | 432 | static int resume_iter(struct device *dev, void *data) |
@@ -448,11 +446,11 @@ static int resume_iter(struct device *dev, void *data) | |||
448 | * pcie_port_device_suspend - resume port services associated with a PCIe port | 446 | * pcie_port_device_suspend - resume port services associated with a PCIe port |
449 | * @dev: PCI Express port to handle | 447 | * @dev: PCI Express port to handle |
450 | */ | 448 | */ |
451 | int pcie_port_device_resume(struct pci_dev *dev) | 449 | int pcie_port_device_resume(struct device *dev) |
452 | { | 450 | { |
453 | return device_for_each_child(&dev->dev, NULL, resume_iter); | 451 | return device_for_each_child(dev, NULL, resume_iter); |
454 | } | 452 | } |
455 | #endif | 453 | #endif /* PM */ |
456 | 454 | ||
457 | static int remove_iter(struct device *dev, void *data) | 455 | static int remove_iter(struct device *dev, void *data) |
458 | { | 456 | { |
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index 94d0e2af9bad..a61f4930d676 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c | |||
@@ -44,21 +44,21 @@ static int pcie_portdrv_restore_config(struct pci_dev *dev) | |||
44 | } | 44 | } |
45 | 45 | ||
46 | #ifdef CONFIG_PM | 46 | #ifdef CONFIG_PM |
47 | static int pcie_portdrv_suspend(struct pci_dev *dev, pm_message_t state) | 47 | static struct dev_pm_ops pcie_portdrv_pm_ops = { |
48 | { | 48 | .suspend = pcie_port_device_suspend, |
49 | return pcie_port_device_suspend(dev, state); | 49 | .resume = pcie_port_device_resume, |
50 | .freeze = pcie_port_device_suspend, | ||
51 | .thaw = pcie_port_device_resume, | ||
52 | .poweroff = pcie_port_device_suspend, | ||
53 | .restore = pcie_port_device_resume, | ||
54 | }; | ||
50 | 55 | ||
51 | } | 56 | #define PCIE_PORTDRV_PM_OPS (&pcie_portdrv_pm_ops) |
52 | 57 | ||
53 | static int pcie_portdrv_resume(struct pci_dev *dev) | 58 | #else /* !PM */ |
54 | { | 59 | |
55 | pci_set_master(dev); | 60 | #define PCIE_PORTDRV_PM_OPS NULL |
56 | return pcie_port_device_resume(dev); | 61 | #endif /* !PM */ |
57 | } | ||
58 | #else | ||
59 | #define pcie_portdrv_suspend NULL | ||
60 | #define pcie_portdrv_resume NULL | ||
61 | #endif | ||
62 | 62 | ||
63 | /* | 63 | /* |
64 | * pcie_portdrv_probe - Probe PCI-Express port devices | 64 | * pcie_portdrv_probe - Probe PCI-Express port devices |
@@ -268,10 +268,9 @@ static struct pci_driver pcie_portdriver = { | |||
268 | .probe = pcie_portdrv_probe, | 268 | .probe = pcie_portdrv_probe, |
269 | .remove = pcie_portdrv_remove, | 269 | .remove = pcie_portdrv_remove, |
270 | 270 | ||
271 | .suspend = pcie_portdrv_suspend, | ||
272 | .resume = pcie_portdrv_resume, | ||
273 | |||
274 | .err_handler = &pcie_portdrv_err_handler, | 271 | .err_handler = &pcie_portdrv_err_handler, |
272 | |||
273 | .driver.pm = PCIE_PORTDRV_PM_OPS, | ||
275 | }; | 274 | }; |
276 | 275 | ||
277 | static int __init pcie_portdrv_init(void) | 276 | static int __init pcie_portdrv_init(void) |