linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philippe CORNU <philippe.cornu@st.com>
To: Brian Norris <briannorris@chromium.org>
Cc: "linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>,
	David Airlie <airlied@linux.ie>,
	"Linux Kernel" <linux-kernel@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	Yannick FERTRE <yannick.fertre@st.com>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Ludovic BARRE <ludovic.barre@st.com>,
	Mickael REULIER <mickael.reulier@st.com>,
	"Vincent ABRIOU" <vincent.abriou@st.com>,
	Bhumika Goyal <bhumirks@gmail.com>,
	"Alexandre TORGUE" <alexandre.torgue@st.com>
Subject: Re: [PATCH v1 1/2] drm/bridge/synopsys: dsi: Fix dsi_host_transfer() return value
Date: Wed, 24 Jan 2018 13:33:54 +0000	[thread overview]
Message-ID: <4a1b0208-3187-2f08-69fe-ca3b77ee88a8@st.com> (raw)
In-Reply-To: <CA+ASDXNDpmVdARLCD-A6nfADgmomuscpwekb8M-j=MFJhpeC4Q@mail.gmail.com>

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 <philippe.cornu@st.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.
> 

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 <philippe.cornu@st.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
>>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

  reply	other threads:[~2018-01-24 13:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-23 14:26 [PATCH v1 0/2] drm/bridge/synopsys: dsi: Add fix & warning in dsi_host_transfer() Philippe Cornu
2018-01-23 14:26 ` [PATCH v1 1/2] drm/bridge/synopsys: dsi: Fix dsi_host_transfer() return value Philippe Cornu
2018-01-23 21:38   ` Brian Norris
2018-01-24 13:33     ` Philippe CORNU [this message]
2018-01-24 18:37       ` Brian Norris
2018-01-25 12:16         ` Andrzej Hajda
2018-01-25 22:51           ` Brian Norris
2018-01-23 14:26 ` [PATCH v1 2/2] drm/bridge/synopsys: dsi: Add a warning msg on dsi read operations Philippe Cornu
2018-01-23 21:28   ` Brian Norris
2018-01-24 13:22     ` Philippe CORNU
2018-01-24 18:14       ` Brian Norris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4a1b0208-3187-2f08-69fe-ca3b77ee88a8@st.com \
    --to=philippe.cornu@st.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@linux.ie \
    --cc=alexandre.torgue@st.com \
    --cc=bhumirks@gmail.com \
    --cc=briannorris@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=ludovic.barre@st.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mickael.reulier@st.com \
    --cc=vincent.abriou@st.com \
    --cc=yannick.fertre@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).