aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpio/gpiolib-devres.c
AgeCommit message (Collapse)AuthorFilesLines
2018-12-11gpio: Add devm_gpiod_unhinge()Linus Walleij1-0/+30
This adds a function named devm_gpiod_unhinge() that removes the resource management from a GPIO descriptor. I am not sure if this is the best anglosaxon name for the function, no other managed resources have an equivalent currently, but I chose "unhinge" as the closest intuitive thing I could imagine that fits Rusty Russell's API design criterions "the obvious use is the correct one" and "the name tells you how to use it". The idea came out of a remark from Mark Brown that it should be possible to handle over management of a resource from devres to the regulator core, and indeed we can do that. Signed-off-by: Linus Walleij <[email protected]> Reviewed-by: Marek Szyprowski <[email protected]> Tested-by: Marek Szyprowski <[email protected]> Reviewed-by: Charles Keepax <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2018-12-11gpio: devres: Handle nonexclusive GPIOsLinus Walleij1-12/+38
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 <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Reviewed-by: Marek Szyprowski <[email protected]> Tested-by: Marek Szyprowski <[email protected]> Reviewed-by: Charles Keepax <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2018-09-25gpio: Rename devres implementation fileLinus Walleij1-0/+439
All the other core files are named "gpiolib-<something>" so let's rename the devres as well so we have some logical namespacing here. Signed-off-by: Linus Walleij <[email protected]>