From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933711AbeAXNeR (ORCPT ); Wed, 24 Jan 2018 08:34:17 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:40473 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933556AbeAXNeP (ORCPT ); Wed, 24 Jan 2018 08:34:15 -0500 From: Philippe CORNU To: Brian Norris CC: "linux-arm-kernel@lists.infradead.org" , Maxime Coquelin , "open list:ARM/Rockchip SoC..." , David Airlie , "Linux Kernel" , "dri-devel@lists.freedesktop.org" , Yannick FERTRE , Laurent Pinchart , Ludovic BARRE , Mickael REULIER , "Vincent ABRIOU" , Bhumika Goyal , "Alexandre TORGUE" Subject: Re: [PATCH v1 1/2] drm/bridge/synopsys: dsi: Fix dsi_host_transfer() return value Thread-Topic: [PATCH v1 1/2] drm/bridge/synopsys: dsi: Fix dsi_host_transfer() return value Thread-Index: AQHTlFYl7W7gFAZQ7EWhT4Y8DwRFuaOB64+AgAEK8wA= Date: Wed, 24 Jan 2018 13:33:54 +0000 Message-ID: <4a1b0208-3187-2f08-69fe-ca3b77ee88a8@st.com> References: <20180123142618.28384-1-philippe.cornu@st.com> <20180123142618.28384-2-philippe.cornu@st.com> In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.75.127.45] Content-Type: text/plain; charset="utf-8" Content-ID: <644CBF932DDAC04788F95DF19A191F58@st.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-24_06:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id w0ODYMvX007812 Hi Brian, And many thanks for your review. On 01/23/2018 10:38 PM, Brian Norris wrote: > Hi Philippe, > > On Tue, Jan 23, 2018 at 6:26 AM, Philippe Cornu 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. > Not sure to follow you here: mipi_dsi_generic_read() will trig a dsi generic read so it has to return "the number of bytes received for read packets" as explained for the ->transfer() function... so it looks "coherent"... But maybe you want to point out something different? > 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... > The main reason why I want to "fix" this is because I do not want to explain to our customers (writing dsi panel drivers) why we have a different returned value compare to other platforms : ) >> 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 > Thanks, I agree, I will write & send a simpler version. Philippe :-) >> >> Signed-off-by: Philippe Cornu >> --- >> 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 >> > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel >