summaryrefslogtreecommitdiff
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
parent35a7f35ad1b150ddf59a41dcac7b2fa32982be0e (diff)
parentd8b2a8e9c06bc389659716e81d1c2b1f147611d1 (diff)
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) {