Skip to contentSkip to conversation

media: rkvdec: silence ktest bot build warning

PATCH In review Adrian Ratiu 4 participants 4 messages Dec 8, 2020 – Jan 7, 2021

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

PATCH 1/1 media: rkvdec: silence ktest bot build warning

Some configurations built by the ktest bot produce the following warn, so mark the struct as __maybe_unused to avoid unnecessary ML spam.

Quoted 1 line
Quoted 1 line

drivers/staging/media/rkvdec/rkvdec.c:967:34: warning: unused variable 'of_rkvdec_match' [-Wunused-const-variable]

   static const struct of_device_id of_rkvdec_match[] = {
				    ^

1 warning generated.

vim +/of_rkvdec_match +967 drivers/staging/media/rkvdec/rkvdec.c

966

Quoted 1 line

967 static const struct of_device_id of_rkvdec_match[] = {

968 { .compatible = "rockchip,rk3399-vdec" },
969 { /* sentinel */ }
970 };
971 MODULE_DEVICE_TABLE(of, of_rkvdec_match);
972

Cc Boris Brezillon <[email protected]>
Cc Ezequiel Garcia <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
---
 drivers/staging/media/rkvdec/rkvdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/rkvdec/rkvdec.c +1 -1
index aa4f8c287618..3af0f02ec59b 100644
@@ -992,7 +992,7 @@ static void rkvdec_watchdog_func(struct work_struct *work)
 	}
 }
 
-static const struct of_device_id of_rkvdec_match[] = {
+static const struct of_device_id __maybe_unused of_rkvdec_match[] = {
 	{ .compatible = "rockchip,rk3399-vdec" },
 	{ /* sentinel */ }
 };
Signature · 7 lines
2.29.2


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#1 lore raw
Quoted 8 lines · Adrian Ratiu

Some configurations built by the ktest bot produce the following warn, so mark the struct as __maybe_unused to avoid unnecessary ML spam.

Quoted 1 line
Quoted 1 line

drivers/staging/media/rkvdec/rkvdec.c:967:34: warning: unused variable 'of_rkvdec_match' [-Wunused-const-variable]

   static const struct of_device_id of_rkvdec_match[] = {
				    ^

1 warning generated.

I suspect that this is because there is no 'depends on OF' in the Kconfig.

'__maybe_unused' isn't used for this anywhere else, so this does not seem like the right approach.

Regards,

Hans

Quoted 26 lines

vim +/of_rkvdec_match +967 drivers/staging/media/rkvdec/rkvdec.c

   966
Quoted 1 line

967 static const struct of_device_id of_rkvdec_match[] = {

968 { .compatible = "rockchip,rk3399-vdec" },
969 { /* sentinel */ }

   970	};
   971	MODULE_DEVICE_TABLE(of, of_rkvdec_match);
   972
Cc Boris Brezillon <[email protected]>
Cc Ezequiel Garcia <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
---
 drivers/staging/media/rkvdec/rkvdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/rkvdec/rkvdec.c +0 -0
index aa4f8c287618..3af0f02ec59b 100644

drivers/staging/media/rkvdec/rkvdec.c static void rkvdec_watchdog_func(struct work_struct *work) · line 998

Quoted 8 lines
drivers/staging/media/rkvdec/rkvdec.c +1 -1
@@ -992,7 +992,7 @@ static void rkvdec_watchdog_func(struct work_struct *work)
 	}
 }
 
-static const struct of_device_id of_rkvdec_match[] = {
+static const struct of_device_id __maybe_unused of_rkvdec_match[] = {
 	{ .compatible = "rockchip,rk3399-vdec" },
 	{ /* sentinel */ }
 };

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#2 lore raw
Quoted 6 lines · On Thu, 7 Jan 2021 10:13:43 +0100 Hans Verkuil <[email protected]> wrote:
Quoted 5 lines · Adrian Ratiu

Some configurations built by the ktest bot produce the following warn, so mark the struct as __maybe_unused to avoid unnecessary ML spam.

Quoted 1 line
Quoted 1 line

drivers/staging/media/rkvdec/rkvdec.c:967:34: warning: unused variable 'of_rkvdec_match' [-Wunused-const-variable]

Quoted 8 lines
Quoted 3 lines
   static const struct of_device_id of_rkvdec_match[] = {
				    ^
   1 warning generated.  

I suspect that this is because there is no 'depends on OF' in the Kconfig.

'__maybe_unused' isn't used for this anywhere else, so this does not seem like the right approach.

It's not uncommon to do that, especially when you want the driver to be compile-tested (git grep -C2 __maybe_unused|grep of_device_id even reports 2 drivers in the media tree :P). A depends on OF or an #ifdef CONFIG_OF section surrounding the of_rkvdec_match declaration would also do the trick.

Quoted 33 lines

Regards,

Hans

Quoted 28 lines

vim +/of_rkvdec_match +967 drivers/staging/media/rkvdec/rkvdec.c

   966  
Quoted 1 line

967 static const struct of_device_id of_rkvdec_match[] = {

968 { .compatible = "rockchip,rk3399-vdec" },
969 { /* sentinel */ }

   970	};
   971	MODULE_DEVICE_TABLE(of, of_rkvdec_match);
   972
Cc Boris Brezillon <[email protected]>
Cc Ezequiel Garcia <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
---
 drivers/staging/media/rkvdec/rkvdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/rkvdec/rkvdec.c +0 -0
index aa4f8c287618..3af0f02ec59b 100644
@@ -992,7 +992,7 @@ static void rkvdec_watchdog_func(struct work_struct *work)
 	}
 }
 
Quoted 7 lines

drivers/staging/media/rkvdec/rkvdec.c static void rkvdec_watchdog_func(struct work_struct *work) · line 998

Quoted 6 lines
drivers/staging/media/rkvdec/rkvdec.c +1 -1
-static const struct of_device_id of_rkvdec_match[] = {
+static const struct of_device_id __maybe_unused of_rkvdec_match[] = {
 	{ .compatible = "rockchip,rk3399-vdec" },
 	{ /* sentinel */ }
 };

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#3 lore raw
Quoted 15 lines · Boris Brezillon
Quoted 12 lines · On Thu, 7 Jan 2021 10:13:43 +0100 Hans Verkuil <[email protected]> wrote:
Quoted 8 lines · Adrian Ratiu

Some configurations built by the ktest bot produce the following warn, so mark the struct as __maybe_unused to avoid unnecessary ML spam.

Quoted 1 line
Quoted 1 line

drivers/staging/media/rkvdec/rkvdec.c:967:34: warning: unused variable 'of_rkvdec_match' [-Wunused-const-variable]

   static const struct of_device_id of_rkvdec_match[] = { ^
   1 warning generated.

I suspect that this is because there is no 'depends on OF' in the Kconfig.

Quoted 9 lines
Quoted 2 lines

'__maybe_unused' isn't used for this anywhere else, so this does not seem like the right approach.

It's not uncommon to do that, especially when you want the driver to be compile-tested (git grep -C2 __maybe_unused|grep of_device_id even reports 2 drivers in the media tree :P). A depends on OF or an #ifdef CONFIG_OF section surrounding the of_rkvdec_match declaration would also do the trick.

I'm fine either way, __maybe_unused or depends on OF.

Thanks,
Ezequiel

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip