--- v1
+++ v3
@@ -1,13 +1,23 @@
-Drivers using legacy power management .suspen()/.resume() callbacks
-have to manage PCI states and device's PM states themselves. They also
-need to take care of standard configuration registers.
+Drivers should do only device-specific jobs. But in general, drivers using
+legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
+PM-related tasks themselves which can be done by PCI Core itself. This
+brings extra load on the driver and it directly calls PCI helper functions
+to handle them.
-Switch to generic power management framework using a single
-"struct dev_pm_ops" variable to take the unnecessary load from the driver.
-This also avoids the need for the driver to directly call most of the PCI
-helper functions and device power state control functions, as through
-the generic framework PCI Core takes care of the necessary operations,
-and drivers are required to do only device-specific jobs.
+Switch to the new generic framework by updating function signatures and
+define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
+unnecessary calls to the PCI Helper functions along with the legacy
+.suspend & .resume bindings.
+
+The ark_pci_suspend() is not designed to function in the case of Freeze.
+Thus, the code checked for "if (state.event = PM_EVENT_FREEZE....)". This
+is because, in the legacy framework, this callback was invoked even in the
+event of Freeze. Hence, added the load of unnecessary function-call.
+
+The goal can be achieved by binding the callback with only ".suspend" and
+".poweroff" in the "ark_pci_pm_ops" const variable. This also avoids the
+step of checking "state.event = PM_EVENT_FREEZE" every time the callback
+is invoked.
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
---
@@ -15,7 +25,7 @@
1 file changed, 17 insertions(+), 24 deletions(-)
diff --git a/drivers/video/fbdev/arkfb.c b/drivers/video/fbdev/arkfb.c
-index 11ab9a153860..6a4114db0dfd 100644
+index 11ab9a153860..edf169d0816e 100644
--- a/drivers/video/fbdev/arkfb.c
+++ b/drivers/video/fbdev/arkfb.c
@@ -1085,12 +1085,11 @@ static void ark_pci_remove(struct pci_dev *dev)
@@ -93,7 +103,7 @@
+#ifdef CONFIG_PM_SLEEP
+ .suspend = ark_pci_suspend,
+ .resume = ark_pci_resume,
-+ .freeze = ark_pci_suspend,
++ .freeze = NULL,
+ .thaw = ark_pci_resume,
+ .poweroff = ark_pci_suspend,
+ .restore = ark_pci_resume,
@@ -113,4 +123,4 @@
/* Cleanup */
--
-2.27.0
+2.28.0