[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+ASDXNDpmVdARLCD-A6nfADgmomuscpwekb8M-j=MFJhpeC4Q@mail.gmail.com>
Date: Tue, 23 Jan 2018 13:38:25 -0800
From: Brian Norris <briannorris@...omium.org>
To: Philippe Cornu <philippe.cornu@...com>
Cc: Archit Taneja <architt@...eaurora.org>,
Andrzej Hajda <a.hajda@...sung.com>,
Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
David Airlie <airlied@...ux.ie>,
Benjamin Gaignard <benjamin.gaignard@...aro.org>,
Bhumika Goyal <bhumirks@...il.com>,
dri-devel@...ts.freedesktop.org,
Linux Kernel <linux-kernel@...r.kernel.org>,
Sandy Huang <hjc@...k-chips.com>,
Heiko Stubner <heiko@...ech.de>,
linux-arm-kernel@...ts.infradead.org,
"open list:ARM/Rockchip SoC..." <linux-rockchip@...ts.infradead.org>,
Yannick Fertre <yannick.fertre@...com>,
Vincent Abriou <vincent.abriou@...com>,
Alexandre Torgue <alexandre.torgue@...com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Ludovic Barre <ludovic.barre@...com>,
Mickael Reulier <mickael.reulier@...com>
Subject: Re: [PATCH v1 1/2] drm/bridge/synopsys: dsi: Fix dsi_host_transfer()
return value
Hi Philippe,
On Tue, Jan 23, 2018 at 6:26 AM, Philippe Cornu <philippe.cornu@...com> wrote:
> The dw_mipi_dsi_host_transfer() must return the number of
> bytes transmitted/received on success instead of 0.
I'm a little confused. As of the latest drm-misc-next I'm looking at,
this still has conflicting documentation.
For ->transfer():
On success it shall return the number of bytes
* transmitted for write packets or the number of bytes received for read
* packets.
While mipi_dsi_generic_read() says:
* Return: The number of bytes successfully read or a negative error code on
* failure.
But it just returns the value that ->transfer() returns.
So I'm not sure whether the documentation is still wrong, or if the
implementation is.
Anyway, I guess maybe that isn't super-critical to *this* patch, since
we don't have RX support yet...
> Note: nb_bytes is introduced in this patch as it will be
> re-used with the future dcs/generic dsi read feature.
It feels like you could just wait to add that when you need it? It
really feels trivial and useless right now :)
Brian
>
> Signed-off-by: Philippe Cornu <philippe.cornu@...com>
> ---
> drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> index f458798af788..096cf5e5bb30 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> @@ -403,7 +403,7 @@ static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host,
> {
> struct dw_mipi_dsi *dsi = host_to_dsi(host);
> struct mipi_dsi_packet packet;
> - int ret;
> + int ret, nb_bytes;
>
> ret = mipi_dsi_create_packet(&packet, msg);
> if (ret) {
> @@ -413,7 +413,13 @@ static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host,
>
> dw_mipi_message_config(dsi, msg);
>
> - return dw_mipi_dsi_write(dsi, &packet);
> + ret = dw_mipi_dsi_write(dsi, &packet);
> + if (ret)
> + return ret;
> +
> + nb_bytes = packet.size;
> +
> + return nb_bytes;
> }
>
> static const struct mipi_dsi_host_ops dw_mipi_dsi_host_ops = {
> --
> 2.15.1
>
Powered by blists - more mailing lists