All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] regulator: mt6380: Fix unused array warning
@ 2022-07-27 11:26 Jean Delvare
  2022-07-27 12:01 ` Mark Brown
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jean Delvare @ 2022-07-27 11:26 UTC (permalink / raw)
  To: linux-kernel, linux-mediatek
  Cc: Liam Girdwood, Mark Brown, Matthias Brugger, Chenglin Xu, Sean Wang

With the following configuration options:
CONFIG_OF is not set
CONFIG_REGULATOR_MT6380=y
we get the following build warning:

  CC      drivers/regulator/mt6380-regulator.o
drivers/regulator/mt6380-regulator.c:322:34: warning: ‘mt6380_of_match’ defined but not used [-Wunused-const-variable=]

Fix this by annotating that array with __maybe_unused, as done in
various regulator drivers.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/all/202207240252.ZY5hSCNB-lkp@intel.com/
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Chenglin Xu <chenglin.xu@mediatek.com>
---
This assumes that the mt6380 driver can be used without OF support.
However, I can't find any in-tree piece of code instantiating the
"mt6380-regulator" platform device by name. So unless there's an
out-of-tree user, a better fix would be to remove mt6380_platform_ids
and make the driver depend on OF. Chenglin, would that be OK with
you?

 drivers/regulator/mt6380-regulator.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-5.18.orig/drivers/regulator/mt6380-regulator.c	2022-07-27 11:55:21.672421481 +0200
+++ linux-5.18/drivers/regulator/mt6380-regulator.c	2022-07-27 12:01:53.151833378 +0200
@@ -319,7 +319,7 @@ static const struct platform_device_id m
 };
 MODULE_DEVICE_TABLE(platform, mt6380_platform_ids);
 
-static const struct of_device_id mt6380_of_match[] = {
+static const struct of_device_id  __maybe_unused mt6380_of_match[] = {
 	{ .compatible = "mediatek,mt6380-regulator", },
 	{ /* sentinel */ },
 };


-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-07-29 13:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-27 11:26 [PATCH RFC] regulator: mt6380: Fix unused array warning Jean Delvare
2022-07-27 12:01 ` Mark Brown
2022-07-27 12:08   ` Jean Delvare
2022-07-27 12:24     ` Mark Brown
2022-07-27 18:50       ` Jean Delvare
2022-07-27 20:10 ` Mark Brown
2022-07-28 11:15 ` AngeloGioacchino Del Regno
2022-07-29 13:23   ` Jean Delvare

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.