dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: "Thierry Reding" <thierry.reding@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Matti Vaittinen" <mazziesaccount@gmail.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Claudiu Beznea" <claudiu.beznea@microchip.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Wim Van Sebroeck" <wim@linux-watchdog.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Guenter Roeck" <linux@roeck-us.net>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Felipe Balbi" <balbi@kernel.org>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
	"Marc Zyngier" <maz@kernel.org>,
	"Richard Weinberger" <richard@nod.at>,
	"David Airlie" <airlied@linux.ie>,
	"Nicolas Ferre" <nicolas.ferre@microchip.com>,
	"Alyssa Rosenzweig" <alyssa@rosenzweig.io>,
	"Bartosz Golaszewski" <brgl@bgdev.pl>,
	"Jonathan Hunter" <jonathanh@nvidia.com>,
	"Rob Herring" <robh@kernel.org>,
	"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Pali Rohár" <pali@kernel.org>
Cc: linux-watchdog@vger.kernel.org, linux-pci@vger.kernel.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-gpio@vger.kernel.org,
	linux-mtd@lists.infradead.org, linux-tegra@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v1 11/11] gpiolib: of: remove [devm_]gpiod_get_from_of_node() APIs
Date: Sun,  4 Sep 2022 23:31:03 -0700	[thread overview]
Message-ID: <20220903-gpiod_get_from_of_node-remove-v1-11-b29adfb27a6c@gmail.com> (raw)
In-Reply-To: <20220903-gpiod_get_from_of_node-remove-v1-0-b29adfb27a6c@gmail.com>

Now that everyone is using [devm_]fwnode_gpiod_get[_index]() APIs, we no
longer need to expose OF-specific [devm_]gpiod_get_from_of_node().

Note that we are keeping gpiod_get_from_of_node() but only as a private
to gpiolib function.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

diff --git a/drivers/gpio/gpiolib-devres.c b/drivers/gpio/gpiolib-devres.c
index 16a696249229..fe9ce6b19f15 100644
--- a/drivers/gpio/gpiolib-devres.c
+++ b/drivers/gpio/gpiolib-devres.c
@@ -129,61 +129,6 @@ struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(devm_gpiod_get_index);
 
-/**
- * devm_gpiod_get_from_of_node() - obtain a GPIO from an OF node
- * @dev:	device for lifecycle management
- * @node:	handle of the OF node
- * @propname:	name of the DT property representing the GPIO
- * @index:	index of the GPIO to obtain for the consumer
- * @dflags:	GPIO initialization flags
- * @label:	label to attach to the requested GPIO
- *
- * Returns:
- * On successful request the GPIO pin is configured in accordance with
- * provided @dflags.
- *
- * In case of error an ERR_PTR() is returned.
- */
-struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev,
-					      const struct device_node *node,
-					      const char *propname, int index,
-					      enum gpiod_flags dflags,
-					      const char *label)
-{
-	struct gpio_desc **dr;
-	struct gpio_desc *desc;
-
-	desc = gpiod_get_from_of_node(node, propname, index, dflags, label);
-	if (IS_ERR(desc))
-		return desc;
-
-	/*
-	 * For non-exclusive GPIO descriptors, check if this descriptor is
-	 * already under resource management by this device.
-	 */
-	if (dflags & GPIOD_FLAGS_BIT_NONEXCLUSIVE) {
-		struct devres *dres;
-
-		dres = devres_find(dev, devm_gpiod_release,
-				   devm_gpiod_match, &desc);
-		if (dres)
-			return desc;
-	}
-
-	dr = devres_alloc(devm_gpiod_release, sizeof(struct gpio_desc *),
-			  GFP_KERNEL);
-	if (!dr) {
-		gpiod_put(desc);
-		return ERR_PTR(-ENOMEM);
-	}
-
-	*dr = desc;
-	devres_add(dev, dr);
-
-	return desc;
-}
-EXPORT_SYMBOL_GPL(devm_gpiod_get_from_of_node);
-
 /**
  * devm_fwnode_gpiod_get_index - get a GPIO descriptor from a given node
  * @dev:	GPIO consumer
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index a037b50bef33..b0e0723b12ab 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -365,7 +365,6 @@ struct gpio_desc *gpiod_get_from_of_node(const struct device_node *node,
 
 	return desc;
 }
-EXPORT_SYMBOL_GPL(gpiod_get_from_of_node);
 
 /*
  * The SPI GPIO bindings happened before we managed to establish that GPIO
diff --git a/drivers/gpio/gpiolib-of.h b/drivers/gpio/gpiolib-of.h
index 8af2bc899aab..e0da568d6da3 100644
--- a/drivers/gpio/gpiolib-of.h
+++ b/drivers/gpio/gpiolib-of.h
@@ -3,6 +3,7 @@
 #ifndef GPIOLIB_OF_H
 #define GPIOLIB_OF_H
 
+struct device_node;
 struct gpio_chip;
 enum of_gpio_flags;
 
@@ -16,6 +17,10 @@ void of_gpiochip_remove(struct gpio_chip *gc);
 int of_gpio_get_count(struct device *dev, const char *con_id);
 bool of_gpio_need_valid_mask(const struct gpio_chip *gc);
 void of_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev);
+struct gpio_desc *gpiod_get_from_of_node(const struct device_node *node,
+					 const char *propname, int index,
+					 enum gpiod_flags dflags,
+					 const char *label);
 #else
 static inline struct gpio_desc *of_find_gpio(struct device *dev,
 					     const char *con_id,
@@ -38,6 +43,14 @@ static inline void of_gpio_dev_init(struct gpio_chip *gc,
 				    struct gpio_device *gdev)
 {
 }
+static inline
+struct gpio_desc *gpiod_get_from_of_node(const struct device_node *node,
+					 const char *propname, int index,
+					 enum gpiod_flags dflags,
+					 const char *label)
+{
+	return ERR_PTR(-ENOSYS);
+}
 #endif /* CONFIG_OF_GPIO */
 
 extern struct notifier_block gpio_of_notifier;
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index fe0f460d9a3b..37448ee17e81 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -615,54 +615,6 @@ struct gpio_desc *devm_fwnode_get_gpiod_from_child(struct device *dev,
 	return devm_fwnode_gpiod_get_index(dev, child, con_id, 0, flags, label);
 }
 
-#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_OF_GPIO)
-struct device_node;
-
-struct gpio_desc *gpiod_get_from_of_node(const struct device_node *node,
-					 const char *propname, int index,
-					 enum gpiod_flags dflags,
-					 const char *label);
-
-#else  /* CONFIG_GPIOLIB && CONFIG_OF_GPIO */
-
-struct device_node;
-
-static inline
-struct gpio_desc *gpiod_get_from_of_node(const struct device_node *node,
-					 const char *propname, int index,
-					 enum gpiod_flags dflags,
-					 const char *label)
-{
-	return ERR_PTR(-ENOSYS);
-}
-
-#endif /* CONFIG_GPIOLIB && CONFIG_OF_GPIO */
-
-#ifdef CONFIG_GPIOLIB
-struct device_node;
-
-struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev,
-					      const struct device_node *node,
-					      const char *propname, int index,
-					      enum gpiod_flags dflags,
-					      const char *label);
-
-#else  /* CONFIG_GPIOLIB */
-
-struct device_node;
-
-static inline
-struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev,
-					      const struct device_node *node,
-					      const char *propname, int index,
-					      enum gpiod_flags dflags,
-					      const char *label)
-{
-	return ERR_PTR(-ENOSYS);
-}
-
-#endif /* CONFIG_GPIOLIB */
-
 struct acpi_gpio_params {
 	unsigned int crs_entry_index;
 	unsigned int line_index;

-- 
b4 0.10.0-dev-fc921

  parent reply	other threads:[~2022-09-05  6:31 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-05  6:30 [PATCH v1 00/11] Get rid of [devm_]gpiod_get_from_of_node() public APIs Dmitry Torokhov
2022-09-05  6:30 ` [PATCH v1 01/11] PCI: tegra: switch to using devm_fwnode_gpiod_get Dmitry Torokhov
2022-09-05  7:19   ` Pali Rohár
2022-09-05 10:49     ` Andy Shevchenko
2022-09-05 10:53       ` Pali Rohár
2022-09-05 10:54         ` Andy Shevchenko
2022-09-05 10:54       ` Andy Shevchenko
2022-09-05 22:49     ` Dmitry Torokhov
2022-09-08  8:13   ` Linus Walleij
2022-09-05  6:30 ` [PATCH v1 02/11] drm/tegra: " Dmitry Torokhov
2022-09-05 10:57   ` Andy Shevchenko
2022-09-05 19:37     ` Dmitry Torokhov
2022-09-05 21:03       ` Linus Walleij
2022-09-05 22:08         ` Dmitry Torokhov
2022-09-05  6:30 ` [PATCH v1 03/11] mtd: rawnand: stm32_fmc2: switch to using devm_fwnode_gpiod_get() Dmitry Torokhov
2022-09-20  8:33   ` Miquel Raynal
2022-09-05  6:30 ` [PATCH v1 04/11] usb: phy: tegra: switch to using devm_gpiod_get() Dmitry Torokhov
2022-09-05 10:59   ` Andy Shevchenko
2022-09-05 19:39     ` Dmitry Torokhov
2022-09-05 19:41       ` Andy Shevchenko
2022-09-05 19:51         ` Dmitry Torokhov
2022-09-05 19:55           ` Andy Shevchenko
2022-09-05 22:07             ` Guenter Roeck
2022-09-06 12:27               ` Andy Shevchenko
2022-09-05  6:30 ` [PATCH v1 05/11] usb: gadget: udc: at91: switch to using fwnode_gpiod_get_index() Dmitry Torokhov
2022-09-05  6:30 ` [PATCH v1 06/11] PCI: aardvark: switch to using devm_gpiod_get_optional() Dmitry Torokhov
2022-09-05  7:00   ` Pali Rohár
2022-09-05 10:47     ` Andy Shevchenko
2022-09-05 19:54       ` Dmitry Torokhov
2022-09-05 22:54     ` Dmitry Torokhov
2022-09-05 23:10       ` Pali Rohár
2022-09-05 23:18         ` Dmitry Torokhov
2022-09-08  8:32   ` Linus Walleij
2022-09-05  6:30 ` [PATCH v1 07/11] PCI: apple: switch to using fwnode_gpiod_get_index() Dmitry Torokhov
2022-09-06  0:19   ` Dmitry Torokhov
2022-09-08  8:33     ` Linus Walleij
2022-09-05  6:31 ` [PATCH v1 08/11] regulator: bd71815: switch to using devm_fwnode_gpiod_get() Dmitry Torokhov
2022-09-05  9:55   ` Matti Vaittinen
2022-09-05 10:42   ` Andy Shevchenko
2022-09-08  8:10   ` Linus Walleij
2022-09-05  6:31 ` [PATCH v1 09/11] regulator: bd9576: " Dmitry Torokhov
2022-09-05  9:56   ` Matti Vaittinen
2022-09-05 10:40   ` Andy Shevchenko
2022-09-05 13:19     ` Matti Vaittinen
2022-09-05 13:23       ` Andy Shevchenko
2022-09-05  6:31 ` [PATCH v1 10/11] watchdog: bd9576_wdt: " Dmitry Torokhov
2022-09-05 11:09   ` Andy Shevchenko
2022-09-05 15:13     ` Guenter Roeck
2022-09-05 15:21       ` Andy Shevchenko
2022-09-05 15:49         ` Guenter Roeck
2022-09-05 19:47           ` Dmitry Torokhov
2022-09-05 22:09             ` Guenter Roeck
2022-09-07  2:00               ` Dmitry Torokhov
2022-09-08  8:38   ` Linus Walleij
2022-09-05  6:31 ` Dmitry Torokhov [this message]
2022-09-05 10:40   ` [PATCH v1 11/11] gpiolib: of: remove [devm_]gpiod_get_from_of_node() APIs Linus Walleij
2022-09-05  7:08 ` [PATCH v1 00/11] Get rid of [devm_]gpiod_get_from_of_node() public APIs Greg Kroah-Hartman
2022-09-05 11:13 ` Andy Shevchenko
2022-09-05 14:54 ` (subset) " Mark Brown
2022-10-27 13:38 ` Lorenzo Pieralisi
2022-10-28  1:06   ` Dmitry Torokhov

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=20220903-gpiod_get_from_of_node-remove-v1-11-b29adfb27a6c@gmail.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=airlied@linux.ie \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=alyssa@rosenzweig.io \
    --cc=balbi@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=claudiu.beznea@microchip.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jonathanh@nvidia.com \
    --cc=kw@linux.com \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lpieralisi@kernel.org \
    --cc=maz@kernel.org \
    --cc=mazziesaccount@gmail.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=pali@kernel.org \
    --cc=richard@nod.at \
    --cc=robh@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vigneshr@ti.com \
    --cc=wim@linux-watchdog.org \
    /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).