Skip to contentSkip to conversation

drm/msm: remove unused variable

PATCH In review Arnd Bergmann 2 participants 4 messages Aug 3, 2017 – Aug 4, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 drm/msm: remove unused variable

A cleanup left behind an unused variable that we have to remove in order to avoid this harmless warning:

drivers/gpu/drm/msm/adreno/a5xx_gpu.c: In function 'a5xx_zap_shader_init':
drivers/gpu/drm/msm/adreno/a5xx_gpu.c:493:19: error: unused variable 'a5xx_gpu' [-Werror=unused-variable]

Fixes 8d6f08272b6f ("drm/msm: Remove uneeded platform dev members")
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +0 -1
index ea0f6e5b3b1e..a0f69b2e593a 100644
@@ -490,7 +490,6 @@ static int a5xx_zap_shader_init(struct msm_gpu *gpu)
 {
 	static bool loaded;
 	struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
-	struct a5xx_gpu *a5xx_gpu = to_a5xx_gpu(adreno_gpu);
 	struct platform_device *pdev = gpu->pdev;
 	int ret;
 
Signature · 1 line
2.9.0
#1 lore raw

PATCH 2/3 drm/msm/mdp5: mark runtime_pm functions as __maybe_unused

When CONFIG_PM is disabled, we get harmless warnings about unused functions:

drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:1025:12: error: 'mdp5_runtime_resume' defined but not used [-Werror=unused-function]
static int mdp5_runtime_resume(struct device *dev)

            ^~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:1015:12: error: 'mdp5_runtime_suspend' defined but not used [-Werror=unused-function]
 static int mdp5_runtime_suspend(struct device *dev)
            ^~~~~~~~~~~~~~~~~~~~

This marks both functions as __maybe_unused so the compiler can drop them silently.

Fixes d68fe15b1878 ("drm/msm/mdp5: Use runtime PM get/put API instead of toggling clocks")
---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +2 -2
index 9f9d95f7c80f..f7c0698fec40 100644
@@ -1012,7 +1012,7 @@ static int mdp5_dev_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static int mdp5_runtime_suspend(struct device *dev)
+static __maybe_unused int mdp5_runtime_suspend(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct mdp5_kms *mdp5_kms = platform_get_drvdata(pdev);
@@ -1022,7 +1022,7 @@ static int mdp5_runtime_suspend(struct device *dev)
 	return mdp5_disable(mdp5_kms);
 }
 
-static int mdp5_runtime_resume(struct device *dev)
+static __maybe_unused int mdp5_runtime_resume(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct mdp5_kms *mdp5_kms = platform_get_drvdata(pdev);
Signature · 6 lines
2.9.0

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
#2 lore raw

Re: [PATCH 2/3] drm/msm/mdp5: mark runtime_pm functions as __maybe_unused

Quoted 5 lines · Arnd Bergmann

When CONFIG_PM is disabled, we get harmless warnings about unused functions:

drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:1025:12: error: 'mdp5_runtime_resume' defined but not used [-Werror=unused-function]
static int mdp5_runtime_resume(struct device *dev)

Quoted 7 lines
             ^~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:1015:12: error: 'mdp5_runtime_suspend' defined but not used [-Werror=unused-function]
  static int mdp5_runtime_suspend(struct device *dev)
             ^~~~~~~~~~~~~~~~~~~~

This marks both functions as __maybe_unused so the compiler can drop them silently.

Thanks for the fix. Since the commit is still in Rob's -next branch, I'll post a new version which fixes this.

Archit

Quoted 30 lines
Fixes d68fe15b1878 ("drm/msm/mdp5: Use runtime PM get/put API instead of toggling clocks")
---
  drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +2 -2
index 9f9d95f7c80f..f7c0698fec40 100644
@@ -1012,7 +1012,7 @@ static int mdp5_dev_remove(struct platform_device *pdev)
  	return 0;
  }
 
-static int mdp5_runtime_suspend(struct device *dev)
+static __maybe_unused int mdp5_runtime_suspend(struct device *dev)
  {
  	struct platform_device *pdev = to_platform_device(dev);
  	struct mdp5_kms *mdp5_kms = platform_get_drvdata(pdev);
@@ -1022,7 +1022,7 @@ static int mdp5_runtime_suspend(struct device *dev)
  	return mdp5_disable(mdp5_kms);
  }
 
-static int mdp5_runtime_resume(struct device *dev)
+static __maybe_unused int mdp5_runtime_resume(struct device *dev)
  {
  	struct platform_device *pdev = to_platform_device(dev);
  	struct mdp5_kms *mdp5_kms = platform_get_drvdata(pdev);
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#3 lore raw

PATCH 3/3 drm/msm: use %z format modifier for printing size_t

In reply to Arnd Bergmann

The return type of ARRAY_SIZE() is size_t, so we have to use %zu instead of %lu to avoid this warning:

drivers/gpu/drm/msm/msm_gpu.c: In function 'msm_gpu_init':
drivers/gpu/drm/msm/msm_gpu.c:742:31: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'unsigned int' [-Werror=format=]

The warning it otherwise harmless as size_t is always the same size as unsigned long in all supported architectures, but gcc doesn't know that.

Fixes c2fceabca6d5 ("drm/msm: Support multiple ringbuffers")
---
 drivers/gpu/drm/msm/msm_gpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_gpu.c +1 -1
index 1e44f8893490..66af5ac334ba 100644
@@ -739,7 +739,7 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev,
 	}
 
 	if (nr_rings > ARRAY_SIZE(gpu->rb)) {
-		DRM_DEV_INFO_ONCE(drm->dev, "Only creating %lu ringbuffers\n",
+		DRM_DEV_INFO_ONCE(drm->dev, "Only creating %zu ringbuffers\n",
 			ARRAY_SIZE(gpu->rb));
 		nr_rings = ARRAY_SIZE(gpu->rb);
 	}
Signature · 6 lines
2.9.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel