Skip to content

Commit 446cc1c

Browse files
committed
Merge branch 'pci/legacy-pm-removal'
- Convert amd64-agp, sis-agp, via-agp from legacy PCI power management to generic power management (Vaibhav Gupta) * pci/legacy-pm-removal: via-agp: convert to generic power management sis-agp: convert to generic power management amd64-agp: convert to generic power management
2 parents 7475f93 + 0aeddbd commit 446cc1c

3 files changed

Lines changed: 17 additions & 57 deletions

File tree

drivers/char/agp/amd64-agp.c

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -588,29 +588,18 @@ static void agp_amd64_remove(struct pci_dev *pdev)
588588
agp_bridges_found--;
589589
}
590590

591-
#ifdef CONFIG_PM
591+
#define agp_amd64_suspend NULL
592592

593-
static int agp_amd64_suspend(struct pci_dev *pdev, pm_message_t state)
593+
static int __maybe_unused agp_amd64_resume(struct device *dev)
594594
{
595-
pci_save_state(pdev);
596-
pci_set_power_state(pdev, pci_choose_state(pdev, state));
597-
598-
return 0;
599-
}
600-
601-
static int agp_amd64_resume(struct pci_dev *pdev)
602-
{
603-
pci_set_power_state(pdev, PCI_D0);
604-
pci_restore_state(pdev);
595+
struct pci_dev *pdev = to_pci_dev(dev);
605596

606597
if (pdev->vendor == PCI_VENDOR_ID_NVIDIA)
607598
nforce3_agp_init(pdev);
608599

609600
return amd_8151_configure();
610601
}
611602

612-
#endif /* CONFIG_PM */
613-
614603
static const struct pci_device_id agp_amd64_pci_table[] = {
615604
{
616605
.class = (PCI_CLASS_BRIDGE_HOST << 8),
@@ -738,15 +727,14 @@ static const struct pci_device_id agp_amd64_pci_promisc_table[] = {
738727
{ }
739728
};
740729

730+
static SIMPLE_DEV_PM_OPS(agp_amd64_pm_ops, agp_amd64_suspend, agp_amd64_resume);
731+
741732
static struct pci_driver agp_amd64_pci_driver = {
742733
.name = "agpgart-amd64",
743734
.id_table = agp_amd64_pci_table,
744735
.probe = agp_amd64_probe,
745736
.remove = agp_amd64_remove,
746-
#ifdef CONFIG_PM
747-
.suspend = agp_amd64_suspend,
748-
.resume = agp_amd64_resume,
749-
#endif
737+
.driver.pm = &agp_amd64_pm_ops,
750738
};
751739

752740

drivers/char/agp/sis-agp.c

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -217,26 +217,14 @@ static void agp_sis_remove(struct pci_dev *pdev)
217217
agp_put_bridge(bridge);
218218
}
219219

220-
#ifdef CONFIG_PM
220+
#define agp_sis_suspend NULL
221221

222-
static int agp_sis_suspend(struct pci_dev *pdev, pm_message_t state)
222+
static int __maybe_unused agp_sis_resume(
223+
__attribute__((unused)) struct device *dev)
223224
{
224-
pci_save_state(pdev);
225-
pci_set_power_state(pdev, pci_choose_state(pdev, state));
226-
227-
return 0;
228-
}
229-
230-
static int agp_sis_resume(struct pci_dev *pdev)
231-
{
232-
pci_set_power_state(pdev, PCI_D0);
233-
pci_restore_state(pdev);
234-
235225
return sis_driver.configure();
236226
}
237227

238-
#endif /* CONFIG_PM */
239-
240228
static const struct pci_device_id agp_sis_pci_table[] = {
241229
{
242230
.class = (PCI_CLASS_BRIDGE_HOST << 8),
@@ -419,15 +407,14 @@ static const struct pci_device_id agp_sis_pci_table[] = {
419407

420408
MODULE_DEVICE_TABLE(pci, agp_sis_pci_table);
421409

410+
static SIMPLE_DEV_PM_OPS(agp_sis_pm_ops, agp_sis_suspend, agp_sis_resume);
411+
422412
static struct pci_driver agp_sis_pci_driver = {
423413
.name = "agpgart-sis",
424414
.id_table = agp_sis_pci_table,
425415
.probe = agp_sis_probe,
426416
.remove = agp_sis_remove,
427-
#ifdef CONFIG_PM
428-
.suspend = agp_sis_suspend,
429-
.resume = agp_sis_resume,
430-
#endif
417+
.driver.pm = &agp_sis_pm_ops,
431418
};
432419

433420
static int __init agp_sis_init(void)

drivers/char/agp/via-agp.c

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -492,22 +492,11 @@ static void agp_via_remove(struct pci_dev *pdev)
492492
agp_put_bridge(bridge);
493493
}
494494

495-
#ifdef CONFIG_PM
495+
#define agp_via_suspend NULL
496496

497-
static int agp_via_suspend(struct pci_dev *pdev, pm_message_t state)
497+
static int __maybe_unused agp_via_resume(struct device *dev)
498498
{
499-
pci_save_state (pdev);
500-
pci_set_power_state (pdev, PCI_D3hot);
501-
502-
return 0;
503-
}
504-
505-
static int agp_via_resume(struct pci_dev *pdev)
506-
{
507-
struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
508-
509-
pci_set_power_state (pdev, PCI_D0);
510-
pci_restore_state(pdev);
499+
struct agp_bridge_data *bridge = dev_get_drvdata(dev);
511500

512501
if (bridge->driver == &via_agp3_driver)
513502
return via_configure_agp3();
@@ -517,8 +506,6 @@ static int agp_via_resume(struct pci_dev *pdev)
517506
return 0;
518507
}
519508

520-
#endif /* CONFIG_PM */
521-
522509
/* must be the same order as name table above */
523510
static const struct pci_device_id agp_via_pci_table[] = {
524511
#define ID(x) \
@@ -567,16 +554,14 @@ static const struct pci_device_id agp_via_pci_table[] = {
567554

568555
MODULE_DEVICE_TABLE(pci, agp_via_pci_table);
569556

557+
static SIMPLE_DEV_PM_OPS(agp_via_pm_ops, agp_via_suspend, agp_via_resume);
570558

571559
static struct pci_driver agp_via_pci_driver = {
572560
.name = "agpgart-via",
573561
.id_table = agp_via_pci_table,
574562
.probe = agp_via_probe,
575563
.remove = agp_via_remove,
576-
#ifdef CONFIG_PM
577-
.suspend = agp_via_suspend,
578-
.resume = agp_via_resume,
579-
#endif
564+
.driver.pm = &agp_via_pm_ops,
580565
};
581566

582567

0 commit comments

Comments
 (0)