[1/3,media] venus: mark PM functions as __maybe_unused

Message ID 20170627150310.719212-1-arnd@arndb.de
State Accepted
Commit eb918f915f5bdf0d78479567dab016dfa975673e
Headers show
Series
  • [1/3,media] venus: mark PM functions as __maybe_unused
Related show

Commit Message

Arnd Bergmann June 27, 2017, 3:02 p.m.
Without PM support, gcc warns about two unused functions:

platform/qcom/venus/core.c:146:13: error: 'venus_clks_disable' defined but not used [-Werror=unused-function]
platform/qcom/venus/core.c:126:12: error: 'venus_clks_enable' defined but not used [-Werror=unused-function]

The problem as usual are incorrect #ifdefs, so the easiest fix
is to do away with the #ifdef completely and mark the suspend/resume
handlers as __maybe_unused, which they are.

Fixes: af2c3834c8ca ("[media] media: venus: adding core part and helper functions")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---
 drivers/media/platform/qcom/venus/core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

-- 
2.9.0

Comments

Stanimir Varbanov June 27, 2017, 7:45 p.m. | #1
Hi Arnd,

On 27.06.2017 18:02, Arnd Bergmann wrote:
> If QCOM_MDT_LOADER is enabled, but ARCH_QCOM is not, we run into

> a build error:

> 

> ERROR: "qcom_mdt_load" [drivers/media/platform/qcom/venus/venus-core.ko] undefined!

> ERROR: "qcom_mdt_get_size" [drivers/media/platform/qcom/venus/venus-core.ko] undefined!


Ahh, thanks for the fix, these two will also pursuing me in my dreams.

> 

> This changes the 'select' statement again, so we only try to enable

> those symbols when the drivers will actually get built.

> 

> Fixes: 76724b30f222 ("[media] media: venus: enable building with COMPILE_TEST")

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>


Reviewed-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>


> ---

>   drivers/media/platform/Kconfig | 4 ++--

>   1 file changed, 2 insertions(+), 2 deletions(-)

> 

> diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig

> index cb2f31cd0088..635c53e61f8a 100644

> --- a/drivers/media/platform/Kconfig

> +++ b/drivers/media/platform/Kconfig

> @@ -475,8 +475,8 @@ config VIDEO_QCOM_VENUS

>   	tristate "Qualcomm Venus V4L2 encoder/decoder driver"

>   	depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA

>   	depends on (ARCH_QCOM && IOMMU_DMA) || COMPILE_TEST

> -	select QCOM_MDT_LOADER if (ARM || ARM64)

> -	select QCOM_SCM if (ARM || ARM64)

> +	select QCOM_MDT_LOADER if ARCH_QCOM

> +	select QCOM_SCM if ARCH_QCOM

>   	select VIDEOBUF2_DMA_SG

>   	select V4L2_MEM2MEM_DEV

>   	---help---

> 


regards,
Stan
Arnd Bergmann June 28, 2017, 8:25 p.m. | #2
On Tue, Jun 27, 2017 at 9:45 PM, Stanimir Varbanov
<stanimir.varbanov@linaro.org> wrote:
> Hi Arnd,

>

> On 27.06.2017 18:02, Arnd Bergmann wrote:

>>

>> If QCOM_MDT_LOADER is enabled, but ARCH_QCOM is not, we run into

>> a build error:

>>

>> ERROR: "qcom_mdt_load" [drivers/media/platform/qcom/venus/venus-core.ko]

>> undefined!

>> ERROR: "qcom_mdt_get_size"

>> [drivers/media/platform/qcom/venus/venus-core.ko] undefined!

>

>

> Ahh, thanks for the fix, these two will also pursuing me in my dreams.


I just came after me as well, as I hit another corner case, we need this
fixup on top, I'll send a replacement:

Subject: [PATCH] fixup! [media] venus: fix compile-test  build on
non-qcom ARM platform

Signed-off-by: Arnd Bergmann <arnd@arndb.de>


  fw_dev->parent = parent;diff --git a/drivers/media/platform/qcom/venus/firmware.c
b/drivers/media/platform/qcom/venus/firmware.c
index 76edb9f60311..3794b9e3250b 100644
--- a/drivers/media/platform/qcom/venus/firmware.c
+++ b/drivers/media/platform/qcom/venus/firmware.c
@@ -40,7 +40,7 @@ int venus_boot(struct device *parent, struct device
*fw_dev, const char *fwname)
  void *mem_va;
  int ret;

- if (!qcom_scm_is_available())
+ if (!IS_ENABLED(CONFIG_QCOM_MDT_LOADER) || !qcom_scm_is_available())
  return -EPROBE_DEFER;


Patch

diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index d8cbe8549d97..47f79637938c 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -270,8 +270,7 @@  static int venus_remove(struct platform_device *pdev)
 	return ret;
 }
 
-#ifdef CONFIG_PM
-static int venus_runtime_suspend(struct device *dev)
+static __maybe_unused int venus_runtime_suspend(struct device *dev)
 {
 	struct venus_core *core = dev_get_drvdata(dev);
 	int ret;
@@ -283,7 +282,7 @@  static int venus_runtime_suspend(struct device *dev)
 	return ret;
 }
 
-static int venus_runtime_resume(struct device *dev)
+static __maybe_unused int venus_runtime_resume(struct device *dev)
 {
 	struct venus_core *core = dev_get_drvdata(dev);
 	int ret;
@@ -302,7 +301,6 @@  static int venus_runtime_resume(struct device *dev)
 	venus_clks_disable(core);
 	return ret;
 }
-#endif
 
 static const struct dev_pm_ops venus_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,