All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emil Velikov <emil.l.velikov@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	emil.l.velikov@gmail.com, Sam Ravnborg <sam@ravnborg.org>
Subject: [PATCH 2/3] drm/panel: use mipi_dsi_dcs_write_buffer where possible
Date: Tue,  5 May 2020 17:03:28 +0100	[thread overview]
Message-ID: <20200505160329.2976059-2-emil.l.velikov@gmail.com> (raw)
In-Reply-To: <20200505160329.2976059-1-emil.l.velikov@gmail.com>

From: Emil Velikov <emil.velikov@collabora.com>

A few of the new panels create a local macro wrapping around
mipi_dsi_dcs_write. At the same time, they don't really care about the
command/payload split.

mipi_dsi_dcs_write does a kmalloc/memcpy/kfree for payload > 7 bytes.
kmalloc - avoid that all together by using the _buffer function.

Aside:
panel-xinpeng-xpp055c272.c calls its wrapper "generic" although it
should be "dcs". But that for another day/patch.

Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
---
 drivers/gpu/drm/panel/panel-elida-kd35t133.c       | 4 ++--
 drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c | 4 ++--
 drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c   | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index 711ded453c44..00e3d67af812 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -52,9 +52,9 @@ static inline struct kd35t133 *panel_to_kd35t133(struct drm_panel *panel)
 }
 
 #define dsi_dcs_write_seq(dsi, cmd, seq...) do {			\
-		static const u8 d[] = { seq };				\
+		static const u8 b[] = { cmd, seq };			\
 		int ret;						\
-		ret = mipi_dsi_dcs_write(dsi, cmd, d, ARRAY_SIZE(d));	\
+		ret = mipi_dsi_dcs_write_buffer(dsi, b, ARRAY_SIZE(b));	\
 		if (ret < 0)						\
 			return ret;					\
 	} while (0)
diff --git a/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c b/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
index 5a7a31c8513e..eaa9da3ebbea 100644
--- a/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
+++ b/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
@@ -246,9 +246,9 @@ struct ltk050h3146w *panel_to_ltk050h3146w(struct drm_panel *panel)
 }
 
 #define dsi_dcs_write_seq(dsi, cmd, seq...) do {			\
-		static const u8 d[] = { seq };				\
+		static const u8 b[] = { cmd, seq };			\
 		int ret;						\
-		ret = mipi_dsi_dcs_write(dsi, cmd, d, ARRAY_SIZE(d));	\
+		ret = mipi_dsi_dcs_write_buffer(dsi, b, ARRAY_SIZE(b));	\
 		if (ret < 0)						\
 			return ret;					\
 	} while (0)
diff --git a/drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c b/drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c
index 1645aceab597..9e07d7e86807 100644
--- a/drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c
+++ b/drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c
@@ -62,9 +62,9 @@ static inline struct xpp055c272 *panel_to_xpp055c272(struct drm_panel *panel)
 }
 
 #define dsi_generic_write_seq(dsi, cmd, seq...) do {			\
-		static const u8 d[] = { seq };				\
+		static const u8 b[] = { cmd, seq };			\
 		int ret;						\
-		ret = mipi_dsi_dcs_write(dsi, cmd, d, ARRAY_SIZE(d));	\
+		ret = mipi_dsi_dcs_write_buffer(dsi, b, ARRAY_SIZE(b));	\
 		if (ret < 0)						\
 			return ret;					\
 	} while (0)
-- 
2.25.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2020-05-05 16:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-05 16:03 [PATCH 1/3] drm/dsi: use stack buffer in mipi_dsi_dcs_write() Emil Velikov
2020-05-05 16:03 ` Emil Velikov [this message]
2020-05-11 11:28   ` [PATCH 2/3] drm/panel: use mipi_dsi_dcs_write_buffer where possible Emil Velikov
2020-06-29  7:46     ` Sam Ravnborg
2020-05-05 16:03 ` [PATCH 3/3] drm/mipi: use dcs write for mipi_dsi_dcs_set_tear_scanline Emil Velikov
2020-05-07 12:29   ` Vinay Simha B N
2020-05-07 16:18     ` Emil Velikov
2020-05-13  9:44       ` Emil Velikov
2020-06-07 16:17         ` Vinay Simha B N
2020-06-05 17:36   ` Thierry Reding
2020-06-29  7:47   ` Sam Ravnborg
2020-05-28 16:47 ` [PATCH 1/3] drm/dsi: use stack buffer in mipi_dsi_dcs_write() Emil Velikov
2020-06-05 17:37   ` Thierry Reding
2020-06-05 17:26 ` Thierry Reding
2020-06-29  7:46 ` Sam Ravnborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200505160329.2976059-2-emil.l.velikov@gmail.com \
    --to=emil.l.velikov@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko.stuebner@theobroma-systems.com \
    --cc=sam@ravnborg.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.