2021-08-28 09:04:07

by Cai,Huoqing

[permalink] [raw]
Subject: [PATCH] PCI/portdrv: Make use of the helper macro SET_SYSTEM_SLEEP_PM_OPS()/ SET_RUNTIME_PM_OPS()

Use the helper macro SET_SYSTEM_SLEEP_PM_OPS()/SET_RUNTIME_PM_OPS()
instead of the verbose operators ".runtime_suspend/_resume/_idle"
and ".suspend/.resume/.freeze/.thaw/.poweroff/.restore", because the
helper macro SET_SYSTEM_SLEEP_PM_OPS()/SET_RUNTIME_PM_OPS() could be
brought in to make code a little clearer, a little more concise.

Signed-off-by: Cai Huoqing <[email protected]>
---
drivers/pci/pcie/portdrv_pci.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index c7ff1eea225a..29d1c7de6410 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -70,17 +70,11 @@ static int pcie_port_runtime_idle(struct device *dev)
}

static const struct dev_pm_ops pcie_portdrv_pm_ops = {
- .suspend = pcie_port_device_suspend,
+ SET_SYSTEM_SLEEP_PM_OPS(pcie_port_device_suspend, pcie_port_device_resume)
+ SET_RUNTIME_PM_OPS(pcie_port_runtime_suspend,
+ pcie_port_device_runtime_resume, pcie_port_runtime_idle)
.resume_noirq = pcie_port_device_resume_noirq,
- .resume = pcie_port_device_resume,
- .freeze = pcie_port_device_suspend,
- .thaw = pcie_port_device_resume,
- .poweroff = pcie_port_device_suspend,
.restore_noirq = pcie_port_device_resume_noirq,
- .restore = pcie_port_device_resume,
- .runtime_suspend = pcie_port_runtime_suspend,
- .runtime_resume = pcie_port_device_runtime_resume,
- .runtime_idle = pcie_port_runtime_idle,
};

#define PCIE_PORTDRV_PM_OPS (&pcie_portdrv_pm_ops)
--
2.25.1