[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f4efbd7b-6b65-1344-dc36-8695d1d451e8@rambler.ru>
Date: Mon, 29 May 2017 19:37:58 +0300
From: "Alex A. Mihaylov" <minimumlaw@...bler.ru>
To: Mark Brown <broonie@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Sebastian Reichel <sre@...nel.org>,
Evgeniy Polyakov <zbr@...emap.net>,
linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org
Subject: Re: [PATCH 1/3] regmap: Add OneWire (W1) bus support
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.
Powered by blists - more mailing lists