Skip to contentSkip to conversation

drm/mipi-dbi: hide unused mipi_dbi_dcs_read_commands array

PATCH Applied Arnd Bergmann 2 participants 3 messages Nov 11 – Nov 25

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

PATCH 1/1 drm/mipi-dbi: hide unused mipi_dbi_dcs_read_commands array

From: Arnd Bergmann <[email protected]>

When -Wunused-const-variable is enabled and SPI is turned off, gcc warns about this array being unused but defined locally:

drivers/gpu/drm/drm_mipi_dbi.c:79:17: error: 'mipi_dbi_dcs_read_commands' defined but not used [-Werror=unused-const-variable=]

   79 | static const u8 mipi_dbi_dcs_read_commands[] = {
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~

Move it into the block that actually uses it.

---
 drivers/gpu/drm/drm_mipi_dbi.c | 48 +++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 24 deletions(-)
drivers/gpu/drm/drm_mipi_dbi.c +24 -24
index 25cf04d029f7..1583f7248573 100644
@@ -76,30 +76,6 @@
 		DRM_DEBUG_DRIVER("cmd=%02x, len=%zu\n", cmd, len); \
 })
 
-static const u8 mipi_dbi_dcs_read_commands[] = {
-	MIPI_DCS_GET_DISPLAY_ID,
-	MIPI_DCS_GET_RED_CHANNEL,
-	MIPI_DCS_GET_GREEN_CHANNEL,
-	MIPI_DCS_GET_BLUE_CHANNEL,
-	MIPI_DCS_GET_DISPLAY_STATUS,
-	MIPI_DCS_GET_POWER_MODE,
-	MIPI_DCS_GET_ADDRESS_MODE,
-	MIPI_DCS_GET_PIXEL_FORMAT,
-	MIPI_DCS_GET_DISPLAY_MODE,
-	MIPI_DCS_GET_SIGNAL_MODE,
-	MIPI_DCS_GET_DIAGNOSTIC_RESULT,
-	MIPI_DCS_READ_MEMORY_START,
-	MIPI_DCS_READ_MEMORY_CONTINUE,
-	MIPI_DCS_GET_SCANLINE,
-	MIPI_DCS_GET_DISPLAY_BRIGHTNESS,
-	MIPI_DCS_GET_CONTROL_DISPLAY,
-	MIPI_DCS_GET_POWER_SAVE,
-	MIPI_DCS_GET_CABC_MIN_BRIGHTNESS,
-	MIPI_DCS_READ_DDB_START,
-	MIPI_DCS_READ_DDB_CONTINUE,
-	0, /* sentinel */
-};
-
 static bool mipi_dbi_command_is_read(struct mipi_dbi *dbi, u8 cmd)
 {
 	unsigned int i;
@@ -1096,6 +1072,30 @@ static int mipi_dbi_typec3_command(struct mipi_dbi *dbi, u8 *cmd,
 	return ret;
 }
 
+static const u8 mipi_dbi_dcs_read_commands[] = {
+	MIPI_DCS_GET_DISPLAY_ID,
+	MIPI_DCS_GET_RED_CHANNEL,
+	MIPI_DCS_GET_GREEN_CHANNEL,
+	MIPI_DCS_GET_BLUE_CHANNEL,
+	MIPI_DCS_GET_DISPLAY_STATUS,
+	MIPI_DCS_GET_POWER_MODE,
+	MIPI_DCS_GET_ADDRESS_MODE,
+	MIPI_DCS_GET_PIXEL_FORMAT,
+	MIPI_DCS_GET_DISPLAY_MODE,
+	MIPI_DCS_GET_SIGNAL_MODE,
+	MIPI_DCS_GET_DIAGNOSTIC_RESULT,
+	MIPI_DCS_READ_MEMORY_START,
+	MIPI_DCS_READ_MEMORY_CONTINUE,
+	MIPI_DCS_GET_SCANLINE,
+	MIPI_DCS_GET_DISPLAY_BRIGHTNESS,
+	MIPI_DCS_GET_CONTROL_DISPLAY,
+	MIPI_DCS_GET_POWER_SAVE,
+	MIPI_DCS_GET_CABC_MIN_BRIGHTNESS,
+	MIPI_DCS_READ_DDB_START,
+	MIPI_DCS_READ_DDB_CONTINUE,
+	0, /* sentinel */
+};
+
 /**
  * mipi_dbi_spi_init - Initialize MIPI DBI SPI interface
  * @spi: SPI device
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

When -Wunused-const-variable is enabled and SPI is turned off, gcc warns about this array being unused but defined locally:

Quoted 7 lines

drivers/gpu/drm/drm_mipi_dbi.c:79:17: error: 'mipi_dbi_dcs_read_commands' defined but not used [-Werror=unused-const-variable=]

   79 | static const u8 mipi_dbi_dcs_read_commands[] = {
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~

Move it into the block that actually uses it.

Could even be moved inside the only function using it.

Anyway:

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#2 lore raw
In reply to Arnd Bergmann
Quoted 8 lines · Arnd Bergmann

When -Wunused-const-variable is enabled and SPI is turned off, gcc warns about this array being unused but defined locally:

drivers/gpu/drm/drm_mipi_dbi.c:79:17: error: 'mipi_dbi_dcs_read_commands' defined but not used [-Werror=unused-const-variable=]

   79 | static const u8 mipi_dbi_dcs_read_commands[] = {
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~

[...]

Applied, thanks!

[1/1] drm/mipi-dbi: hide unused mipi_dbi_dcs_read_commands array

      commit: 75f3faa2835c9bf588caeedabc10d5676aa01f79

Best regards,

Signature · 3 lines
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com