[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+ASDXPJ9uPDwRhP2WbazjeT6o=6L0ttffWXjwjkD3KxB+1cuQ@mail.gmail.com>
Date: Tue, 23 Jan 2018 13:28:20 -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 2/2] drm/bridge/synopsys: dsi: Add a warning msg on dsi
read operations
Hi Philippe,
I see you sent this out already today, while I only just responded
(late) to your questions about it... oh well :)
On Tue, Jan 23, 2018 at 6:26 AM, Philippe Cornu <philippe.cornu@...com> wrote:
> The DCS/GENERIC DSI read feature is not yet implemented so it
> is important to warn the host_transfer() caller in case of
> read operation requests.
>
> Signed-off-by: Philippe Cornu <philippe.cornu@...com>
> ---
> drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> index 096cf5e5bb30..e46ddff8601c 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> @@ -417,7 +417,14 @@ static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host,
> if (ret)
> return ret;
>
> - nb_bytes = packet.size;
> + if (msg->rx_buf && msg->rx_len > 0) {
It feels like you should do this check *before* you start writing
anything. It's possible to have a combination TX/RX command, and it
would be counterintuitive to only do half the operation then return
with an argument error.
> + /* TODO dw drv improvements: implement read feature */
> + dev_warn(dsi->dev, "read operations not yet implemented\n");
> + return -EPERM;
I'm not sure -EPERM is right. Feels like -EINVAL, -ENOSYS, or
-EOPNOTSUPP. I think -ENOSYS actually has been abused somewhat, so
maybe one of the other two.
> +
Spurious blank line?
> + } else {
> + nb_bytes = packet.size;
> + }
You don't actually need to put this sort of thing in the 'else' case.
The other branch is an error-handling case, which definitely 'return's
early, and it's pretty standard coding style to avoid indenting the
"good" path like this.
Brian
>
> return nb_bytes;
> }
> --
> 2.15.1
>
Powered by blists - more mailing lists