Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtl818x_pci: use generic power management

Earlier, drivers had to manage the device's power states, and related
operations, themselves. With the generic approach, these are done by PCI
core.

The only driver-specific jobs, .suspend() and .resume() doing were invoking
PCI helper functions pci_save/restore_state() and
pci_set_power_state(). This is not recommeneded as PCI core takes care of
that. Hence they became empty-body functions, thus define them NULL.

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200623094454.12427-1-vaibhavgupta40@gmail.com

authored by

Vaibhav Gupta and committed by
Kalle Valo
ef642510 a7f7c15e

+4 -19
+4 -19
drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c
··· 1966 1966 ieee80211_free_hw(dev); 1967 1967 } 1968 1968 1969 - #ifdef CONFIG_PM 1970 - static int rtl8180_suspend(struct pci_dev *pdev, pm_message_t state) 1971 - { 1972 - pci_save_state(pdev); 1973 - pci_set_power_state(pdev, pci_choose_state(pdev, state)); 1974 - return 0; 1975 - } 1969 + #define rtl8180_suspend NULL 1970 + #define rtl8180_resume NULL 1976 1971 1977 - static int rtl8180_resume(struct pci_dev *pdev) 1978 - { 1979 - pci_set_power_state(pdev, PCI_D0); 1980 - pci_restore_state(pdev); 1981 - return 0; 1982 - } 1983 - 1984 - #endif /* CONFIG_PM */ 1972 + static SIMPLE_DEV_PM_OPS(rtl8180_pm_ops, rtl8180_suspend, rtl8180_resume); 1985 1973 1986 1974 static struct pci_driver rtl8180_driver = { 1987 1975 .name = KBUILD_MODNAME, 1988 1976 .id_table = rtl8180_table, 1989 1977 .probe = rtl8180_probe, 1990 1978 .remove = rtl8180_remove, 1991 - #ifdef CONFIG_PM 1992 - .suspend = rtl8180_suspend, 1993 - .resume = rtl8180_resume, 1994 - #endif /* CONFIG_PM */ 1979 + .driver.pm = &rtl8180_pm_ops, 1995 1980 }; 1996 1981 1997 1982 module_pci_driver(rtl8180_driver);