2023-05-31 08:21:27

by Lu Hongfei

[permalink] [raw]
Subject: [PATCH] gpu: drm/panel: Change the return value of s6d7aa0_lock to void

The return value of s6d7aa0_lock is meaningless,
it is better to modify it to void.
This patch fixes this issue and modifies the place
where s6d7aa0_lock is called.

Signed-off-by: Lu Hongfei <[email protected]>
---
drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c | 29 ++++---------------
1 file changed, 5 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
index 102e1fc7ee38..c5924e7b9e36
--- a/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
@@ -63,10 +63,9 @@ static void s6d7aa0_reset(struct s6d7aa0 *ctx)
msleep(50);
}

-static int s6d7aa0_lock(struct s6d7aa0 *ctx, bool lock)
+static void s6d7aa0_lock(struct s6d7aa0 *ctx, bool lock)
{
struct mipi_dsi_device *dsi = ctx->dsi;
- int ret = 0;

if (lock) {
mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD1, 0xa5, 0xa5);
@@ -79,8 +78,6 @@ static int s6d7aa0_lock(struct s6d7aa0 *ctx, bool lock)
if (ctx->desc->use_passwd3)
mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD3, 0xa5, 0xa5);
}
-
- return ret;
}

static int s6d7aa0_on(struct s6d7aa0 *ctx)
@@ -238,11 +235,7 @@ static int s6d7aa0_lsl080al02_init(struct s6d7aa0 *ctx)

usleep_range(20000, 25000);

- ret = s6d7aa0_lock(ctx, false);
- if (ret < 0) {
- dev_err(dev, "Failed to unlock registers: %d\n", ret);
- return ret;
- }
+ s6d7aa0_lock(ctx, false);

mipi_dsi_dcs_write_seq(dsi, MCS_OTP_RELOAD, 0x00, 0x10);
usleep_range(1000, 1500);
@@ -266,11 +259,7 @@ static int s6d7aa0_lsl080al02_init(struct s6d7aa0 *ctx)
msleep(120);
mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_SET_ADDRESS_MODE, 0x00);

- ret = s6d7aa0_lock(ctx, true);
- if (ret < 0) {
- dev_err(dev, "Failed to lock registers: %d\n", ret);
- return ret;
- }
+ s6d7aa0_lock(ctx, true);

ret = mipi_dsi_dcs_set_display_on(dsi);
if (ret < 0) {
@@ -327,11 +316,7 @@ static int s6d7aa0_lsl080al03_init(struct s6d7aa0 *ctx)

usleep_range(20000, 25000);

- ret = s6d7aa0_lock(ctx, false);
- if (ret < 0) {
- dev_err(dev, "Failed to unlock registers: %d\n", ret);
- return ret;
- }
+ s6d7aa0_lock(ctx, false);

if (ctx->desc->panel_type == S6D7AA0_PANEL_LSL080AL03) {
mipi_dsi_dcs_write_seq(dsi, MCS_BL_CTL, 0xc7, 0x00, 0x29);
@@ -370,11 +355,7 @@ static int s6d7aa0_lsl080al03_init(struct s6d7aa0 *ctx)
return ret;
}

- ret = s6d7aa0_lock(ctx, true);
- if (ret < 0) {
- dev_err(dev, "Failed to lock registers: %d\n", ret);
- return ret;
- }
+ s6d7aa0_lock(ctx, true);

ret = mipi_dsi_dcs_set_display_on(dsi);
if (ret < 0) {
--
2.39.0



2023-05-31 09:23:49

by Neil Armstrong

[permalink] [raw]
Subject: Re: [PATCH] gpu: drm/panel: Change the return value of s6d7aa0_lock to void

On 31/05/2023 09:37, Lu Hongfei wrote:
> The return value of s6d7aa0_lock is meaningless,

It is not, mipi_dsi_dcs_write_seq() can return an error value:

https://github.com/torvalds/linux/blob/master/include/drm/drm_mipi_dsi.h#L320

Neil

> it is better to modify it to void.
> This patch fixes this issue and modifies the place
> where s6d7aa0_lock is called.
>
> Signed-off-by: Lu Hongfei <[email protected]>
> ---
> drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c | 29 ++++---------------
> 1 file changed, 5 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
> index 102e1fc7ee38..c5924e7b9e36
> --- a/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
> @@ -63,10 +63,9 @@ static void s6d7aa0_reset(struct s6d7aa0 *ctx)
> msleep(50);
> }
>
> -static int s6d7aa0_lock(struct s6d7aa0 *ctx, bool lock)
> +static void s6d7aa0_lock(struct s6d7aa0 *ctx, bool lock)
> {
> struct mipi_dsi_device *dsi = ctx->dsi;
> - int ret = 0;
>
> if (lock) {
> mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD1, 0xa5, 0xa5);
> @@ -79,8 +78,6 @@ static int s6d7aa0_lock(struct s6d7aa0 *ctx, bool lock)
> if (ctx->desc->use_passwd3)
> mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD3, 0xa5, 0xa5);
> }
> -
> - return ret;
> }
>
> static int s6d7aa0_on(struct s6d7aa0 *ctx)
> @@ -238,11 +235,7 @@ static int s6d7aa0_lsl080al02_init(struct s6d7aa0 *ctx)
>
> usleep_range(20000, 25000);
>
> - ret = s6d7aa0_lock(ctx, false);
> - if (ret < 0) {
> - dev_err(dev, "Failed to unlock registers: %d\n", ret);
> - return ret;
> - }
> + s6d7aa0_lock(ctx, false);
>
> mipi_dsi_dcs_write_seq(dsi, MCS_OTP_RELOAD, 0x00, 0x10);
> usleep_range(1000, 1500);
> @@ -266,11 +259,7 @@ static int s6d7aa0_lsl080al02_init(struct s6d7aa0 *ctx)
> msleep(120);
> mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_SET_ADDRESS_MODE, 0x00);
>
> - ret = s6d7aa0_lock(ctx, true);
> - if (ret < 0) {
> - dev_err(dev, "Failed to lock registers: %d\n", ret);
> - return ret;
> - }
> + s6d7aa0_lock(ctx, true);
>
> ret = mipi_dsi_dcs_set_display_on(dsi);
> if (ret < 0) {
> @@ -327,11 +316,7 @@ static int s6d7aa0_lsl080al03_init(struct s6d7aa0 *ctx)
>
> usleep_range(20000, 25000);
>
> - ret = s6d7aa0_lock(ctx, false);
> - if (ret < 0) {
> - dev_err(dev, "Failed to unlock registers: %d\n", ret);
> - return ret;
> - }
> + s6d7aa0_lock(ctx, false);
>
> if (ctx->desc->panel_type == S6D7AA0_PANEL_LSL080AL03) {
> mipi_dsi_dcs_write_seq(dsi, MCS_BL_CTL, 0xc7, 0x00, 0x29);
> @@ -370,11 +355,7 @@ static int s6d7aa0_lsl080al03_init(struct s6d7aa0 *ctx)
> return ret;
> }
>
> - ret = s6d7aa0_lock(ctx, true);
> - if (ret < 0) {
> - dev_err(dev, "Failed to lock registers: %d\n", ret);
> - return ret;
> - }
> + s6d7aa0_lock(ctx, true);
>
> ret = mipi_dsi_dcs_set_display_on(dsi);
> if (ret < 0) {