From: "Alex A. Mihaylov" <minimumlaw@rambler.ru>
To: Mark Brown <broonie@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sebastian Reichel <sre@kernel.org>,
Evgeniy Polyakov <zbr@ioremap.net>,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH 1/3] regmap: Add OneWire (W1) bus support
Date: Mon, 29 May 2017 19:37:58 +0300 [thread overview]
Message-ID: <f4efbd7b-6b65-1344-dc36-8695d1d451e8@rambler.ru> (raw)
In-Reply-To: <20170529131346.gsauzllpplc2e7vy@sirena.org.uk>
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.
next prev parent reply other threads:[~2017-05-29 16:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-28 7:11 [PATCH 0/3] Battery monitor MAX1721x with w1-regmap and w1-slave Alex A. Mihaylov
2017-05-28 7:11 ` [PATCH 1/3] regmap: Add OneWire (W1) bus support Alex A. Mihaylov
2017-05-29 13:13 ` Mark Brown
2017-05-29 16:37 ` Alex A. Mihaylov [this message]
2017-05-30 11:50 ` Mark Brown
2017-05-29 15:07 ` Geert Uytterhoeven
2017-05-28 7:11 ` [PATCH 2/3] w1: Add Maxim Semiconductor MAX1721x W1 slave drivers Alex A. Mihaylov
2017-05-28 7:11 ` [PATCH 3/3] power: supply: Add support MAX1721x battery monitor Alex A. Mihaylov
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=f4efbd7b-6b65-1344-dc36-8695d1d451e8@rambler.ru \
--to=minimumlaw@rambler.ru \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=sre@kernel.org \
--cc=zbr@ioremap.net \
/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