Unverified Commit 10709aa8 authored by Paul Cercueil's avatar Paul Cercueil
Browse files

drm: imx/dcss: Remove #ifdef guards for PM related functions



Use the EXPORT_GPL_DEV_PM_OPS() and pm_ptr() macros to handle the PM
callbacks.

These macros allow the PM functions to be automatically dropped by the
compiler when CONFIG_PM is disabled, without having to use #ifdef
guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
Reviewed-by: default avatarLaurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Tested-by: default avatarLaurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221129191733.137897-11-paul@crapouillou.net
parent 68c8704d
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -249,8 +249,7 @@ void dcss_dev_destroy(struct dcss_dev *dcss)
	kfree(dcss);
}

#ifdef CONFIG_PM_SLEEP
int dcss_dev_suspend(struct device *dev)
static int dcss_dev_suspend(struct device *dev)
{
	struct dcss_dev *dcss = dcss_drv_dev_to_dcss(dev);
	struct drm_device *ddev = dcss_drv_dev_to_drm(dev);
@@ -273,7 +272,7 @@ int dcss_dev_suspend(struct device *dev)
	return 0;
}

int dcss_dev_resume(struct device *dev)
static int dcss_dev_resume(struct device *dev)
{
	struct dcss_dev *dcss = dcss_drv_dev_to_dcss(dev);
	struct drm_device *ddev = dcss_drv_dev_to_drm(dev);
@@ -296,10 +295,8 @@ int dcss_dev_resume(struct device *dev)

	return 0;
}
#endif /* CONFIG_PM_SLEEP */

#ifdef CONFIG_PM
int dcss_dev_runtime_suspend(struct device *dev)
static int dcss_dev_runtime_suspend(struct device *dev)
{
	struct dcss_dev *dcss = dcss_drv_dev_to_dcss(dev);
	int ret;
@@ -313,7 +310,7 @@ int dcss_dev_runtime_suspend(struct device *dev)
	return 0;
}

int dcss_dev_runtime_resume(struct device *dev)
static int dcss_dev_runtime_resume(struct device *dev)
{
	struct dcss_dev *dcss = dcss_drv_dev_to_dcss(dev);

@@ -325,4 +322,8 @@ int dcss_dev_runtime_resume(struct device *dev)

	return 0;
}
#endif /* CONFIG_PM */

EXPORT_GPL_DEV_PM_OPS(dcss_dev_pm_ops) = {
	RUNTIME_PM_OPS(dcss_dev_runtime_suspend, dcss_dev_runtime_resume, NULL)
	SYSTEM_SLEEP_PM_OPS(dcss_dev_suspend, dcss_dev_resume)
};
+3 −4
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#include <drm/drm_fourcc.h>
#include <drm/drm_plane.h>
#include <linux/io.h>
#include <linux/pm.h>
#include <video/videomode.h>

#define SET			0x04
@@ -95,13 +96,11 @@ struct dcss_dev *dcss_drv_dev_to_dcss(struct device *dev);
struct drm_device *dcss_drv_dev_to_drm(struct device *dev);
struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output);
void dcss_dev_destroy(struct dcss_dev *dcss);
int dcss_dev_runtime_suspend(struct device *dev);
int dcss_dev_runtime_resume(struct device *dev);
int dcss_dev_suspend(struct device *dev);
int dcss_dev_resume(struct device *dev);
void dcss_enable_dtg_and_ss(struct dcss_dev *dcss);
void dcss_disable_dtg_and_ss(struct dcss_dev *dcss);

extern const struct dev_pm_ops dcss_dev_pm_ops;

/* BLKCTL */
int dcss_blkctl_init(struct dcss_dev *dcss, unsigned long blkctl_base);
void dcss_blkctl_cfg(struct dcss_blkctl *blkctl);
+1 −7
Original line number Diff line number Diff line
@@ -117,19 +117,13 @@ static const struct of_device_id dcss_of_match[] = {

MODULE_DEVICE_TABLE(of, dcss_of_match);

static const struct dev_pm_ops dcss_dev_pm = {
	SET_SYSTEM_SLEEP_PM_OPS(dcss_dev_suspend, dcss_dev_resume)
	SET_RUNTIME_PM_OPS(dcss_dev_runtime_suspend,
			   dcss_dev_runtime_resume, NULL)
};

static struct platform_driver dcss_platform_driver = {
	.probe	= dcss_drv_platform_probe,
	.remove	= dcss_drv_platform_remove,
	.driver	= {
		.name = "imx-dcss",
		.of_match_table	= dcss_of_match,
		.pm = &dcss_dev_pm,
		.pm = pm_ptr(&dcss_dev_pm_ops),
	},
};