diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-07-01 13:44:25 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-07-01 13:44:25 +0200 |
commit | 81148a7ab79e8a5f1e9379d5fcdd7fb73896ec18 (patch) | |
tree | ba502c6d4002b471ab36f5e05b3f890efeadadb9 /drivers/misc/cardreader | |
parent | ba2104c24aba1fa7e19d53f08c985526a6786d8b (diff) | |
download | linux-81148a7ab79e8a5f1e9379d5fcdd7fb73896ec18.tar.gz linux-81148a7ab79e8a5f1e9379d5fcdd7fb73896ec18.tar.bz2 linux-81148a7ab79e8a5f1e9379d5fcdd7fb73896ec18.zip |
Revert "cardreader/rtsx_pcr.c: use generic power management"
This reverts commit 6bf23661d4a7a105001ebb4410c1c0a17752fac4.
0-day reported build problems with it.
Reported-by: kernel test robot <lkp@intel.com>
Cc: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/cardreader')
-rw-r--r-- | drivers/misc/cardreader/rtsx_pcr.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/rtsx_pcr.c index ca5212cba1c0..0d5928bc1b6d 100644 --- a/drivers/misc/cardreader/rtsx_pcr.c +++ b/drivers/misc/cardreader/rtsx_pcr.c @@ -1604,9 +1604,10 @@ static void rtsx_pci_remove(struct pci_dev *pcidev) pci_name(pcidev), (int)pcidev->vendor, (int)pcidev->device); } -static int __maybe_unused rtsx_pci_suspend(struct device *dev_d) +#ifdef CONFIG_PM + +static int rtsx_pci_suspend(struct pci_dev *pcidev, pm_message_t state) { - struct pci_dev *pcidev = to_pci_dev(dev_d); struct pcr_handle *handle; struct rtsx_pcr *pcr; @@ -1622,15 +1623,17 @@ static int __maybe_unused rtsx_pci_suspend(struct device *dev_d) rtsx_pci_power_off(pcr, HOST_ENTER_S3); - device_wakeup_disable(dev_d); + pci_save_state(pcidev); + pci_enable_wake(pcidev, pci_choose_state(pcidev, state), 0); + pci_disable_device(pcidev); + pci_set_power_state(pcidev, pci_choose_state(pcidev, state)); mutex_unlock(&pcr->pcr_mutex); return 0; } -static int __maybe_unused rtsx_pci_resume(struct device *dev_d) +static int rtsx_pci_resume(struct pci_dev *pcidev) { - struct pci_dev *pcidev = to_pci_dev(dev_d); struct pcr_handle *handle; struct rtsx_pcr *pcr; int ret = 0; @@ -1642,6 +1645,11 @@ static int __maybe_unused rtsx_pci_resume(struct device *dev_d) mutex_lock(&pcr->pcr_mutex); + pci_set_power_state(pcidev, PCI_D0); + pci_restore_state(pcidev); + ret = pci_enable_device(pcidev); + if (ret) + goto out; pci_set_master(pcidev); ret = rtsx_pci_write_register(pcr, HOST_SLEEP_STATE, 0x03, 0x00); @@ -1659,8 +1667,6 @@ out: return ret; } -#ifdef CONFIG_PM - static void rtsx_pci_shutdown(struct pci_dev *pcidev) { struct pcr_handle *handle; @@ -1680,18 +1686,19 @@ static void rtsx_pci_shutdown(struct pci_dev *pcidev) #else /* CONFIG_PM */ +#define rtsx_pci_suspend NULL +#define rtsx_pci_resume NULL #define rtsx_pci_shutdown NULL #endif /* CONFIG_PM */ -static SIMPLE_DEV_PM_OPS(rtsx_pci_pm_ops, rtsx_pci_suspend, rtsx_pci_resume); - static struct pci_driver rtsx_pci_driver = { .name = DRV_NAME_RTSX_PCI, .id_table = rtsx_pci_ids, .probe = rtsx_pci_probe, .remove = rtsx_pci_remove, - .driver.pm = &rtsx_pci_pm_ops, + .suspend = rtsx_pci_suspend, + .resume = rtsx_pci_resume, .shutdown = rtsx_pci_shutdown, }; module_pci_driver(rtsx_pci_driver); |