[PATCH RFT 2/5] drm/msm: Centralize the standalone drm device check for GPU

From: Akhil P Oommen

Date: Tue May 12 2026 - 16:57:24 EST


Replace msm_gpu_no_components() with msm_gpu_use_separate_drm_dev() and
move the platform-specific check for "amd,imageon" into the helper so the
policy is centralized and reused by both the core driver and adreno probe
path. No functional change intended.

Signed-off-by: Akhil P Oommen <akhilpo@xxxxxxxxxxxxxxxx>
---
drivers/gpu/drm/msm/adreno/adreno_device.c | 3 +--
drivers/gpu/drm/msm/msm_drv.c | 11 +++++++----
drivers/gpu/drm/msm/msm_drv.h | 2 +-
3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c
index 4edfe80c5be7..3052f3e36de0 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_device.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
@@ -271,8 +271,7 @@ static const struct component_ops a3xx_ops = {

static int adreno_probe(struct platform_device *pdev)
{
- if (of_device_is_compatible(pdev->dev.of_node, "amd,imageon") ||
- msm_gpu_no_components())
+ if (msm_gpu_use_separate_drm_dev(pdev))
return msm_gpu_probe(pdev, &a3xx_ops);

return component_add(&pdev->dev, &a3xx_ops);
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 195f40e331e5..b61deafd02c3 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -61,9 +61,12 @@ module_param(separate_gpu_kms, bool, 0400);
DECLARE_FAULT_ATTR(fail_gem_alloc);
DECLARE_FAULT_ATTR(fail_gem_iova);

-bool msm_gpu_no_components(void)
+bool msm_gpu_use_separate_drm_dev(struct platform_device *pdev)
{
- return separate_gpu_kms;
+ if (!pdev)
+ return separate_gpu_kms;
+
+ return of_device_is_compatible(pdev->dev.of_node, "amd,imageon") || separate_gpu_kms;
}

static int msm_drm_uninit(struct device *dev, const struct component_ops *gpu_ops)
@@ -1035,7 +1038,7 @@ static int add_gpu_components(struct device *dev,
static int msm_drm_bind(struct device *dev)
{
return msm_drm_init(dev,
- msm_gpu_no_components() ?
+ msm_gpu_use_separate_drm_dev(NULL) ?
&msm_kms_driver :
&msm_driver,
NULL);
@@ -1074,7 +1077,7 @@ int msm_drv_probe(struct device *master_dev,
return ret;
}

- if (!msm_gpu_no_components()) {
+ if (!msm_gpu_use_separate_drm_dev(NULL)) {
ret = add_gpu_components(master_dev, &match);
if (ret)
return ret;
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 6d847d593f1a..6fcb696ceb7c 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -555,6 +555,6 @@ void msm_kms_shutdown(struct platform_device *pdev);

bool msm_disp_drv_should_bind(struct device *dev, bool dpu_driver);

-bool msm_gpu_no_components(void);
+bool msm_gpu_use_separate_drm_dev(struct platform_device *pdev);

#endif /* __MSM_DRV_H__ */

--
2.51.0