diff mbox

[04/15] drm/panel: s6e8aa0: Use standard MIPI DSI function

Message ID 1413195395-3355-4-git-send-email-thierry.reding@gmail.com (mailing list archive)
State Superseded
Headers show

Commit Message

Thierry Reding Oct. 13, 2014, 10:16 a.m. UTC
From: Thierry Reding <treding@nvidia.com>

Use the newly introduced mipi_dsi_set_maximum_return_packet_size()
function to replace an open-coded version.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpu/drm/panel/panel-s6e8aa0.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

Comments

Andrzej Hajda Oct. 13, 2014, 2:13 p.m. UTC | #1
On 10/13/2014 12:16 PM, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> Use the newly introduced mipi_dsi_set_maximum_return_packet_size()
> function to replace an open-coded version.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>  drivers/gpu/drm/panel/panel-s6e8aa0.c | 16 ++--------------
>  1 file changed, 2 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-s6e8aa0.c b/drivers/gpu/drm/panel/panel-s6e8aa0.c
> index 0f85a7c37687..c31e2953f290 100644
> --- a/drivers/gpu/drm/panel/panel-s6e8aa0.c
> +++ b/drivers/gpu/drm/panel/panel-s6e8aa0.c
> @@ -800,27 +800,15 @@ static void s6e8aa0_panel_init(struct s6e8aa0 *ctx)
>  }
>  
>  static void s6e8aa0_set_maximum_return_packet_size(struct s6e8aa0 *ctx,
> -						   int size)
> +						   u16 size)


I guess this whole function should be removed and direct call to
mipi_dsi_set_maximum_return_packet_size should be used.

Regards
Andrzej


>  {
>  	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
> -	const struct mipi_dsi_host_ops *ops = dsi->host->ops;
> -	u8 buf[] = {size, 0};
> -	struct mipi_dsi_msg msg = {
> -		.channel = dsi->channel,
> -		.type = MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE,
> -		.tx_len = sizeof(buf),
> -		.tx_buf = buf
> -	};
>  	int ret;
>  
>  	if (ctx->error < 0)
>  		return;
>  
> -	if (!ops || !ops->transfer)
> -		ret = -EIO;
> -	else
> -		ret = ops->transfer(dsi->host, &msg);
> -
> +	ret = mipi_dsi_set_maximum_return_packet_size(dsi, size);
>  	if (ret < 0) {
>  		dev_err(ctx->dev,
>  			"error %d setting maximum return packet size to %d\n",
>
Thierry Reding Oct. 14, 2014, 9:46 a.m. UTC | #2
On Mon, Oct 13, 2014 at 04:13:16PM +0200, Andrzej Hajda wrote:
> On 10/13/2014 12:16 PM, Thierry Reding wrote:
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > Use the newly introduced mipi_dsi_set_maximum_return_packet_size()
> > function to replace an open-coded version.
> > 
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > ---
> >  drivers/gpu/drm/panel/panel-s6e8aa0.c | 16 ++--------------
> >  1 file changed, 2 insertions(+), 14 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/panel/panel-s6e8aa0.c b/drivers/gpu/drm/panel/panel-s6e8aa0.c
> > index 0f85a7c37687..c31e2953f290 100644
> > --- a/drivers/gpu/drm/panel/panel-s6e8aa0.c
> > +++ b/drivers/gpu/drm/panel/panel-s6e8aa0.c
> > @@ -800,27 +800,15 @@ static void s6e8aa0_panel_init(struct s6e8aa0 *ctx)
> >  }
> >  
> >  static void s6e8aa0_set_maximum_return_packet_size(struct s6e8aa0 *ctx,
> > -						   int size)
> > +						   u16 size)
> 
> 
> I guess this whole function should be removed and direct call to
> mipi_dsi_set_maximum_return_packet_size should be used.

There's additional error handling logic in this function which would
have needed extra untangling. Since I don't have the hardware to test
this change I kept it to a minimum possible to reduce the risk of
accidentally breaking anything.

Feel free to send a follow-on patch cleaning this up as you see fit.

Thierry
diff mbox

Patch

diff --git a/drivers/gpu/drm/panel/panel-s6e8aa0.c b/drivers/gpu/drm/panel/panel-s6e8aa0.c
index 0f85a7c37687..c31e2953f290 100644
--- a/drivers/gpu/drm/panel/panel-s6e8aa0.c
+++ b/drivers/gpu/drm/panel/panel-s6e8aa0.c
@@ -800,27 +800,15 @@  static void s6e8aa0_panel_init(struct s6e8aa0 *ctx)
 }
 
 static void s6e8aa0_set_maximum_return_packet_size(struct s6e8aa0 *ctx,
-						   int size)
+						   u16 size)
 {
 	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
-	const struct mipi_dsi_host_ops *ops = dsi->host->ops;
-	u8 buf[] = {size, 0};
-	struct mipi_dsi_msg msg = {
-		.channel = dsi->channel,
-		.type = MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE,
-		.tx_len = sizeof(buf),
-		.tx_buf = buf
-	};
 	int ret;
 
 	if (ctx->error < 0)
 		return;
 
-	if (!ops || !ops->transfer)
-		ret = -EIO;
-	else
-		ret = ops->transfer(dsi->host, &msg);
-
+	ret = mipi_dsi_set_maximum_return_packet_size(dsi, size);
 	if (ret < 0) {
 		dev_err(ctx->dev,
 			"error %d setting maximum return packet size to %d\n",