gpio: devres: Handle nonexclusive GPIOs
authorLinus Walleij <linus.walleij@linaro.org>
Thu, 6 Dec 2018 12:43:45 +0000 (13:43 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 11 Dec 2018 01:04:17 +0000 (01:04 +0000)
commitcb28ee388e465a956b05ada682f9ef90e776a9b7
treece072b8f8f8bac2520a923beded354992bed848c
parentec757001c818c175e6b610e8ef80c2a25d1ed1a5
gpio: devres: Handle nonexclusive GPIOs

When we get a nonexeclusive GPIO descriptor using managed
resources, we should only add it to the list of managed
resources once: on the first user. Augment the
devm_gpiod_get_index() and devm_gpiod_get_from_of_node()
calls to account for this by checking if the descriptor
is already resource managed before we proceed to allocate
a new resource management struct.

Fixes: b0ce7b29bfcd ("regulator/gpio: Allow nonexclusive GPIO access")
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/gpio/gpiolib-devres.c