mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] drm/bridge: fix -Wunused-const-variable= warning
@ 2023-07-26 10:06 Zhu Wang
  2023-07-26 10:54 ` Uwe Kleine-König
  0 siblings, 1 reply; 3+ messages in thread
From: Zhu Wang @ 2023-07-26 10:06 UTC (permalink / raw)
  To: andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas,
	jernej.skrabec, airlied, daniel, u.kleine-koenig, javierm,
	dianders, benjamin.mugnier, kabel, anarsoul, duwe, mripard,
	dri-devel, linux-kernel
  Cc: wangzhu9

When building with W=1, the following warning occurs.

drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c:48:17: warning: ‘anx781x_i2c_addresses’ defined but not used [-Wunused-const-variable=]
 static const u8 anx781x_i2c_addresses[] = {
                 ^~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c:40:17: warning: ‘anx7808_i2c_addresses’ defined but not used [-Wunused-const-variable=]
 static const u8 anx7808_i2c_addresses[] = {

The definition of above two data variables is included by the
macro CONFIG_OF, so we also include the data variable
definitions in the macro CONFIG_OF. And in addition the data
variable anx78xx_match_table is included in the macro CONFIG_OF,
so we add CONFIG_OF to the place where it is used.

Fixes: 5d97408e0d70 ("drm/bridge: move ANA78xx driver to analogix subdirectory")

Signed-off-by: Zhu Wang <wangzhu9@huawei.com>
---
 drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
index 06a3e3243e19..799b33cebdd5 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
@@ -37,6 +37,7 @@
 
 #define XTAL_CLK		270 /* 27M */
 
+#if IS_ENABLED(CONFIG_OF)
 static const u8 anx7808_i2c_addresses[] = {
 	[I2C_IDX_TX_P0] = 0x78,
 	[I2C_IDX_TX_P1] = 0x7a,
@@ -52,6 +53,7 @@ static const u8 anx781x_i2c_addresses[] = {
 	[I2C_IDX_RX_P0] = 0x7e,
 	[I2C_IDX_RX_P1] = 0x80,
 };
+#endif
 
 struct anx78xx_platform_data {
 	struct regulator *dvdd10;
@@ -1387,7 +1389,9 @@ MODULE_DEVICE_TABLE(of, anx78xx_match_table);
 static struct i2c_driver anx78xx_driver = {
 	.driver = {
 		   .name = "anx7814",
+#if IS_ENABLED(CONFIG_OF)
 		   .of_match_table = of_match_ptr(anx78xx_match_table),
+#endif
 		  },
 	.probe = anx78xx_i2c_probe,
 	.remove = anx78xx_i2c_remove,
-- 
2.17.1


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

end of thread, other threads:[~2023-07-26 11:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-26 10:06 [PATCH -next] drm/bridge: fix -Wunused-const-variable= warning Zhu Wang
2023-07-26 10:54 ` Uwe Kleine-König
2023-07-26 11:30   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®