Re: [PATCH 1/4] drm/dsi: Make mipi_dsi_dcs_write() return ssize_t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux