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.

Signed-off-by: Arnd Bergmann <[email protected]>
---
 drivers/gpu/drm/drm_mipi_dbi.c | 48 +++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
index 25cf04d029f7..1583f7248573 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -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
-- 
2.53.0

Reply via email to