On Sun, Sep 4, 2022 at 9:22 AM Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> wrote: > > There are no external users of fwnode_get_named_gpiod() anymore, so > let's stop exporting it and mark it as static. Agree. Reviewed-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> > --- > drivers/gpio/gpiolib.c | 132 +++++++++++++++++----------------- > include/linux/gpio/consumer.h | 13 ---- > 2 files changed, 66 insertions(+), 79 deletions(-) > > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > index cc9c0a12259e..4756ea08894f 100644 > --- a/drivers/gpio/gpiolib.c > +++ b/drivers/gpio/gpiolib.c > @@ -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 > diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h > index 37448ee17e81..cf7d64b0ced3 100644 > --- a/include/linux/gpio/consumer.h > +++ b/include/linux/gpio/consumer.h > @@ -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, > -- > 2.37.2.789.g6183377224-goog > > > -- > Dmitry -- With Best Regards, Andy Shevchenko