From ab5fe88aef4b4837bc2f92fc9f6f9c9b75ef633b Mon Sep 17 00:00:00 2001 From: Vaibhav Gupta Date: Thu, 20 Aug 2020 00:26:45 +0530 Subject: fbdev: via-core: use generic power management 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 the new generic framework by updating function signatures and define a "struct dev_pm_ops" variable to bind PM callbacks. The via_suspend() is designed to function only in the case of Suspend. Thus, the code checked for "if (state.event != PM_EVENT_SUSPEND)". This is because, in the legacy framework, this callback was invoked even in the event of Freeze and Hibernate. Hence, added the load of unnecessary function-calls. The goal can be achieved by binding the callback with only "via_pm_ops.suspend" in the new framework. This also avoids the step of checking "if (state.event != PM_EVENT_SUSPEND)" every time the callback is invoked. Signed-off-by: Vaibhav Gupta Cc: Bjorn Helgaas Cc: Bjorn Helgaas Cc: Bjorn Helgaas Cc: Vaibhav Gupta Cc: Sam Ravnborg Cc: Paul Mackerras Cc: Russell King Cc: Andres Salomon CC: Antonino Daplas Cc: Shuah Khan Signed-off-by: Bartlomiej Zolnierkiewicz Link: https://patchwork.freedesktop.org/patch/msgid/20200819185654.151170-4-vaibhavgupta40@gmail.com --- include/linux/via-core.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/linux/via-core.h') diff --git a/include/linux/via-core.h b/include/linux/via-core.h index 9e802deedb2d..8737599b9148 100644 --- a/include/linux/via-core.h +++ b/include/linux/via-core.h @@ -47,7 +47,6 @@ struct via_port_cfg { /* * Allow subdevs to register suspend/resume hooks. */ -#ifdef CONFIG_PM struct viafb_pm_hooks { struct list_head list; int (*suspend)(void *private); @@ -57,7 +56,6 @@ struct viafb_pm_hooks { void viafb_pm_register(struct viafb_pm_hooks *hooks); void viafb_pm_unregister(struct viafb_pm_hooks *hooks); -#endif /* CONFIG_PM */ /* * This is the global viafb "device" containing stuff needed by -- cgit v1.2.3