linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/15 v3] Regulator ena_gpiod fixups
@ 2018-12-05 12:47 Linus Walleij
  2018-12-05 12:47 ` [PATCH 01/15 v3] regulator: core: Track dangling GPIO descriptors Linus Walleij
                   ` (14 more replies)
  0 siblings, 15 replies; 25+ messages in thread
From: Linus Walleij @ 2018-12-05 12:47 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown
  Cc: linux-kernel, Charles Keepax, Bartosz Golaszewski,
	Marek Szyprowski, Linus Walleij

Here is a third iteration of these fixups after thinking
over Marek's remarks on the v2 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*.

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 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
  regulator: max8973: 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: 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  | 23 +++++---
 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, 214 insertions(+), 50 deletions(-)

-- 
2.19.2


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2018-12-06 11:53 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-05 12:47 [PATCH 00/15 v3] Regulator ena_gpiod fixups Linus Walleij
2018-12-05 12:47 ` [PATCH 01/15 v3] regulator: core: Track dangling GPIO descriptors Linus Walleij
2018-12-05 12:47 ` [PATCH 02/15 v3] regulator: fixed: Let core handle GPIO descriptor Linus Walleij
2018-12-05 12:47 ` [PATCH 03/15 v3] regulator: lm363x: " Linus Walleij
2018-12-05 12:47 ` [PATCH 04/15 v3] regulator: lp8788-ldo: " Linus Walleij
2018-12-05 12:47 ` [PATCH 05/15 v3] regulator: max8952: " Linus Walleij
2018-12-05 12:47 ` [PATCH 06/15 v3] regulator: max8973: " Linus Walleij
2018-12-05 13:43   ` Charles Keepax
2018-12-05 14:42     ` Linus Walleij
2018-12-05 15:33       ` Charles Keepax
2018-12-06  8:58         ` Linus Walleij
2018-12-06 10:34           ` Charles Keepax
2018-12-06 11:47             ` Linus Walleij
2018-12-06 11:53               ` Charles Keepax
2018-12-05 12:47 ` [PATCH 07/15 v3] gpio: Export gpiod_get_from_of_node() Linus Walleij
2018-12-05 12:47 ` [PATCH 08/15 v3] regulator: max77686: Let core handle GPIO descriptor Linus Walleij
2018-12-05 12:47 ` [PATCH 09/15 v3] gpio: Enable nonexclusive gpiods from DT nodes Linus Walleij
2018-12-05 12:47 ` [PATCH 10/15 v3] gpio: devres: Handle nonexclusive GPIOs Linus Walleij
2018-12-05 14:34   ` Marek Szyprowski
2018-12-05 12:47 ` [PATCH 11/15 v3] gpio: Add devm_gpiod_unhinge() Linus Walleij
2018-12-05 14:34   ` Marek Szyprowski
2018-12-05 12:47 ` [PATCH 12/15 v3] regulator: da9211: Hand over GPIO to regulator core Linus Walleij
2018-12-05 12:47 ` [PATCH 13/15 v3] regulator: s5m8767: " Linus Walleij
2018-12-05 12:47 ` [PATCH 14/15 v3] regulator: tps65090: " Linus Walleij
2018-12-05 12:47 ` [PATCH 15/15 v3] regulator: s2mps11: " Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).