linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Charles Keepax <ckeepax@opensource.cirrus.com>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH 07/13 v2] gpio: Export gpiod_get_from_of_node()
Date: Sat,  1 Dec 2018 16:41:45 +0100	[thread overview]
Message-ID: <20181201154151.14890-8-linus.walleij@linaro.org> (raw)
In-Reply-To: <20181201154151.14890-1-linus.walleij@linaro.org>

This function already exist inside gpiolib, we were just
reluctant to make it available to the kernel at large as
the devm_* seemed to be enough for anyone.

However we found out that regulators need to do their own
lifecycle/refcounting on GPIO descriptors and explicitly
call gpiod_put() when done with a descriptor, so export
this function so we can hand the refcounting over to the
regulator core for these descriptors after retrieveal.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2:
- Resending
---
 drivers/gpio/gpiolib.h        |  6 ------
 include/linux/gpio/consumer.h | 13 +++++++++++++
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
index 087d865286a0..bc57f0dc5953 100644
--- a/drivers/gpio/gpiolib.h
+++ b/drivers/gpio/gpiolib.h
@@ -201,12 +201,6 @@ int gpiod_set_array_value_complex(bool raw, bool can_sleep,
 				  struct gpio_array *array_info,
 				  unsigned long *value_bitmap);
 
-/* This is just passed between gpiolib and devres */
-struct gpio_desc *gpiod_get_from_of_node(struct device_node *node,
-					 const char *propname, int index,
-					 enum gpiod_flags dflags,
-					 const char *label);
-
 extern struct spinlock gpio_lock;
 extern struct list_head gpio_devices;
 
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index f2f887795d43..348885f2f3d3 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -172,6 +172,10 @@ int desc_to_gpio(const struct gpio_desc *desc);
 struct device_node;
 struct fwnode_handle;
 
+struct gpio_desc *gpiod_get_from_of_node(struct device_node *node,
+					 const char *propname, int index,
+					 enum gpiod_flags dflags,
+					 const char *label);
 struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev,
 					      struct device_node *node,
 					      const char *propname, int index,
@@ -517,6 +521,15 @@ static inline int desc_to_gpio(const struct gpio_desc *desc)
 struct device_node;
 struct fwnode_handle;
 
+static inline
+struct gpio_desc *gpiod_get_from_of_node(struct device_node *node,
+					 const char *propname, int index,
+					 enum gpiod_flags dflags,
+					 const char *label)
+{
+	return ERR_PTR(-ENOSYS);
+}
+
 static inline
 struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev,
 					      struct device_node *node,
-- 
2.19.1


  parent reply	other threads:[~2018-12-01 15:53 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20181201154428epcas4p3a1a5c9c576027b1c56f8dd1510b32187@epcas4p3.samsung.com>
2018-12-01 15:41 ` [PATCH 00/13 v2] Regulator ena_gpiod fixups Linus Walleij
2018-12-01 15:41   ` [PATCH 01/13 v2] regulator: core: Track dangling GPIO descriptors Linus Walleij
2018-12-01 15:41   ` [PATCH 02/13 v2] regulator: fixed: Let core handle GPIO descriptor Linus Walleij
2018-12-01 15:41   ` [PATCH 03/13 v2] regulator: lm363x: " Linus Walleij
2018-12-01 15:41   ` [PATCH 04/13 v2] regulator: lp8788-ldo: " Linus Walleij
2018-12-01 15:41   ` [PATCH 05/13 v2] regulator: max8952: " Linus Walleij
2018-12-01 15:41   ` [PATCH 06/13 v2] regulator: max8973: " Linus Walleij
2018-12-05 13:08     ` Charles Keepax
2018-12-01 15:41   ` Linus Walleij [this message]
2018-12-01 15:41   ` [PATCH 08/13 v2] regulator: max77686: " Linus Walleij
2018-12-01 15:41   ` [PATCH 09/13 v2] gpio: Add devm_gpiod_unhinge() Linus Walleij
2018-12-02 17:02     ` Bartosz Golaszewski
2018-12-01 15:41   ` [PATCH 10/13 v2] regulator: da9211: Hand over GPIO to regulator core Linus Walleij
2018-12-01 15:41   ` [PATCH 11/13 v2] regulator: s5m8767: " Linus Walleij
2018-12-01 15:41   ` [PATCH 12/13 v2] regulator: tps65090: " Linus Walleij
2018-12-01 15:41   ` [PATCH 13/13 v2] regulator: s2mps11: " Linus Walleij
2018-12-03 14:35   ` [PATCH 00/13 v2] Regulator ena_gpiod fixups Marek Szyprowski
2018-12-04  9:31     ` Linus Walleij
2018-12-04 10:33       ` Marek Szyprowski
2018-12-04 12:44         ` Linus Walleij
2018-12-05 14:30           ` Marek Szyprowski
2018-12-05 14:32             ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181201154151.14890-8-linus.walleij@linaro.org \
    --to=linus.walleij@linaro.org \
    --cc=bgolaszewski@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).