lkml.org 
[lkml]   [2017]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/3] regmap: Add OneWire (W1) bus support
From
Date
29.05.17 16:13, Mark Brown пишет:

>> + int ret = -ENODEV;
>> +
>> + mutex_lock(&sl->master->bus_mutex);
>> + if (!w1_reset_select_slave(sl)) {
>> + w1_write_8(sl->master, W1_CMD_READ_DATA);
>> + w1_write_8(sl->master, reg);
>> + *val = w1_read_8(sl->master);
>> + ret = 0;
>> + }
> I asked you to move the error handling into the else case in these :(
Why do you want to see exactly the construction of if/else?

I already wrote that for me this will worsen the quality and
understanding of the code. And another point - in fact it is not an
error handler. This is a completely normal and permissible situation.
There is no "disconnect" event for this bus, and consequently at any
arbitrary time the kernel can not be sure that the device is still
available.

My ret = -ENODEV is exactly about this.

I can see this pattern in other kernel place, like:
drivers/usb/musb/da8xx.c line 374
drivers/usb/musb/davinci.c line 381
drivers/usb/host/xhci-mtk.c line 531
and many other palces.

\
 
 \ /
  Last update: 2017-05-29 18:39    [W:0.056 / U:0.576 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site