Message ID | 20181206124351.10155-1-linus.walleij@linaro.org |
---|---|
Headers | show |
Series | Regulator ena_gpiod fixups | expand |
Hi Linus, On 2018-12-06 13:43, Linus Walleij wrote: > Here is a fourth iteration of these fixups after fixing > the (hopefullt last) bugs found in the v3 version. > > Also available in git branch > gpio-descriptors-regulator-fixup in the GPIO git tree: > https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/log/?h=gpio-descriptors-regulator-fixup > > I added two fixup item to the list: making the gpiod > from of node respect nonexlusive flags and fixing the > shared regulators in devm_gpiod_get*. Yeah! Finally it looks and works right. Feel free to add my: Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com> and Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> (to patches: 1-2, 5-10 and 13-15). One more thing - if I got everything right, gpiod_put() in *regulator_register() error path has to be removed also in wm8994-regulator.c and arizona-ldo1.c. > To make sure GPIO descriptors are never left dangling > (as far as I can tell!) I use this stepwise approach: > > 1. Fix the regulator_register() in the core to guarantee > that after calling this with a valid GPIO descriptor > in ena_gpiod it will be gpiod_put() if there is any > problem. > > 2. Fix up simple descriptor consumers to just gpiod_get() > and let the core take over the descriptor. Only handle > the errorpath up to this point. > > 3. Export gpiod_get_from_of_node() and let max77686 > obtain a GPIO descriptor from the device tree without > any devres make-up in the DT parsing callback. > > 4. Make gpiod_get_from_of_node() respect the > GPIOD_FLAGS_BIT_NONEXCLUSIVE flag. > > 5. Fix up devm_gpiod_get_* to respect the > GPIOD_FLAGS_BIT_NONEXCLUSIVE flag. > > 6. Invent devm_gpiod_unhinge() that will remove the devres > monitoring of a devm_* allocated GPIO descriptor > right before handling it over to the regulator core, > and use this in the otherwise hairy max8973, da9211, > s5m8767, tps65090 and s2mps11 drivers. > > > Linus Walleij (15): > regulator: core: Track dangling GPIO descriptors > regulator: fixed: Let core handle GPIO descriptor > regulator: lm363x: Let core handle GPIO descriptor > regulator: lp8788-ldo: Let core handle GPIO descriptor > regulator: max8952: Let core handle GPIO descriptor > gpio: Export gpiod_get_from_of_node() > regulator: max77686: Let core handle GPIO descriptor > gpio: Enable nonexclusive gpiods from DT nodes > gpio: devres: Handle nonexclusive GPIOs > gpio: Add devm_gpiod_unhinge() > regulator: max8973: Let core handle GPIO descriptor > regulator: da9211: Hand over GPIO to regulator core > regulator: s5m8767: Hand over GPIO to regulator core > regulator: tps65090: Hand over GPIO to regulator core > regulator: s2mps11: Hand over GPIO to regulator core > > Documentation/driver-model/devres.txt | 1 + > drivers/gpio/gpiolib-devres.c | 80 ++++++++++++++++++++++---- > drivers/gpio/gpiolib.c | 2 + > drivers/gpio/gpiolib.h | 6 -- > drivers/regulator/core.c | 55 ++++++++++++++---- > drivers/regulator/da9211-regulator.c | 6 ++ > drivers/regulator/fixed.c | 6 +- > drivers/regulator/lm363x-regulator.c | 8 ++- > drivers/regulator/lp8788-ldo.c | 8 ++- > drivers/regulator/max77686-regulator.c | 14 +++-- > drivers/regulator/max8952.c | 10 +++- > drivers/regulator/max8973-regulator.c | 8 ++- > drivers/regulator/s2mps11.c | 7 ++- > drivers/regulator/s5m8767.c | 9 ++- > drivers/regulator/tps65090-regulator.c | 6 ++ > include/linux/gpio/consumer.h | 23 ++++++++ > 16 files changed, 205 insertions(+), 44 deletions(-) > Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland
On Thu, Dec 06, 2018 at 02:27:03PM +0100, Marek Szyprowski wrote: > On 2018-12-06 13:43, Linus Walleij wrote: > One more thing - if I got everything right, gpiod_put() in > *regulator_register() error path has to be removed also in > wm8994-regulator.c and arizona-ldo1.c. Indeed yes, good spot. But apart from those additional two patches, series also looks good to me: Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Thanks, Charles
On Thu, Dec 6, 2018 at 2:49 PM Charles Keepax <ckeepax@opensource.cirrus.com> wrote: > On Thu, Dec 06, 2018 at 02:27:03PM +0100, Marek Szyprowski wrote: > > On 2018-12-06 13:43, Linus Walleij wrote: > > One more thing - if I got everything right, gpiod_put() in > > *regulator_register() error path has to be removed also in > > wm8994-regulator.c and arizona-ldo1.c. > > Indeed yes, good spot. > > But apart from those additional two patches, series > also looks good to me: > > Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Thanks a lot, I hope Mark can merge this for starters and then I can go in and fix the two outliers separately. Yours, Linus Walleij