]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit8b068e5196fbff8ad88602398deec5cfb68a12f0
treece072b8f8f8bac2520a923beded354992bed848c
parentdd8a16cea24d9b8de53fec17e63faed47cfa7f8a
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: 9b516d1bfb0d ("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