From: Brian Norris <briannorris@chromium.org>
To: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: Caesar Wang <wxt@rock-chips.com>, Jiri Kosina <jikos@kernel.org>,
linux-rockchip@lists.infradead.org, dbasehore@chromium.org,
Douglas Anderson <dianders@chromium.org>,
Heiko Stuebner <heiko@sntech.de>,
linux-input@vger.kernel.org,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Dmitry Torokhov <dtor@chromium.org>,
Benson Leung <bleung@chromium.org>,
Guohua Zhong <ghzhong@yifangdigital.com>,
"Zhonghui\"" <zhonghui.fu@linux.intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] HID: i2c-hid: support the regulator
Date: Wed, 14 Sep 2016 16:02:42 +0800 [thread overview]
Message-ID: <20160914080241.GA14576@localhost> (raw)
In-Reply-To: <20160914075505.GA14271@localhost>
On Wed, Sep 14, 2016 at 03:55:05PM +0800, Brian Norris wrote:
> The default behavior of regulator_get() is to provide a dummy regulator
> if none is found. So the pointer is never NULL, and it won't break
> devices without a regulator. If you don't want a dummy regulator you
> would use regulator_get_optional() instead, and you would then need to
> handle ERR_PTR(-ENODEV) specifically.
One caveat to the never-NULL comment above that I just noticed:
If CONFIG_REGULATOR=n, then regulator_get() actually returns NULL (see
include/linux/regulator/consumer.h), but it also specifically has a
comment right next to that NULL return, saying:
/* Nothing except the stubbed out regulator API should be
* looking at the value except to check if it is an error
* value. Drivers are free to handle NULL specifically by
* skipping all regulator API calls, but they don't have to.
* Drivers which don't, should make sure they properly handle
* corner cases of the API, such as regulator_get_voltage()
* returning 0.
*/
So, we still don't need to handle the NULL case specially.
Brian
next prev parent reply other threads:[~2016-09-14 8:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-04 22:11 [PATCH 1/2] dt-bindings: add the regulator optional properties Caesar Wang
[not found] ` <1473027116-13892-1-git-send-email-wxt-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-09-04 22:11 ` [PATCH 2/2] HID: i2c-hid: support the regulator Caesar Wang
2016-09-14 7:36 ` Benjamin Tissoires
[not found] ` <20160914073603.GH25951-/m+UfqrgI5QNLKR9yMNcA1aTQe2KTcn/@public.gmane.org>
2016-09-14 7:55 ` Brian Norris
2016-09-14 8:02 ` Brian Norris [this message]
2016-09-14 14:31 ` Benjamin Tissoires
2016-09-12 16:16 ` [PATCH 1/2] dt-bindings: add the regulator optional properties Rob Herring
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=20160914080241.GA14576@localhost \
--to=briannorris@chromium.org \
--cc=benjamin.tissoires@redhat.com \
--cc=bleung@chromium.org \
--cc=dbasehore@chromium.org \
--cc=dianders@chromium.org \
--cc=dtor@chromium.org \
--cc=ghzhong@yifangdigital.com \
--cc=heiko@sntech.de \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mika.westerberg@linux.intel.com \
--cc=wxt@rock-chips.com \
--cc=zhonghui.fu@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).