2022-11-29 19:43:54

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH v2 00/26] drm: Get rid of #ifdef CONFIG_PM* guards

Hi,

This patchset updates the DRM drivers to use the new set of PM-related
macros introduced recently.

The point of these macros is to allow the PM functions to be
automatically dropped by the compiler when CONFIG_PM or CONFIG_SUSPEND
is disabled, without having to use #ifdef guards.

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

Checkpatch complains about patch [11/26], as I replaced a
"#if defined(IS_NOT_BROKEN)" to a "if (IS_ENABLED(IS_NOT_BROKEN))".
I don't really know how to make it better so I left it like that.

Compile-tested with allyesconfig, with the following cases:
- CONFIG_PM=y CONFIG_PM_SLEEP=y
- CONFIG_PM=y CONFIG_PM_SLEEP=n
- CONFIG_PM=n

V2:
- Patch [1/26] now adds a macro named
DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() instead of exporting a
dev_pm_ops instance.
- Patches [3/26] to [7/26] are updated accordingly.
- I updated the description of patches [12/26], [20/26] and [23/26].
The code itself did not change.

Note that I can commit to drm-misc-next but not drm-next, so I cannot
apply this patchset myself when it's all properly tagged.

Cheers,
-Paul


Paul Cercueil (26):
drm: modeset-helper: Add DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS macro
drm: bochs: Define and use generic PM ops
drm: imx: Define and use generic PM ops
drm: rockchip: Define and use generic PM ops
drm: tegra: Define and use generic PM ops
drm: sun4i: Define and use generic PM ops
drm: mxsfb: Define and use generic PM ops
drm: atmel-hlcdc: Remove #ifdef guards for PM related functions
drm: exynos: Remove #ifdef guards for PM related functions
drm: imx/dcss: Remove #ifdef guards for PM related functions
drm: bridge/dw-hdmi: Remove #ifdef guards for PM related functions
drm: etnaviv: Remove #ifdef guards for PM related functions
drm: fsl-dcu: Remove #ifdef guards for PM related functions
drm: mediatek: Remove #ifdef guards for PM related functions
drm: omap: Remove #ifdef guards for PM related functions
drm: panfrost: Remove #ifdef guards for PM related functions
drm: rcar-du: Remove #ifdef guards for PM related functions
drm: rockchip: Remove #ifdef guards for PM related functions
drm: shmobile: Remove #ifdef guards for PM related functions
drm: tegra: Remove #ifdef guards for PM related functions
drm: tilcdc: Remove #ifdef guards for PM related functions
drm: vboxvideo: Remove #ifdef guards for PM related functions
drm: vc4: Remove #ifdef guards for PM related functions
drm: gm12u320: Remove #ifdef guards for PM related functions
drm: tidss: Remove #ifdef guards for PM related functions
drm/i915/gt: Remove #ifdef guards for PM related functions

drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 9 ++---
.../drm/bridge/synopsys/dw-hdmi-ahb-audio.c | 17 ++++-----
drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 30 ++++++---------
drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 13 ++-----
drivers/gpu/drm/exynos/exynos7_drm_decon.c | 12 ++----
drivers/gpu/drm/exynos/exynos_dp.c | 11 ++----
drivers/gpu/drm/exynos/exynos_drm_fimc.c | 11 ++----
drivers/gpu/drm/exynos/exynos_drm_fimd.c | 11 ++----
drivers/gpu/drm/exynos/exynos_drm_g2d.c | 10 ++---
drivers/gpu/drm/exynos/exynos_drm_mic.c | 11 ++----
drivers/gpu/drm/exynos/exynos_drm_rotator.c | 12 ++----
drivers/gpu/drm/exynos/exynos_drm_scaler.c | 12 ++----
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 9 ++---
drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c | 8 +---
drivers/gpu/drm/imx/dcss/dcss-dev.c | 17 +++++----
drivers/gpu/drm/imx/dcss/dcss-dev.h | 7 ++--
drivers/gpu/drm/imx/dcss/dcss-drv.c | 8 +---
drivers/gpu/drm/imx/imx-drm-core.c | 23 ++---------
drivers/gpu/drm/mediatek/mtk_dp.c | 6 +--
drivers/gpu/drm/mediatek/mtk_hdmi.c | 9 ++---
drivers/gpu/drm/mxsfb/mxsfb_drv.c | 22 +----------
drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 6 +--
drivers/gpu/drm/omapdrm/omap_drv.c | 7 ++--
drivers/gpu/drm/omapdrm/omap_gem.c | 5 ++-
drivers/gpu/drm/omapdrm/omap_gem.h | 2 -
drivers/gpu/drm/panfrost/panfrost_device.c | 10 +++--
drivers/gpu/drm/panfrost/panfrost_device.h | 4 +-
drivers/gpu/drm/panfrost/panfrost_drv.c | 7 +---
drivers/gpu/drm/rcar-du/rcar_du_drv.c | 9 ++---
.../gpu/drm/rockchip/analogix_dp-rockchip.c | 6 +--
drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 25 ++----------
drivers/gpu/drm/shmobile/shmob_drm_drv.c | 9 ++---
drivers/gpu/drm/sun4i/sun4i_drv.c | 26 ++-----------
drivers/gpu/drm/tegra/dpaux.c | 6 +--
drivers/gpu/drm/tegra/drm.c | 23 ++---------
drivers/gpu/drm/tidss/tidss_drv.c | 29 +++++++-------
drivers/gpu/drm/tilcdc/tilcdc_drv.c | 9 ++---
drivers/gpu/drm/tiny/bochs.c | 29 ++------------
drivers/gpu/drm/tiny/gm12u320.c | 15 ++++----
drivers/gpu/drm/vboxvideo/vbox_drv.c | 6 +--
drivers/gpu/drm/vc4/vc4_v3d.c | 6 +--
include/drm/drm_modeset_helper.h | 38 +++++++++++++++++++
42 files changed, 184 insertions(+), 361 deletions(-)

--
2.35.1


2022-11-29 19:45:01

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH v2 03/26] drm: imx: Define and use generic PM ops

Use the new DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro to create a
"struct dev_pm_ops" that can be used by this driver, instead of using
custom PM callbacks with the same behaviour.

v2: Use the DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro instead of an
exported dev_pm_ops.

Signed-off-by: Paul Cercueil <[email protected]>
---
Cc: Philipp Zabel <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: NXP Linux Team <[email protected]>
Cc: [email protected]
---
drivers/gpu/drm/imx/imx-drm-core.c | 23 ++++-------------------
1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index e060fa6cbcb9..1992934034e0 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -10,6 +10,7 @@
#include <linux/dma-buf.h>
#include <linux/module.h>
#include <linux/platform_device.h>
+#include <linux/pm.h>

#include <video/imx-ipu-v3.h>

@@ -298,36 +299,20 @@ static int imx_drm_platform_remove(struct platform_device *pdev)
return 0;
}

-#ifdef CONFIG_PM_SLEEP
-static int imx_drm_suspend(struct device *dev)
-{
- struct drm_device *drm_dev = dev_get_drvdata(dev);
-
- return drm_mode_config_helper_suspend(drm_dev);
-}
-
-static int imx_drm_resume(struct device *dev)
-{
- struct drm_device *drm_dev = dev_get_drvdata(dev);
-
- return drm_mode_config_helper_resume(drm_dev);
-}
-#endif
-
-static SIMPLE_DEV_PM_OPS(imx_drm_pm_ops, imx_drm_suspend, imx_drm_resume);
-
static const struct of_device_id imx_drm_dt_ids[] = {
{ .compatible = "fsl,imx-display-subsystem", },
{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, imx_drm_dt_ids);

+DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS(imx_pm_ops);
+
static struct platform_driver imx_drm_pdrv = {
.probe = imx_drm_platform_probe,
.remove = imx_drm_platform_remove,
.driver = {
.name = "imx-drm",
- .pm = &imx_drm_pm_ops,
+ .pm = pm_sleep_ptr(&imx_pm_ops),
.of_match_table = imx_drm_dt_ids,
},
};
--
2.35.1

2022-11-29 19:45:40

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH v2 13/26] drm: fsl-dcu: Remove #ifdef guards for PM related functions

Use the DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle
the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND 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: Paul Cercueil <[email protected]>
---
Cc: Stefan Agner <[email protected]>
Cc: Alison Wang <[email protected]>
---
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index 8579c7629f5e..474ad45c73be 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -164,7 +164,6 @@ static const struct drm_driver fsl_dcu_drm_driver = {
.minor = 1,
};

-#ifdef CONFIG_PM_SLEEP
static int fsl_dcu_drm_pm_suspend(struct device *dev)
{
struct fsl_dcu_drm_device *fsl_dev = dev_get_drvdata(dev);
@@ -209,11 +208,9 @@ static int fsl_dcu_drm_pm_resume(struct device *dev)

return 0;
}
-#endif

-static const struct dev_pm_ops fsl_dcu_drm_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(fsl_dcu_drm_pm_suspend, fsl_dcu_drm_pm_resume)
-};
+static DEFINE_SIMPLE_DEV_PM_OPS(fsl_dcu_drm_pm_ops,
+ fsl_dcu_drm_pm_suspend, fsl_dcu_drm_pm_resume);

static const struct fsl_dcu_soc_data fsl_dcu_ls1021a_data = {
.name = "ls1021a",
@@ -363,7 +360,7 @@ static struct platform_driver fsl_dcu_drm_platform_driver = {
.remove = fsl_dcu_drm_remove,
.driver = {
.name = "fsl-dcu",
- .pm = &fsl_dcu_drm_pm_ops,
+ .pm = pm_sleep_ptr(&fsl_dcu_drm_pm_ops),
.of_match_table = fsl_dcu_of_match,
},
};
--
2.35.1

2022-11-29 19:45:52

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH v2 04/26] drm: rockchip: Define and use generic PM ops

Use the new DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro to create a
"struct dev_pm_ops" that can be used by this driver, instead of using
custom PM callbacks with the same behaviour.

v2: Use the DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro instead of an
exported dev_pm_ops.

Signed-off-by: Paul Cercueil <[email protected]>
---
Cc: Sandy Huang <[email protected]>
Cc: "Heiko Stübner" <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 25 +++------------------
1 file changed, 3 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index 6e0788d14c10..ec117c52cb24 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -236,27 +236,6 @@ static const struct drm_driver rockchip_drm_driver = {
.minor = DRIVER_MINOR,
};

-#ifdef CONFIG_PM_SLEEP
-static int rockchip_drm_sys_suspend(struct device *dev)
-{
- struct drm_device *drm = dev_get_drvdata(dev);
-
- return drm_mode_config_helper_suspend(drm);
-}
-
-static int rockchip_drm_sys_resume(struct device *dev)
-{
- struct drm_device *drm = dev_get_drvdata(dev);
-
- return drm_mode_config_helper_resume(drm);
-}
-#endif
-
-static const struct dev_pm_ops rockchip_drm_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(rockchip_drm_sys_suspend,
- rockchip_drm_sys_resume)
-};
-
#define MAX_ROCKCHIP_SUB_DRIVERS 16
static struct platform_driver *rockchip_sub_drivers[MAX_ROCKCHIP_SUB_DRIVERS];
static int num_rockchip_sub_drivers;
@@ -473,6 +452,8 @@ static const struct of_device_id rockchip_drm_dt_ids[] = {
};
MODULE_DEVICE_TABLE(of, rockchip_drm_dt_ids);

+DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS(rockchip_pm_ops);
+
static struct platform_driver rockchip_drm_platform_driver = {
.probe = rockchip_drm_platform_probe,
.remove = rockchip_drm_platform_remove,
@@ -480,7 +461,7 @@ static struct platform_driver rockchip_drm_platform_driver = {
.driver = {
.name = "rockchip-drm",
.of_match_table = rockchip_drm_dt_ids,
- .pm = &rockchip_drm_pm_ops,
+ .pm = pm_sleep_ptr(&rockchip_pm_ops),
},
};

--
2.35.1

2022-11-29 19:46:58

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH v2 05/26] drm: tegra: Define and use generic PM ops

Use the new DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro to create a
"struct dev_pm_ops" that can be used by this driver, instead of using
custom PM callbacks with the same behaviour.

v2: Use the DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro instead of an
exported dev_pm_ops.

Signed-off-by: Paul Cercueil <[email protected]>
---
Cc: Thierry Reding <[email protected]>
Cc: Jonathan Hunter <[email protected]>
Cc: [email protected]
---
drivers/gpu/drm/tegra/drm.c | 23 +++--------------------
1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index a1f909dac89a..c844444ff522 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -1329,25 +1329,6 @@ static int host1x_drm_remove(struct host1x_device *dev)
return 0;
}

-#ifdef CONFIG_PM_SLEEP
-static int host1x_drm_suspend(struct device *dev)
-{
- struct drm_device *drm = dev_get_drvdata(dev);
-
- return drm_mode_config_helper_suspend(drm);
-}
-
-static int host1x_drm_resume(struct device *dev)
-{
- struct drm_device *drm = dev_get_drvdata(dev);
-
- return drm_mode_config_helper_resume(drm);
-}
-#endif
-
-static SIMPLE_DEV_PM_OPS(host1x_drm_pm_ops, host1x_drm_suspend,
- host1x_drm_resume);
-
static const struct of_device_id host1x_drm_subdevs[] = {
{ .compatible = "nvidia,tegra20-dc", },
{ .compatible = "nvidia,tegra20-hdmi", },
@@ -1389,10 +1370,12 @@ static const struct of_device_id host1x_drm_subdevs[] = {
{ /* sentinel */ }
};

+DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS(tegra_pm_ops);
+
static struct host1x_driver host1x_drm_driver = {
.driver = {
.name = "drm",
- .pm = &host1x_drm_pm_ops,
+ .pm = pm_sleep_ptr(&tegra_pm_ops),
},
.probe = host1x_drm_probe,
.remove = host1x_drm_remove,
--
2.35.1

2022-11-29 19:47:56

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH v2 09/26] drm: exynos: Remove #ifdef guards for PM related functions

Use the DEFINE_RUNTIME_DEV_PM_OPS(), SYSTEM_SLEEP_PM_OPS(),
RUNTIME_PM_OPS() and pm_ptr() macros to handle the runtime and suspend
PM callbacks.

These macros allow the suspend and resume 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: Paul Cercueil <[email protected]>
Acked-by : Inki Dae <[email protected]>
---
Cc: Inki Dae <[email protected]>
Cc: Seung-Woo Kim <[email protected]>
Cc: Kyungmin Park <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Alim Akhtar <[email protected]>
Cc: Jingoo Han <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 13 ++++---------
drivers/gpu/drm/exynos/exynos7_drm_decon.c | 12 +++---------
drivers/gpu/drm/exynos/exynos_dp.c | 11 +++--------
drivers/gpu/drm/exynos/exynos_drm_fimc.c | 11 +++--------
drivers/gpu/drm/exynos/exynos_drm_fimd.c | 11 +++--------
drivers/gpu/drm/exynos/exynos_drm_g2d.c | 10 +++-------
drivers/gpu/drm/exynos/exynos_drm_mic.c | 11 +++--------
drivers/gpu/drm/exynos/exynos_drm_rotator.c | 12 +++---------
drivers/gpu/drm/exynos/exynos_drm_scaler.c | 12 +++---------
9 files changed, 28 insertions(+), 75 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 8155d7e650f1..2867b39fa35e 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -710,7 +710,6 @@ static irqreturn_t decon_irq_handler(int irq, void *dev_id)
return IRQ_HANDLED;
}

-#ifdef CONFIG_PM
static int exynos5433_decon_suspend(struct device *dev)
{
struct decon_context *ctx = dev_get_drvdata(dev);
@@ -741,14 +740,10 @@ static int exynos5433_decon_resume(struct device *dev)

return ret;
}
-#endif

-static const struct dev_pm_ops exynos5433_decon_pm_ops = {
- SET_RUNTIME_PM_OPS(exynos5433_decon_suspend, exynos5433_decon_resume,
- NULL)
- SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
- pm_runtime_force_resume)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(exynos5433_decon_pm_ops,
+ exynos5433_decon_suspend,
+ exynos5433_decon_resume, NULL);

static const struct of_device_id exynos5433_decon_driver_dt_match[] = {
{
@@ -881,7 +876,7 @@ struct platform_driver exynos5433_decon_driver = {
.remove = exynos5433_decon_remove,
.driver = {
.name = "exynos5433-decon",
- .pm = &exynos5433_decon_pm_ops,
+ .pm = pm_ptr(&exynos5433_decon_pm_ops),
.of_match_table = exynos5433_decon_driver_dt_match,
},
};
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 7080cf7952ec..3126f735dedc 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -779,7 +779,6 @@ static int decon_remove(struct platform_device *pdev)
return 0;
}

-#ifdef CONFIG_PM
static int exynos7_decon_suspend(struct device *dev)
{
struct decon_context *ctx = dev_get_drvdata(dev);
@@ -836,21 +835,16 @@ static int exynos7_decon_resume(struct device *dev)
err_pclk_enable:
return ret;
}
-#endif

-static const struct dev_pm_ops exynos7_decon_pm_ops = {
- SET_RUNTIME_PM_OPS(exynos7_decon_suspend, exynos7_decon_resume,
- NULL)
- SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
- pm_runtime_force_resume)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(exynos7_decon_pm_ops, exynos7_decon_suspend,
+ exynos7_decon_resume, NULL);

struct platform_driver decon_driver = {
.probe = decon_probe,
.remove = decon_remove,
.driver = {
.name = "exynos-decon",
- .pm = &exynos7_decon_pm_ops,
+ .pm = pm_ptr(&exynos7_decon_pm_ops),
.of_match_table = decon_driver_dt_match,
},
};
diff --git a/drivers/gpu/drm/exynos/exynos_dp.c b/drivers/gpu/drm/exynos/exynos_dp.c
index 4e3d3d5f6866..3404ec1367fb 100644
--- a/drivers/gpu/drm/exynos/exynos_dp.c
+++ b/drivers/gpu/drm/exynos/exynos_dp.c
@@ -260,7 +260,6 @@ static int exynos_dp_remove(struct platform_device *pdev)
return 0;
}

-#ifdef CONFIG_PM
static int exynos_dp_suspend(struct device *dev)
{
struct exynos_dp_device *dp = dev_get_drvdata(dev);
@@ -274,13 +273,9 @@ static int exynos_dp_resume(struct device *dev)

return analogix_dp_resume(dp->adp);
}
-#endif

-static const struct dev_pm_ops exynos_dp_pm_ops = {
- SET_RUNTIME_PM_OPS(exynos_dp_suspend, exynos_dp_resume, NULL)
- SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
- pm_runtime_force_resume)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(exynos_dp_pm_ops, exynos_dp_suspend,
+ exynos_dp_resume, NULL);

static const struct of_device_id exynos_dp_match[] = {
{ .compatible = "samsung,exynos5-dp" },
@@ -294,7 +289,7 @@ struct platform_driver dp_driver = {
.driver = {
.name = "exynos-dp",
.owner = THIS_MODULE,
- .pm = &exynos_dp_pm_ops,
+ .pm = pm_ptr(&exynos_dp_pm_ops),
.of_match_table = exynos_dp_match,
},
};
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
index 0ee32e4b1e43..8de2714599fc 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
@@ -1381,7 +1381,6 @@ static int fimc_remove(struct platform_device *pdev)
return 0;
}

-#ifdef CONFIG_PM
static int fimc_runtime_suspend(struct device *dev)
{
struct fimc_context *ctx = get_fimc_context(dev);
@@ -1398,13 +1397,9 @@ static int fimc_runtime_resume(struct device *dev)
DRM_DEV_DEBUG_KMS(dev, "id[%d]\n", ctx->id);
return clk_prepare_enable(ctx->clocks[FIMC_CLK_GATE]);
}
-#endif

-static const struct dev_pm_ops fimc_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
- pm_runtime_force_resume)
- SET_RUNTIME_PM_OPS(fimc_runtime_suspend, fimc_runtime_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(fimc_pm_ops, fimc_runtime_suspend,
+ fimc_runtime_resume, NULL);

static const struct of_device_id fimc_of_match[] = {
{ .compatible = "samsung,exynos4210-fimc" },
@@ -1420,6 +1415,6 @@ struct platform_driver fimc_driver = {
.of_match_table = fimc_of_match,
.name = "exynos-drm-fimc",
.owner = THIS_MODULE,
- .pm = &fimc_pm_ops,
+ .pm = pm_ptr(&fimc_pm_ops),
},
};
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index ae6636e6658e..7f4a0be03dd1 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -1287,7 +1287,6 @@ static int fimd_remove(struct platform_device *pdev)
return 0;
}

-#ifdef CONFIG_PM
static int exynos_fimd_suspend(struct device *dev)
{
struct fimd_context *ctx = dev_get_drvdata(dev);
@@ -1321,13 +1320,9 @@ static int exynos_fimd_resume(struct device *dev)

return 0;
}
-#endif

-static const struct dev_pm_ops exynos_fimd_pm_ops = {
- SET_RUNTIME_PM_OPS(exynos_fimd_suspend, exynos_fimd_resume, NULL)
- SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
- pm_runtime_force_resume)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(exynos_fimd_pm_ops, exynos_fimd_suspend,
+ exynos_fimd_resume, NULL);

struct platform_driver fimd_driver = {
.probe = fimd_probe,
@@ -1335,7 +1330,7 @@ struct platform_driver fimd_driver = {
.driver = {
.name = "exynos4-fb",
.owner = THIS_MODULE,
- .pm = &exynos_fimd_pm_ops,
+ .pm = pm_ptr(&exynos_fimd_pm_ops),
.of_match_table = fimd_driver_dt_match,
},
};
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
index 471fd6c8135f..7711cb67b807 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
@@ -1549,7 +1549,6 @@ static int g2d_remove(struct platform_device *pdev)
return 0;
}

-#ifdef CONFIG_PM_SLEEP
static int g2d_suspend(struct device *dev)
{
struct g2d_data *g2d = dev_get_drvdata(dev);
@@ -1574,9 +1573,7 @@ static int g2d_resume(struct device *dev)

return 0;
}
-#endif

-#ifdef CONFIG_PM
static int g2d_runtime_suspend(struct device *dev)
{
struct g2d_data *g2d = dev_get_drvdata(dev);
@@ -1597,11 +1594,10 @@ static int g2d_runtime_resume(struct device *dev)

return ret;
}
-#endif

static const struct dev_pm_ops g2d_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(g2d_suspend, g2d_resume)
- SET_RUNTIME_PM_OPS(g2d_runtime_suspend, g2d_runtime_resume, NULL)
+ SYSTEM_SLEEP_PM_OPS(g2d_suspend, g2d_resume)
+ RUNTIME_PM_OPS(g2d_runtime_suspend, g2d_runtime_resume, NULL)
};

static const struct of_device_id exynos_g2d_match[] = {
@@ -1617,7 +1613,7 @@ struct platform_driver g2d_driver = {
.driver = {
.name = "exynos-drm-g2d",
.owner = THIS_MODULE,
- .pm = &g2d_pm_ops,
+ .pm = pm_ptr(&g2d_pm_ops),
.of_match_table = exynos_g2d_match,
},
};
diff --git a/drivers/gpu/drm/exynos/exynos_drm_mic.c b/drivers/gpu/drm/exynos/exynos_drm_mic.c
index 09ce28ee08d9..17bab5b1663f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_mic.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_mic.c
@@ -340,7 +340,6 @@ static const struct component_ops exynos_mic_component_ops = {
.unbind = exynos_mic_unbind,
};

-#ifdef CONFIG_PM
static int exynos_mic_suspend(struct device *dev)
{
struct exynos_mic *mic = dev_get_drvdata(dev);
@@ -369,13 +368,9 @@ static int exynos_mic_resume(struct device *dev)
}
return 0;
}
-#endif

-static const struct dev_pm_ops exynos_mic_pm_ops = {
- SET_RUNTIME_PM_OPS(exynos_mic_suspend, exynos_mic_resume, NULL)
- SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
- pm_runtime_force_resume)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(exynos_mic_pm_ops, exynos_mic_suspend,
+ exynos_mic_resume, NULL);

static int exynos_mic_probe(struct platform_device *pdev)
{
@@ -470,7 +465,7 @@ struct platform_driver mic_driver = {
.remove = exynos_mic_remove,
.driver = {
.name = "exynos-mic",
- .pm = &exynos_mic_pm_ops,
+ .pm = pm_ptr(&exynos_mic_pm_ops),
.owner = THIS_MODULE,
.of_match_table = exynos_mic_of_match,
},
diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
index dec7df35baa9..8706f377c349 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
@@ -340,7 +340,6 @@ static int rotator_remove(struct platform_device *pdev)
return 0;
}

-#ifdef CONFIG_PM
static int rotator_runtime_suspend(struct device *dev)
{
struct rot_context *rot = dev_get_drvdata(dev);
@@ -355,7 +354,6 @@ static int rotator_runtime_resume(struct device *dev)

return clk_prepare_enable(rot->clock);
}
-#endif

static const struct drm_exynos_ipp_limit rotator_s5pv210_rbg888_limits[] = {
{ IPP_SIZE_LIMIT(BUFFER, .h = { 8, SZ_16K }, .v = { 8, SZ_16K }) },
@@ -450,12 +448,8 @@ static const struct of_device_id exynos_rotator_match[] = {
};
MODULE_DEVICE_TABLE(of, exynos_rotator_match);

-static const struct dev_pm_ops rotator_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
- pm_runtime_force_resume)
- SET_RUNTIME_PM_OPS(rotator_runtime_suspend, rotator_runtime_resume,
- NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(rotator_pm_ops, rotator_runtime_suspend,
+ rotator_runtime_resume, NULL);

struct platform_driver rotator_driver = {
.probe = rotator_probe,
@@ -463,7 +457,7 @@ struct platform_driver rotator_driver = {
.driver = {
.name = "exynos-rotator",
.owner = THIS_MODULE,
- .pm = &rotator_pm_ops,
+ .pm = pm_ptr(&rotator_pm_ops),
.of_match_table = exynos_rotator_match,
},
};
diff --git a/drivers/gpu/drm/exynos/exynos_drm_scaler.c b/drivers/gpu/drm/exynos/exynos_drm_scaler.c
index 3c049fb658a3..20608e9780ce 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_scaler.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_scaler.c
@@ -550,8 +550,6 @@ static int scaler_remove(struct platform_device *pdev)
return 0;
}

-#ifdef CONFIG_PM
-
static int clk_disable_unprepare_wrapper(struct clk *clk)
{
clk_disable_unprepare(clk);
@@ -584,13 +582,9 @@ static int scaler_runtime_resume(struct device *dev)

return scaler_clk_ctrl(scaler, true);
}
-#endif

-static const struct dev_pm_ops scaler_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
- pm_runtime_force_resume)
- SET_RUNTIME_PM_OPS(scaler_runtime_suspend, scaler_runtime_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(scaler_pm_ops, scaler_runtime_suspend,
+ scaler_runtime_resume, NULL);

static const struct drm_exynos_ipp_limit scaler_5420_two_pixel_hv_limits[] = {
{ IPP_SIZE_LIMIT(BUFFER, .h = { 16, SZ_8K }, .v = { 16, SZ_8K }) },
@@ -731,7 +725,7 @@ struct platform_driver scaler_driver = {
.driver = {
.name = "exynos-scaler",
.owner = THIS_MODULE,
- .pm = &scaler_pm_ops,
+ .pm = pm_ptr(&scaler_pm_ops),
.of_match_table = exynos_scaler_match,
},
};
--
2.35.1

2022-11-29 20:15:42

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH v2 11/26] drm: bridge/dw-hdmi: Remove #ifdef guards for PM related functions

Use the DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle
the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND 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.

The #ifdef IS_NOT_BROKEN guard was also changed to a
IS_ENABLED(IS_NOT_BROKEN) check within the PM functions.

Signed-off-by: Paul Cercueil <[email protected]>
---
Note:
Checkpatch complains as I replaced a "#if defined(IS_NOT_BROKEN)"
to a "if (IS_ENABLED(IS_NOT_BROKEN))".
I don't really know how to make it better so I left it like that.

Cc: Andrzej Hajda <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Robert Foss <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Jernej Skrabec <[email protected]>
---
.../gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c
index 4efb62bcdb63..2ae231af7e4b 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c
@@ -593,7 +593,6 @@ static int snd_dw_hdmi_remove(struct platform_device *pdev)
return 0;
}

-#if defined(CONFIG_PM_SLEEP) && defined(IS_NOT_BROKEN)
/*
* This code is fine, but requires implementation in the dw_hdmi_trigger()
* method which is currently missing as I have no way to test this.
@@ -602,7 +601,8 @@ static int snd_dw_hdmi_suspend(struct device *dev)
{
struct snd_dw_hdmi *dw = dev_get_drvdata(dev);

- snd_power_change_state(dw->card, SNDRV_CTL_POWER_D3cold);
+ if (IS_ENABLED(IS_NOT_BROKEN))
+ snd_power_change_state(dw->card, SNDRV_CTL_POWER_D3cold);

return 0;
}
@@ -611,24 +611,21 @@ static int snd_dw_hdmi_resume(struct device *dev)
{
struct snd_dw_hdmi *dw = dev_get_drvdata(dev);

- snd_power_change_state(dw->card, SNDRV_CTL_POWER_D0);
+ if (IS_ENABLED(IS_NOT_BROKEN))
+ snd_power_change_state(dw->card, SNDRV_CTL_POWER_D0);

return 0;
}

-static SIMPLE_DEV_PM_OPS(snd_dw_hdmi_pm, snd_dw_hdmi_suspend,
- snd_dw_hdmi_resume);
-#define PM_OPS &snd_dw_hdmi_pm
-#else
-#define PM_OPS NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(snd_dw_hdmi_pm_ops, snd_dw_hdmi_suspend,
+ snd_dw_hdmi_resume);

static struct platform_driver snd_dw_hdmi_driver = {
.probe = snd_dw_hdmi_probe,
.remove = snd_dw_hdmi_remove,
.driver = {
.name = DRIVER_NAME,
- .pm = PM_OPS,
+ .pm = pm_sleep_ptr(&snd_dw_hdmi_pm_ops),
},
};

--
2.35.1

2022-11-29 20:16:23

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH v2 06/26] drm: sun4i: Define and use generic PM ops

Use the new DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro to create a
"struct dev_pm_ops" that can be used by this driver, instead of using
custom PM callbacks with the same behaviour.

v2: Use the DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro instead of an
exported dev_pm_ops.

Signed-off-by: Paul Cercueil <[email protected]>
---

Samuel: since the code changed I had to remove your reviewed-by, sorry
about that.

Cc: Maxime Ripard <[email protected]>
Cc: Chen-Yu Tsai <[email protected]>
Cc: Jernej Skrabec <[email protected]>
Cc: Samuel Holland <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/gpu/drm/sun4i/sun4i_drv.c | 26 ++++----------------------
1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index cc94efbbf2d4..178ada09b467 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -13,6 +13,7 @@
#include <linux/of_graph.h>
#include <linux/of_reserved_mem.h>
#include <linux/platform_device.h>
+#include <linux/pm.h>

#include <drm/drm_aperture.h>
#include <drm/drm_atomic_helper.h>
@@ -339,27 +340,6 @@ static int sun4i_drv_add_endpoints(struct device *dev,
return count;
}

-#ifdef CONFIG_PM_SLEEP
-static int sun4i_drv_drm_sys_suspend(struct device *dev)
-{
- struct drm_device *drm = dev_get_drvdata(dev);
-
- return drm_mode_config_helper_suspend(drm);
-}
-
-static int sun4i_drv_drm_sys_resume(struct device *dev)
-{
- struct drm_device *drm = dev_get_drvdata(dev);
-
- return drm_mode_config_helper_resume(drm);
-}
-#endif
-
-static const struct dev_pm_ops sun4i_drv_drm_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(sun4i_drv_drm_sys_suspend,
- sun4i_drv_drm_sys_resume)
-};
-
static int sun4i_drv_probe(struct platform_device *pdev)
{
struct component_match *match = NULL;
@@ -434,13 +414,15 @@ static const struct of_device_id sun4i_drv_of_table[] = {
};
MODULE_DEVICE_TABLE(of, sun4i_drv_of_table);

+DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS(sun4i_pm_ops);
+
static struct platform_driver sun4i_drv_platform_driver = {
.probe = sun4i_drv_probe,
.remove = sun4i_drv_remove,
.driver = {
.name = "sun4i-drm",
.of_match_table = sun4i_drv_of_table,
- .pm = &sun4i_drv_drm_pm_ops,
+ .pm = pm_sleep_ptr(&sun4i_pm_ops),
},
};
drm_module_platform_driver(sun4i_drv_platform_driver);
--
2.35.1

2022-11-29 20:16:28

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH v2 10/26] 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: Paul Cercueil <[email protected]>
Reviewed-by: Laurentiu Palcu <[email protected]>
Tested-by: Laurentiu Palcu <[email protected]>
---
Cc: Laurentiu Palcu <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: Philipp Zabel <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: NXP Linux Team <[email protected]>
Cc: [email protected]
---
drivers/gpu/drm/imx/dcss/dcss-dev.c | 17 +++++++++--------
drivers/gpu/drm/imx/dcss/dcss-dev.h | 7 +++----
drivers/gpu/drm/imx/dcss/dcss-drv.c | 8 +-------
3 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/imx/dcss/dcss-dev.c b/drivers/gpu/drm/imx/dcss/dcss-dev.c
index 3f5750cc2673..66d9233ffb98 100644
--- a/drivers/gpu/drm/imx/dcss/dcss-dev.c
+++ b/drivers/gpu/drm/imx/dcss/dcss-dev.c
@@ -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)
+};
diff --git a/drivers/gpu/drm/imx/dcss/dcss-dev.h b/drivers/gpu/drm/imx/dcss/dcss-dev.h
index 1e582270c6ea..f27b87c09599 100644
--- a/drivers/gpu/drm/imx/dcss/dcss-dev.h
+++ b/drivers/gpu/drm/imx/dcss/dcss-dev.h
@@ -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);
diff --git a/drivers/gpu/drm/imx/dcss/dcss-drv.c b/drivers/gpu/drm/imx/dcss/dcss-drv.c
index 1c70f70247f6..431510bd811b 100644
--- a/drivers/gpu/drm/imx/dcss/dcss-drv.c
+++ b/drivers/gpu/drm/imx/dcss/dcss-drv.c
@@ -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),
},
};

--
2.35.1

2022-11-29 20:17:11

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH v2 12/26] drm: etnaviv: Remove #ifdef guards for PM related functions

Use the RUNTIME_PM_OPS() and pm_ptr() macros to handle the
.runtime_suspend/.runtime_resume callbacks.

These macros allow the suspend and resume 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.

Some #ifdef CONFIG_PM guards were protecting simple statements, and were
also converted to "if (IS_ENABLED(CONFIG_PM))".

Signed-off-by: Paul Cercueil <[email protected]>
---
Cc: Lucas Stach <[email protected]>
Cc: Russell King <[email protected]>
Cc: Christian Gmeiner <[email protected]>
Cc: [email protected]
---
drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 30 +++++++++++----------------
1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 51320eeebfcf..310382812029 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -1629,7 +1629,6 @@ static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu)
return etnaviv_gpu_clk_disable(gpu);
}

-#ifdef CONFIG_PM
static int etnaviv_gpu_hw_resume(struct etnaviv_gpu *gpu)
{
int ret;
@@ -1645,7 +1644,6 @@ static int etnaviv_gpu_hw_resume(struct etnaviv_gpu *gpu)

return 0;
}
-#endif

static int
etnaviv_gpu_cooling_get_max_state(struct thermal_cooling_device *cdev,
@@ -1713,11 +1711,10 @@ static int etnaviv_gpu_bind(struct device *dev, struct device *master,
if (ret)
goto out_workqueue;

-#ifdef CONFIG_PM
- ret = pm_runtime_get_sync(gpu->dev);
-#else
- ret = etnaviv_gpu_clk_enable(gpu);
-#endif
+ if (IS_ENABLED(CONFIG_PM))
+ ret = pm_runtime_get_sync(gpu->dev);
+ else
+ ret = etnaviv_gpu_clk_enable(gpu);
if (ret < 0)
goto out_sched;

@@ -1761,12 +1758,12 @@ static void etnaviv_gpu_unbind(struct device *dev, struct device *master,

etnaviv_sched_fini(gpu);

-#ifdef CONFIG_PM
- pm_runtime_get_sync(gpu->dev);
- pm_runtime_put_sync_suspend(gpu->dev);
-#else
- etnaviv_gpu_hw_suspend(gpu);
-#endif
+ if (IS_ENABLED(CONFIG_PM)) {
+ pm_runtime_get_sync(gpu->dev);
+ pm_runtime_put_sync_suspend(gpu->dev);
+ } else {
+ etnaviv_gpu_hw_suspend(gpu);
+ }

if (gpu->mmu_context)
etnaviv_iommu_context_put(gpu->mmu_context);
@@ -1880,7 +1877,6 @@ static int etnaviv_gpu_platform_remove(struct platform_device *pdev)
return 0;
}

-#ifdef CONFIG_PM
static int etnaviv_gpu_rpm_suspend(struct device *dev)
{
struct etnaviv_gpu *gpu = dev_get_drvdata(dev);
@@ -1923,18 +1919,16 @@ static int etnaviv_gpu_rpm_resume(struct device *dev)

return 0;
}
-#endif

static const struct dev_pm_ops etnaviv_gpu_pm_ops = {
- SET_RUNTIME_PM_OPS(etnaviv_gpu_rpm_suspend, etnaviv_gpu_rpm_resume,
- NULL)
+ RUNTIME_PM_OPS(etnaviv_gpu_rpm_suspend, etnaviv_gpu_rpm_resume, NULL)
};

struct platform_driver etnaviv_gpu_driver = {
.driver = {
.name = "etnaviv-gpu",
.owner = THIS_MODULE,
- .pm = &etnaviv_gpu_pm_ops,
+ .pm = pm_ptr(&etnaviv_gpu_pm_ops),
.of_match_table = etnaviv_gpu_match,
},
.probe = etnaviv_gpu_platform_probe,
--
2.35.1

2022-11-29 20:17:20

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH v2 02/26] drm: bochs: Define and use generic PM ops

Use the new DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro to create a
"struct dev_pm_ops" that can be used by this driver, instead of using
custom PM callbacks with the same behaviour.

v2: Use the DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro instead of an
exported dev_pm_ops.

Signed-off-by: Paul Cercueil <[email protected]>
---
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]
---
drivers/gpu/drm/tiny/bochs.c | 29 ++++-------------------------
1 file changed, 4 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c
index 024346054c70..598488905607 100644
--- a/drivers/gpu/drm/tiny/bochs.c
+++ b/drivers/gpu/drm/tiny/bochs.c
@@ -2,6 +2,7 @@

#include <linux/module.h>
#include <linux/pci.h>
+#include <linux/pm.h>

#include <drm/drm_aperture.h>
#include <drm/drm_atomic_helper.h>
@@ -610,30 +611,6 @@ static const struct drm_driver bochs_driver = {
DRM_GEM_VRAM_DRIVER,
};

-/* ---------------------------------------------------------------------- */
-/* pm interface */
-
-#ifdef CONFIG_PM_SLEEP
-static int bochs_pm_suspend(struct device *dev)
-{
- struct drm_device *drm_dev = dev_get_drvdata(dev);
-
- return drm_mode_config_helper_suspend(drm_dev);
-}
-
-static int bochs_pm_resume(struct device *dev)
-{
- struct drm_device *drm_dev = dev_get_drvdata(dev);
-
- return drm_mode_config_helper_resume(drm_dev);
-}
-#endif
-
-static const struct dev_pm_ops bochs_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(bochs_pm_suspend,
- bochs_pm_resume)
-};
-
/* ---------------------------------------------------------------------- */
/* pci interface */

@@ -716,12 +693,14 @@ static const struct pci_device_id bochs_pci_tbl[] = {
{ /* end of list */ }
};

+DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS(bochs_pm_ops);
+
static struct pci_driver bochs_pci_driver = {
.name = "bochs-drm",
.id_table = bochs_pci_tbl,
.probe = bochs_pci_probe,
.remove = bochs_pci_remove,
- .driver.pm = &bochs_pm_ops,
+ .driver.pm = pm_sleep_ptr(&bochs_pm_ops),
};

/* ---------------------------------------------------------------------- */
--
2.35.1

2022-11-29 20:18:17

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH v2 14/26] drm: mediatek: Remove #ifdef guards for PM related functions

Use the DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle
the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND 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: Paul Cercueil <[email protected]>
---
Cc: Chun-Kuang Hu <[email protected]>
Cc: Philipp Zabel <[email protected]>
Cc: Matthias Brugger <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/gpu/drm/mediatek/mtk_dp.c | 6 ++----
drivers/gpu/drm/mediatek/mtk_hdmi.c | 9 ++++-----
2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c
index 9d085c05c49c..00861a914855 100644
--- a/drivers/gpu/drm/mediatek/mtk_dp.c
+++ b/drivers/gpu/drm/mediatek/mtk_dp.c
@@ -2590,7 +2590,6 @@ static int mtk_dp_remove(struct platform_device *pdev)
return 0;
}

-#ifdef CONFIG_PM_SLEEP
static int mtk_dp_suspend(struct device *dev)
{
struct mtk_dp *mtk_dp = dev_get_drvdata(dev);
@@ -2613,9 +2612,8 @@ static int mtk_dp_resume(struct device *dev)

return 0;
}
-#endif

-static SIMPLE_DEV_PM_OPS(mtk_dp_pm_ops, mtk_dp_suspend, mtk_dp_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(mtk_dp_pm_ops, mtk_dp_suspend, mtk_dp_resume);

static const struct mtk_dp_data mt8195_edp_data = {
.bridge_type = DRM_MODE_CONNECTOR_eDP,
@@ -2650,7 +2648,7 @@ static struct platform_driver mtk_dp_driver = {
.driver = {
.name = "mediatek-drm-dp",
.of_match_table = mtk_dp_of_match,
- .pm = &mtk_dp_pm_ops,
+ .pm = pm_sleep_ptr(&mtk_dp_pm_ops),
},
};

diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index 0a8e0a13f516..52f77a6af10f 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -1755,7 +1755,6 @@ static int mtk_drm_hdmi_remove(struct platform_device *pdev)
return 0;
}

-#ifdef CONFIG_PM_SLEEP
static int mtk_hdmi_suspend(struct device *dev)
{
struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
@@ -1778,9 +1777,9 @@ static int mtk_hdmi_resume(struct device *dev)

return 0;
}
-#endif
-static SIMPLE_DEV_PM_OPS(mtk_hdmi_pm_ops,
- mtk_hdmi_suspend, mtk_hdmi_resume);
+
+static DEFINE_SIMPLE_DEV_PM_OPS(mtk_hdmi_pm_ops,
+ mtk_hdmi_suspend, mtk_hdmi_resume);

static const struct mtk_hdmi_conf mtk_hdmi_conf_mt2701 = {
.tz_disabled = true,
@@ -1810,7 +1809,7 @@ static struct platform_driver mtk_hdmi_driver = {
.driver = {
.name = "mediatek-drm-hdmi",
.of_match_table = mtk_drm_hdmi_of_ids,
- .pm = &mtk_hdmi_pm_ops,
+ .pm = pm_sleep_ptr(&mtk_hdmi_pm_ops),
},
};

--
2.35.1

2022-11-29 20:19:35

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH v2 01/26] drm: modeset-helper: Add DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS macro

This macro can be used with simple drivers, which have their
"struct drm_device" registered as their "struct device"'s drvdata, and
only call drm_mode_config_pm_{suspend,resume}.

The macro will define a "struct dev_pm_ops" with the name passed as
argument. This object cannot be referenced directly; instead, the
pm_sleep_ptr() macro should be used, like this:

DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS(foo_pm_ops);

static struct platform_driver foo_driver = {
.driver.pm = pm_sleep_ptr(&foo_pm_ops),
...
};

This ensures that the generated code will be dropped by the compiler in
the case where CONFIG_PM has been disabled in the config.

v2: instead of exporting a dev_pm_ops, introduce the
DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro.

Signed-off-by: Paul Cercueil <[email protected]>
---
include/drm/drm_modeset_helper.h | 38 ++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)

diff --git a/include/drm/drm_modeset_helper.h b/include/drm/drm_modeset_helper.h
index 995fd981cab0..2ecf0e5c2e16 100644
--- a/include/drm/drm_modeset_helper.h
+++ b/include/drm/drm_modeset_helper.h
@@ -41,4 +41,42 @@ int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
int drm_mode_config_helper_suspend(struct drm_device *dev);
int drm_mode_config_helper_resume(struct drm_device *dev);

+/**
+ * DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS - Generate simple PM callbacks
+ *
+ * This macro can be used by simple drivers that would otherwise only call
+ * drm_mode_config_helper_suspend / drm_mode_config_helper_resume in their PM
+ * callbacks. It will generate a struct dev_pm_ops of the given name, that can
+ * then be referenced in the device_driver structure.
+ *
+ * Note that it is only valid if the driver's drm_device has been registered as
+ * the struct device's drvdata.
+ *
+ * Additionally, the generated dev_pm_ops structure should not be referenced
+ * directly; instead, the pm_sleep_ptr() macro should be used, like this:
+ *
+ * DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS(foo_pm_ops);
+ *
+ * static struct platform_driver foo_driver = {
+ * .driver.pm = pm_sleep_ptr(&foo_pm_ops),
+ * ...
+ * };
+ *
+ * This ensures that the generated code will be dropped by the compiler in the
+ * case where CONFIG_PM has been disabled in the config.
++ */
+
+#define DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS(_name) \
+ static int __##_name##_drm_mode_config_pm_suspend(struct device *dev) \
+ { \
+ return drm_mode_config_helper_suspend(dev_get_drvdata(dev)); \
+ } \
+ static int __##_name##_drm_mode_config_pm_resume(struct device *dev) \
+ { \
+ return drm_mode_config_helper_resume(dev_get_drvdata(dev)); \
+ } \
+ static DEFINE_SIMPLE_DEV_PM_OPS(_name, \
+ __##_name##_drm_mode_config_pm_suspend, \
+ __##_name##_drm_mode_config_pm_resume)
+
#endif
--
2.35.1

2022-11-29 20:31:31

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH v2 07/26] drm: mxsfb: Define and use generic PM ops

Use the new DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro to create a
"struct dev_pm_ops" that can be used by this driver, instead of using
custom PM callbacks with the same behaviour.

v2: Use the DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro instead of an
exported dev_pm_ops.

Signed-off-by: Paul Cercueil <[email protected]>
---
Cc: Marek Vasut <[email protected]>
Cc: Stefan Agner <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: NXP Linux Team <[email protected]>
Cc: [email protected]
---
drivers/gpu/drm/mxsfb/mxsfb_drv.c | 22 ++--------------------
1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index 810edea0a31e..c63d2eb3b379 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -398,25 +398,7 @@ static void mxsfb_shutdown(struct platform_device *pdev)
drm_atomic_helper_shutdown(drm);
}

-#ifdef CONFIG_PM_SLEEP
-static int mxsfb_suspend(struct device *dev)
-{
- struct drm_device *drm = dev_get_drvdata(dev);
-
- return drm_mode_config_helper_suspend(drm);
-}
-
-static int mxsfb_resume(struct device *dev)
-{
- struct drm_device *drm = dev_get_drvdata(dev);
-
- return drm_mode_config_helper_resume(drm);
-}
-#endif
-
-static const struct dev_pm_ops mxsfb_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(mxsfb_suspend, mxsfb_resume)
-};
+DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS(mxsfb_pm_ops);

static struct platform_driver mxsfb_platform_driver = {
.probe = mxsfb_probe,
@@ -425,7 +407,7 @@ static struct platform_driver mxsfb_platform_driver = {
.driver = {
.name = "mxsfb",
.of_match_table = mxsfb_dt_ids,
- .pm = &mxsfb_pm_ops,
+ .pm = pm_sleep_ptr(&mxsfb_pm_ops),
},
};

--
2.35.1

2022-11-29 21:59:16

by Marek Vasut

[permalink] [raw]
Subject: Re: [PATCH v2 07/26] drm: mxsfb: Define and use generic PM ops

On 11/29/22 20:17, Paul Cercueil wrote:
> Use the new DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro to create a
> "struct dev_pm_ops" that can be used by this driver, instead of using
> custom PM callbacks with the same behaviour.
>
> v2: Use the DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro instead of an
> exported dev_pm_ops.
>
> Signed-off-by: Paul Cercueil <[email protected]>

[...]

Reviewed-by: Marek Vasut <[email protected]>

2022-11-30 04:39:18

by Samuel Holland

[permalink] [raw]
Subject: Re: [PATCH v2 06/26] drm: sun4i: Define and use generic PM ops

On 11/29/22 13:17, Paul Cercueil wrote:
> Use the new DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro to create a
> "struct dev_pm_ops" that can be used by this driver, instead of using
> custom PM callbacks with the same behaviour.
>
> v2: Use the DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro instead of an
> exported dev_pm_ops.
>
> Signed-off-by: Paul Cercueil <[email protected]>
> ---
>
> Samuel: since the code changed I had to remove your reviewed-by, sorry
> about that.
>
> Cc: Maxime Ripard <[email protected]>
> Cc: Chen-Yu Tsai <[email protected]>
> Cc: Jernej Skrabec <[email protected]>
> Cc: Samuel Holland <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> ---
> drivers/gpu/drm/sun4i/sun4i_drv.c | 26 ++++----------------------
> 1 file changed, 4 insertions(+), 22 deletions(-)

Reviewed-by: Samuel Holland <[email protected]>

2022-12-15 19:44:49

by Lucas Stach

[permalink] [raw]
Subject: Re: [PATCH v2 12/26] drm: etnaviv: Remove #ifdef guards for PM related functions

Am Dienstag, dem 29.11.2022 um 19:17 +0000 schrieb Paul Cercueil:
> Use the RUNTIME_PM_OPS() and pm_ptr() macros to handle the
> .runtime_suspend/.runtime_resume callbacks.
>
> These macros allow the suspend and resume 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.
>
> Some #ifdef CONFIG_PM guards were protecting simple statements, and were
> also converted to "if (IS_ENABLED(CONFIG_PM))".
>
> Signed-off-by: Paul Cercueil <[email protected]>

Thanks, applied to my etnaviv/next branch.

Regards,
Lucas

> ---
> Cc: Lucas Stach <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: Christian Gmeiner <[email protected]>
> Cc: [email protected]
> ---
> drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 30 +++++++++++----------------
> 1 file changed, 12 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> index 51320eeebfcf..310382812029 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> @@ -1629,7 +1629,6 @@ static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu)
> return etnaviv_gpu_clk_disable(gpu);
> }
>
> -#ifdef CONFIG_PM
> static int etnaviv_gpu_hw_resume(struct etnaviv_gpu *gpu)
> {
> int ret;
> @@ -1645,7 +1644,6 @@ static int etnaviv_gpu_hw_resume(struct etnaviv_gpu *gpu)
>
> return 0;
> }
> -#endif
>
> static int
> etnaviv_gpu_cooling_get_max_state(struct thermal_cooling_device *cdev,
> @@ -1713,11 +1711,10 @@ static int etnaviv_gpu_bind(struct device *dev, struct device *master,
> if (ret)
> goto out_workqueue;
>
> -#ifdef CONFIG_PM
> - ret = pm_runtime_get_sync(gpu->dev);
> -#else
> - ret = etnaviv_gpu_clk_enable(gpu);
> -#endif
> + if (IS_ENABLED(CONFIG_PM))
> + ret = pm_runtime_get_sync(gpu->dev);
> + else
> + ret = etnaviv_gpu_clk_enable(gpu);
> if (ret < 0)
> goto out_sched;
>
> @@ -1761,12 +1758,12 @@ static void etnaviv_gpu_unbind(struct device *dev, struct device *master,
>
> etnaviv_sched_fini(gpu);
>
> -#ifdef CONFIG_PM
> - pm_runtime_get_sync(gpu->dev);
> - pm_runtime_put_sync_suspend(gpu->dev);
> -#else
> - etnaviv_gpu_hw_suspend(gpu);
> -#endif
> + if (IS_ENABLED(CONFIG_PM)) {
> + pm_runtime_get_sync(gpu->dev);
> + pm_runtime_put_sync_suspend(gpu->dev);
> + } else {
> + etnaviv_gpu_hw_suspend(gpu);
> + }
>
> if (gpu->mmu_context)
> etnaviv_iommu_context_put(gpu->mmu_context);
> @@ -1880,7 +1877,6 @@ static int etnaviv_gpu_platform_remove(struct platform_device *pdev)
> return 0;
> }
>
> -#ifdef CONFIG_PM
> static int etnaviv_gpu_rpm_suspend(struct device *dev)
> {
> struct etnaviv_gpu *gpu = dev_get_drvdata(dev);
> @@ -1923,18 +1919,16 @@ static int etnaviv_gpu_rpm_resume(struct device *dev)
>
> return 0;
> }
> -#endif
>
> static const struct dev_pm_ops etnaviv_gpu_pm_ops = {
> - SET_RUNTIME_PM_OPS(etnaviv_gpu_rpm_suspend, etnaviv_gpu_rpm_resume,
> - NULL)
> + RUNTIME_PM_OPS(etnaviv_gpu_rpm_suspend, etnaviv_gpu_rpm_resume, NULL)
> };
>
> struct platform_driver etnaviv_gpu_driver = {
> .driver = {
> .name = "etnaviv-gpu",
> .owner = THIS_MODULE,
> - .pm = &etnaviv_gpu_pm_ops,
> + .pm = pm_ptr(&etnaviv_gpu_pm_ops),
> .of_match_table = etnaviv_gpu_match,
> },
> .probe = etnaviv_gpu_platform_probe,