drm/mipi-dbi: Make mipi_dbi_command_stackbuf() data parameter const
authorGeert Uytterhoeven <geert+renesas@glider.be>
Mon, 16 Mar 2020 16:42:49 +0000 (17:42 +0100)
committerSam Ravnborg <sam@ravnborg.org>
Sat, 21 Mar 2020 20:17:29 +0000 (21:17 +0100)
mipi_dbi_command_stackbuf() copies the passed buffer data, so it can be
const.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200316164249.6234-1-geert+renesas@glider.be
drivers/gpu/drm/drm_mipi_dbi.c
include/drm/drm_mipi_dbi.h

index 113a767..ea929bc 100644 (file)
@@ -169,7 +169,8 @@ int mipi_dbi_command_buf(struct mipi_dbi *dbi, u8 cmd, u8 *data, size_t len)
 EXPORT_SYMBOL(mipi_dbi_command_buf);
 
 /* This should only be used by mipi_dbi_command() */
-int mipi_dbi_command_stackbuf(struct mipi_dbi *dbi, u8 cmd, u8 *data, size_t len)
+int mipi_dbi_command_stackbuf(struct mipi_dbi *dbi, u8 cmd, const u8 *data,
+                             size_t len)
 {
        u8 *buf;
        int ret;
index 30ebdfd..0ef0040 100644 (file)
@@ -170,7 +170,8 @@ int mipi_dbi_spi_transfer(struct spi_device *spi, u32 speed_hz,
 
 int mipi_dbi_command_read(struct mipi_dbi *dbi, u8 cmd, u8 *val);
 int mipi_dbi_command_buf(struct mipi_dbi *dbi, u8 cmd, u8 *data, size_t len);
-int mipi_dbi_command_stackbuf(struct mipi_dbi *dbi, u8 cmd, u8 *data, size_t len);
+int mipi_dbi_command_stackbuf(struct mipi_dbi *dbi, u8 cmd, const u8 *data,
+                             size_t len);
 int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
                      struct drm_rect *clip, bool swap);
 /**
@@ -187,7 +188,7 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
  */
 #define mipi_dbi_command(dbi, cmd, seq...) \
 ({ \
-       u8 d[] = { seq }; \
+       const u8 d[] = { seq }; \
        mipi_dbi_command_stackbuf(dbi, cmd, d, ARRAY_SIZE(d)); \
 })