diff options
author | Mark Brown <broonie@kernel.org> | 2018-10-21 19:00:02 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-10-21 19:00:02 +0300 |
commit | 4fd1f509e89f0e8ea28b1baa41d314636ae2064e (patch) | |
tree | b9bb0e99bc91404e8d2709b8a5acdbefdab27bb2 /drivers/gpio/gpiolib.c | |
parent | 35a7f35ad1b150ddf59a41dcac7b2fa32982be0e (diff) | |
parent | d8b2a8e9c06bc389659716e81d1c2b1f147611d1 (diff) | |
download | linux-4fd1f509e89f0e8ea28b1baa41d314636ae2064e.tar.xz |
Merge branch 'regulator-4.20' into regulator-next
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r-- | drivers/gpio/gpiolib.c | 19 |
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) { |