public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Philippe CORNU <philippe.cornu@st.com>
To: Brian Norris <briannorris@chromium.org>
Cc: Archit Taneja <architt@codeaurora.org>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	David Airlie <airlied@linux.ie>,
	Benjamin Gaignard <benjamin.gaignard@linaro.org>,
	Bhumika Goyal <bhumirks@gmail.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"Linux Kernel" <linux-kernel@vger.kernel.org>,
	Sandy Huang <hjc@rock-chips.com>, Heiko Stubner <heiko@sntech.de>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>,
	Yannick FERTRE <yannick.fertre@st.com>,
	Vincent ABRIOU <vincent.abriou@st.com>,
	Alexandre TORGUE <alexandre.torgue@st.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Ludovic BARRE <ludovic.barre@st.com>,
	Mickael REULIER <mickael.reulier@st.com>
Subject: Re: [PATCH v1 2/2] drm/bridge/synopsys: dsi: Add a warning msg on dsi read operations
Date: Wed, 24 Jan 2018 13:22:04 +0000	[thread overview]
Message-ID: <369181f6-1bb4-0559-86c9-5528be7fc459@st.com> (raw)
In-Reply-To: <CA+ASDXPJ9uPDwRhP2WbazjeT6o=6L0ttffWXjwjkD3KxB+1cuQ@mail.gmail.com>

Hi Brian,


On 01/23/2018 10:28 PM, Brian Norris wrote:
> Hi Philippe,
> 
> I see you sent this out already today, while I only just responded
> (late) to your questions about it... oh well :)
> 

I got a short period to clean-up and adds features to this driver (1.31 
ip version + maybe the read feature), sorry to have not wait a single 
day more.

> On Tue, Jan 23, 2018 at 6:26 AM, Philippe Cornu <philippe.cornu@st.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@st.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.
> 

Many thanks for your review.

I agree with your comments.

Well, my patch is not good at all because it contains a small part of 
the read feature I am writing... but it is not the purpose of this patch.

No excuse, sorry guys for making you waste time.

I will re-write a new patch 100% decorrelated from a possible future 
read feature.

I could also wait until I have a working read feature but as it could 
take some times, I prefer warning users asap.

>> +               /* 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.
> 

not easy to pick the right one. I will use -EINVAL.

>> +
> 
> Spurious blank line?
> 
thanks

>> +       } 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
> 

The else part is linked to my "read feature" too, sorry for that. I will 
do it simpler in next version.

Thank you,
Philippe :-)

>>
>>          return nb_bytes;
>>   }
>> --
>> 2.15.1
>>

  reply	other threads:[~2018-01-24 13:22 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
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 [this message]
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=369181f6-1bb4-0559-86c9-5528be7fc459@st.com \
    --to=philippe.cornu@st.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=airlied@linux.ie \
    --cc=alexandre.torgue@st.com \
    --cc=architt@codeaurora.org \
    --cc=benjamin.gaignard@linaro.org \
    --cc=bhumirks@gmail.com \
    --cc=briannorris@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --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