aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2018-10-21 17:00:02 +0100
committerMark Brown <broonie@kernel.org>2018-10-21 17:00:02 +0100
commit4fd1f509e89f0e8ea28b1baa41d314636ae2064e (patch)
treeb9bb0e99bc91404e8d2709b8a5acdbefdab27bb2 /drivers/gpio
parentLinux 4.19-rc8 (diff)
parentregulator: lochnagar: Use a consisent comment style for SPDX header (diff)
downloadlinux-dev-4fd1f509e89f0e8ea28b1baa41d314636ae2064e.tar.xz
linux-dev-4fd1f509e89f0e8ea28b1baa41d314636ae2064e.zip
Merge branch 'regulator-4.20' into regulator-next
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpiolib.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 25187403e3ac..db1f4b2b092d 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -3909,8 +3909,23 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
* the device name as label
*/
status = gpiod_request(desc, con_id ? con_id : devname);
- if (status < 0)
- return ERR_PTR(status);
+ if (status < 0) {
+ if (status == -EBUSY && flags & GPIOD_FLAGS_BIT_NONEXCLUSIVE) {
+ /*
+ * This happens when there are several consumers for
+ * the same GPIO line: we just return here without
+ * further initialization. It is a bit if a hack.
+ * This is necessary to support fixed regulators.
+ *
+ * FIXME: Make this more sane and safe.
+ */
+ dev_info(dev, "nonexclusive access to GPIO for %s\n",
+ con_id ? con_id : devname);
+ return desc;
+ } else {
+ return ERR_PTR(status);
+ }
+ }
status = gpiod_configure_flags(desc, con_id, lookupflags, flags);
if (status < 0) {