gpiolib: make fwnode_get_named_gpiod() static
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 4 Sep 2022 06:18:47 +0000 (23:18 -0700)
committerBartosz Golaszewski <brgl@bgdev.pl>
Sun, 4 Sep 2022 20:12:15 +0000 (22:12 +0200)
There are no external users of fwnode_get_named_gpiod() anymore, so
let's stop exporting it and mark it as static.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
drivers/gpio/gpiolib.c
include/linux/gpio/consumer.h

index cc9c0a12259e15f0c5d73b0ee42986d931587605..4756ea08894f652566bcb7bef868560efebc683c 100644 (file)
@@ -3798,6 +3798,72 @@ static int platform_gpio_count(struct device *dev, const char *con_id)
        return count;
 }
 
+/**
+ * fwnode_get_named_gpiod - obtain a GPIO from firmware node
+ * @fwnode:    handle of the firmware node
+ * @propname:  name of the firmware 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
+ *
+ * This function can be used for drivers that get their configuration
+ * from opaque firmware.
+ *
+ * The function properly finds the corresponding GPIO using whatever is the
+ * underlying firmware interface and then makes sure that the GPIO
+ * descriptor is requested before it is returned to the caller.
+ *
+ * Returns:
+ * On successful request the GPIO pin is configured in accordance with
+ * provided @dflags.
+ *
+ * In case of error an ERR_PTR() is returned.
+ */
+static struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
+                                               const char *propname, int index,
+                                               enum gpiod_flags dflags,
+                                               const char *label)
+{
+       unsigned long lflags = GPIO_LOOKUP_FLAGS_DEFAULT;
+       struct gpio_desc *desc = ERR_PTR(-ENODEV);
+       int ret;
+
+       if (is_of_node(fwnode)) {
+               desc = gpiod_get_from_of_node(to_of_node(fwnode),
+                                             propname, index,
+                                             dflags,
+                                             label);
+               return desc;
+       } else if (is_acpi_node(fwnode)) {
+               struct acpi_gpio_info info;
+
+               desc = acpi_node_get_gpiod(fwnode, propname, index, &info);
+               if (IS_ERR(desc))
+                       return desc;
+
+               acpi_gpio_update_gpiod_flags(&dflags, &info);
+               acpi_gpio_update_gpiod_lookup_flags(&lflags, &info);
+       } else {
+               return ERR_PTR(-EINVAL);
+       }
+
+       /* Currently only ACPI takes this path */
+       ret = gpiod_request(desc, label);
+       if (ret)
+               return ERR_PTR(ret);
+
+       ret = gpiod_configure_flags(desc, propname, lflags, dflags);
+       if (ret < 0) {
+               gpiod_put(desc);
+               return ERR_PTR(ret);
+       }
+
+       blocking_notifier_call_chain(&desc->gdev->notifier,
+                                    GPIOLINE_CHANGED_REQUESTED, desc);
+
+       return desc;
+}
+
 /**
  * fwnode_gpiod_get_index - obtain a GPIO from firmware node
  * @fwnode:    handle of the firmware node
@@ -4063,72 +4129,6 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(gpiod_get_index);
 
-/**
- * fwnode_get_named_gpiod - obtain a GPIO from firmware node
- * @fwnode:    handle of the firmware node
- * @propname:  name of the firmware 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
- *
- * This function can be used for drivers that get their configuration
- * from opaque firmware.
- *
- * The function properly finds the corresponding GPIO using whatever is the
- * underlying firmware interface and then makes sure that the GPIO
- * descriptor is requested before it is returned to the caller.
- *
- * 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 *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
-                                        const char *propname, int index,
-                                        enum gpiod_flags dflags,
-                                        const char *label)
-{
-       unsigned long lflags = GPIO_LOOKUP_FLAGS_DEFAULT;
-       struct gpio_desc *desc = ERR_PTR(-ENODEV);
-       int ret;
-
-       if (is_of_node(fwnode)) {
-               desc = gpiod_get_from_of_node(to_of_node(fwnode),
-                                             propname, index,
-                                             dflags,
-                                             label);
-               return desc;
-       } else if (is_acpi_node(fwnode)) {
-               struct acpi_gpio_info info;
-
-               desc = acpi_node_get_gpiod(fwnode, propname, index, &info);
-               if (IS_ERR(desc))
-                       return desc;
-
-               acpi_gpio_update_gpiod_flags(&dflags, &info);
-               acpi_gpio_update_gpiod_lookup_flags(&lflags, &info);
-       } else
-               return ERR_PTR(-EINVAL);
-
-       /* Currently only ACPI takes this path */
-       ret = gpiod_request(desc, label);
-       if (ret)
-               return ERR_PTR(ret);
-
-       ret = gpiod_configure_flags(desc, propname, lflags, dflags);
-       if (ret < 0) {
-               gpiod_put(desc);
-               return ERR_PTR(ret);
-       }
-
-       blocking_notifier_call_chain(&desc->gdev->notifier,
-                                    GPIOLINE_CHANGED_REQUESTED, desc);
-
-       return desc;
-}
-EXPORT_SYMBOL_GPL(fwnode_get_named_gpiod);
-
 /**
  * gpiod_get_index_optional - obtain an optional GPIO from a multi-index GPIO
  *                            function
index fe0f460d9a3b67c024b79b4b715666782920f78d..36460ced060b0ec1f2a34aa5b167b93d711c8916 100644 (file)
@@ -174,10 +174,6 @@ int desc_to_gpio(const struct gpio_desc *desc);
 /* Child properties interface */
 struct fwnode_handle;
 
-struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
-                                        const char *propname, int index,
-                                        enum gpiod_flags dflags,
-                                        const char *label);
 struct gpio_desc *fwnode_gpiod_get_index(struct fwnode_handle *fwnode,
                                         const char *con_id, int index,
                                         enum gpiod_flags flags,
@@ -553,15 +549,6 @@ static inline int desc_to_gpio(const struct gpio_desc *desc)
 /* Child properties interface */
 struct fwnode_handle;
 
-static inline
-struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
-                                        const char *propname, int index,
-                                        enum gpiod_flags dflags,
-                                        const char *label)
-{
-       return ERR_PTR(-ENOSYS);
-}
-
 static inline
 struct gpio_desc *fwnode_gpiod_get_index(struct fwnode_handle *fwnode,
                                         const char *con_id, int index,