diff mbox series

[v2] drm/vc4: Unselect PM

Message ID 20210924152334.1342630-1-maxime@cerno.tech (mailing list archive)
State New, archived
Headers show
Series [v2] drm/vc4: Unselect PM | expand

Commit Message

Maxime Ripard Sept. 24, 2021, 3:23 p.m. UTC
It turns out we can't select PM when allowing the compilation for
COMPILE_TEST. Indeed, PM might not be defined at all, or come with extra
requirements we can't meet.

This select was initially introduced since we need to call the
vc4_hdmi_runtime_resume() at probe time to make sure our device is
properly powered at bind time, no matter whether PM is there or not, and
we needed to make sure we didn't have a defined but not used warning for
vc4_hdmi_runtime_suspend().

This will still happen on platforms that don't define PM though, since
SET_RUNTIME_PM_OPS will then be a nop. In order to fix both issues,
let's remove the select, and add a __maybe_unused attribute to
vc4_hdmi_runtime_resume().

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>

---

I'm not sure how to merge this one, since this commit has been reverted
in Linus tree, and un-reverted in linux-next. Should we wait a bit until
the reworked version of the original commit has been merged again?

Maxime

Changes from v1:
  - remove select
  - add __maybe_unused to vc4_hdmi_runtime_resume
  - reword the commit log
---
 drivers/gpu/drm/vc4/Kconfig    | 1 -
 drivers/gpu/drm/vc4/vc4_hdmi.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

Comments

Nathan Chancellor Sept. 24, 2021, 3:46 p.m. UTC | #1
On Fri, Sep 24, 2021 at 05:23:34PM +0200, Maxime Ripard wrote:
> It turns out we can't select PM when allowing the compilation for
> COMPILE_TEST. Indeed, PM might not be defined at all, or come with extra
> requirements we can't meet.
> 
> This select was initially introduced since we need to call the
> vc4_hdmi_runtime_resume() at probe time to make sure our device is
> properly powered at bind time, no matter whether PM is there or not, and
> we needed to make sure we didn't have a defined but not used warning for
> vc4_hdmi_runtime_suspend().
> 
> This will still happen on platforms that don't define PM though, since
> SET_RUNTIME_PM_OPS will then be a nop. In order to fix both issues,
> let's remove the select, and add a __maybe_unused attribute to
> vc4_hdmi_runtime_resume().
> 
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org> # build

> ---
> 
> I'm not sure how to merge this one, since this commit has been reverted
> in Linus tree, and un-reverted in linux-next. Should we wait a bit until
> the reworked version of the original commit has been merged again?
> 
> Maxime
> 
> Changes from v1:
>   - remove select
>   - add __maybe_unused to vc4_hdmi_runtime_resume
>   - reword the commit log
> ---
>  drivers/gpu/drm/vc4/Kconfig    | 1 -
>  drivers/gpu/drm/vc4/vc4_hdmi.c | 2 +-
>  2 files changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vc4/Kconfig b/drivers/gpu/drm/vc4/Kconfig
> index 52a1c309cb4a..345a5570a3da 100644
> --- a/drivers/gpu/drm/vc4/Kconfig
> +++ b/drivers/gpu/drm/vc4/Kconfig
> @@ -9,7 +9,6 @@ config DRM_VC4
>  	select DRM_KMS_CMA_HELPER
>  	select DRM_GEM_CMA_HELPER
>  	select DRM_PANEL_BRIDGE
> -	select PM
>  	select SND_PCM
>  	select SND_PCM_ELD
>  	select SND_SOC_GENERIC_DMAENGINE_PCM
> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> index 500cdd56b335..1f2690ed8542 100644
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> @@ -2122,7 +2122,7 @@ static int vc5_hdmi_init_resources(struct vc4_hdmi *vc4_hdmi)
>  	return 0;
>  }
>  
> -static int vc4_hdmi_runtime_suspend(struct device *dev)
> +static int __maybe_unused vc4_hdmi_runtime_suspend(struct device *dev)
>  {
>  	struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
>  
> -- 
> 2.31.1
>
Randy Dunlap Sept. 24, 2021, 8:41 p.m. UTC | #2
On 9/24/21 8:23 AM, Maxime Ripard wrote:
> It turns out we can't select PM when allowing the compilation for
> COMPILE_TEST. Indeed, PM might not be defined at all, or come with extra
> requirements we can't meet.
> 
> This select was initially introduced since we need to call the
> vc4_hdmi_runtime_resume() at probe time to make sure our device is
> properly powered at bind time, no matter whether PM is there or not, and
> we needed to make sure we didn't have a defined but not used warning for
> vc4_hdmi_runtime_suspend().
> 
> This will still happen on platforms that don't define PM though, since
> SET_RUNTIME_PM_OPS will then be a nop. In order to fix both issues,
> let's remove the select, and add a __maybe_unused attribute to
> vc4_hdmi_runtime_resume().
> 
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> 

LGTM. Thanks.

Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested

> ---
> 
> I'm not sure how to merge this one, since this commit has been reverted
> in Linus tree, and un-reverted in linux-next. Should we wait a bit until
> the reworked version of the original commit has been merged again?
> 
> Maxime
> 
> Changes from v1:
>    - remove select
>    - add __maybe_unused to vc4_hdmi_runtime_resume
>    - reword the commit log
> ---
>   drivers/gpu/drm/vc4/Kconfig    | 1 -
>   drivers/gpu/drm/vc4/vc4_hdmi.c | 2 +-
>   2 files changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vc4/Kconfig b/drivers/gpu/drm/vc4/Kconfig
> index 52a1c309cb4a..345a5570a3da 100644
> --- a/drivers/gpu/drm/vc4/Kconfig
> +++ b/drivers/gpu/drm/vc4/Kconfig
> @@ -9,7 +9,6 @@ config DRM_VC4
>   	select DRM_KMS_CMA_HELPER
>   	select DRM_GEM_CMA_HELPER
>   	select DRM_PANEL_BRIDGE
> -	select PM
>   	select SND_PCM
>   	select SND_PCM_ELD
>   	select SND_SOC_GENERIC_DMAENGINE_PCM
> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> index 500cdd56b335..1f2690ed8542 100644
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> @@ -2122,7 +2122,7 @@ static int vc5_hdmi_init_resources(struct vc4_hdmi *vc4_hdmi)
>   	return 0;
>   }
>   
> -static int vc4_hdmi_runtime_suspend(struct device *dev)
> +static int __maybe_unused vc4_hdmi_runtime_suspend(struct device *dev)
>   {
>   	struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
>   
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vc4/Kconfig b/drivers/gpu/drm/vc4/Kconfig
index 52a1c309cb4a..345a5570a3da 100644
--- a/drivers/gpu/drm/vc4/Kconfig
+++ b/drivers/gpu/drm/vc4/Kconfig
@@ -9,7 +9,6 @@  config DRM_VC4
 	select DRM_KMS_CMA_HELPER
 	select DRM_GEM_CMA_HELPER
 	select DRM_PANEL_BRIDGE
-	select PM
 	select SND_PCM
 	select SND_PCM_ELD
 	select SND_SOC_GENERIC_DMAENGINE_PCM
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 500cdd56b335..1f2690ed8542 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -2122,7 +2122,7 @@  static int vc5_hdmi_init_resources(struct vc4_hdmi *vc4_hdmi)
 	return 0;
 }
 
-static int vc4_hdmi_runtime_suspend(struct device *dev)
+static int __maybe_unused vc4_hdmi_runtime_suspend(struct device *dev)
 {
 	struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);