All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrzej Hajda <a.hajda@samsung.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/4] drm/dsi: Make mipi_dsi_dcs_write() return ssize_t
Date: Wed, 23 Jul 2014 10:18:21 +0200	[thread overview]
Message-ID: <53CF6FCD.9080805@samsung.com> (raw)
In-Reply-To: <20140723072743.GD15759@ulmo.nvidia.com>

On 07/23/2014 09:27 AM, Thierry Reding wrote:
> On Tue, Jul 22, 2014 at 12:23:07PM +0200, Andrzej Hajda wrote:
>> Hi Thierry,
>>
>> YoungJun's comment refreshed my memory about mipi_dsi_dcs_write return
>> value. It should be rather int than ssize_t. Why?
>> .transfer() returns the number of read bytes or error, but in case
>> of dcs write no bytes are read, so it in fact returns error or 0.
>> This is why return value was implemented originally as int.
>> So I do not think this patch is necessary.
> I think it should return the number of bytes written or an error. That
> way we give callers the maximum amount of information. They may still
> choose to only handle < 0 for convenience, but at least the information
> will be there should it become required at some point.

AFAIK DSI write operation is atomic, ie either all requested bytes have
been sent
either there was an error and in such case we should assume no byte have
been sent.
Returning number of written bytes in this case is just returning length
of write buffer -
something caller already knows. Additionally it suggests that partial
write is possible
which is not true.
I know it is implemented such way in i2c (which is non atomic) but the
comment
in i2c_transfer shows its weakness [1].

[1]: http://lxr.free-electrons.com/source/drivers/i2c/i2c-core.c#L1782

Regards
Andrzej

>
> Thierry

      reply	other threads:[~2014-07-23  8:18 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-22  7:12 [PATCH 1/4] drm/dsi: Make mipi_dsi_dcs_write() return ssize_t Thierry Reding
2014-07-22  7:12 ` [PATCH 2/4] drm/dsi: Use peripheral's channel for DCS commands Thierry Reding
2014-07-22  7:30   ` Andrzej Hajda
2014-07-22  7:12 ` [PATCH 3/4] drm/dsi: Make mipi_dsi_dcs_{read,write}() symmetrical Thierry Reding
2014-07-22  7:32   ` [PATCH 3/4] drm/dsi: Make mipi_dsi_dcs_{read, write}() symmetrical Andrzej Hajda
2014-07-22  8:12     ` Thierry Reding
2014-07-22  9:33       ` Andrzej Hajda
2014-07-23  7:51         ` Thierry Reding
2014-07-23 10:59           ` Andrzej Hajda
2014-07-23 13:37             ` Thierry Reding
2014-07-24  7:57               ` Andrzej Hajda
2014-07-24  9:31                 ` Thierry Reding
2014-07-22 11:20   ` Daniel Vetter
2014-07-23  6:32     ` Andrzej Hajda
2014-07-22  7:12 ` [PATCH 4/4] drm/panel: s6e8aa0: Use static inline for upcasting Thierry Reding
2014-07-22  7:33   ` Andrzej Hajda
2014-07-22  7:28 ` [PATCH 1/4] drm/dsi: Make mipi_dsi_dcs_write() return ssize_t Andrzej Hajda
2014-07-22  9:50   ` YoungJun Cho
2014-07-22 10:05     ` Andrzej Hajda
2014-07-22 10:23       ` Andrzej Hajda
2014-07-23  7:27         ` Thierry Reding
2014-07-23  8:18           ` Andrzej Hajda [this message]

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=53CF6FCD.9080805@samsung.com \
    --to=a.hajda@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=thierry.reding@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.