Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpiolib: of: remove [devm_]gpiod_get_from_of_node() APIs

Now that everyone is using [devm_]fwnode_gpiod_get[_index]() APIs,
remove OF-specific [devm_]gpiod_get_from_of_node().

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

authored by

Dmitry Torokhov and committed by
Bartosz Golaszewski
650f2dc9 40fc56ee

-149
-55
drivers/gpio/gpiolib-devres.c
··· 130 130 EXPORT_SYMBOL_GPL(devm_gpiod_get_index); 131 131 132 132 /** 133 - * devm_gpiod_get_from_of_node() - obtain a GPIO from an OF node 134 - * @dev: device for lifecycle management 135 - * @node: handle of the OF node 136 - * @propname: name of the DT property representing the GPIO 137 - * @index: index of the GPIO to obtain for the consumer 138 - * @dflags: GPIO initialization flags 139 - * @label: label to attach to the requested GPIO 140 - * 141 - * Returns: 142 - * On successful request the GPIO pin is configured in accordance with 143 - * provided @dflags. 144 - * 145 - * In case of error an ERR_PTR() is returned. 146 - */ 147 - struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev, 148 - const struct device_node *node, 149 - const char *propname, int index, 150 - enum gpiod_flags dflags, 151 - const char *label) 152 - { 153 - struct gpio_desc **dr; 154 - struct gpio_desc *desc; 155 - 156 - desc = gpiod_get_from_of_node(node, propname, index, dflags, label); 157 - if (IS_ERR(desc)) 158 - return desc; 159 - 160 - /* 161 - * For non-exclusive GPIO descriptors, check if this descriptor is 162 - * already under resource management by this device. 163 - */ 164 - if (dflags & GPIOD_FLAGS_BIT_NONEXCLUSIVE) { 165 - struct devres *dres; 166 - 167 - dres = devres_find(dev, devm_gpiod_release, 168 - devm_gpiod_match, &desc); 169 - if (dres) 170 - return desc; 171 - } 172 - 173 - dr = devres_alloc(devm_gpiod_release, sizeof(struct gpio_desc *), 174 - GFP_KERNEL); 175 - if (!dr) { 176 - gpiod_put(desc); 177 - return ERR_PTR(-ENOMEM); 178 - } 179 - 180 - *dr = desc; 181 - devres_add(dev, dr); 182 - 183 - return desc; 184 - } 185 - EXPORT_SYMBOL_GPL(devm_gpiod_get_from_of_node); 186 - 187 - /** 188 133 * devm_fwnode_gpiod_get_index - get a GPIO descriptor from a given node 189 134 * @dev: GPIO consumer 190 135 * @fwnode: firmware node containing GPIO reference
-46
drivers/gpio/gpiolib-of.c
··· 418 418 return lflags; 419 419 } 420 420 421 - /** 422 - * gpiod_get_from_of_node() - obtain a GPIO from an OF node 423 - * @node: handle of the OF node 424 - * @propname: name of the DT property representing the GPIO 425 - * @index: index of the GPIO to obtain for the consumer 426 - * @dflags: GPIO initialization flags 427 - * @label: label to attach to the requested GPIO 428 - * 429 - * Returns: 430 - * On successful request the GPIO pin is configured in accordance with 431 - * provided @dflags. 432 - * 433 - * In case of error an ERR_PTR() is returned. 434 - */ 435 - struct gpio_desc *gpiod_get_from_of_node(const struct device_node *node, 436 - const char *propname, int index, 437 - enum gpiod_flags dflags, 438 - const char *label) 439 - { 440 - unsigned long lflags; 441 - struct gpio_desc *desc; 442 - enum of_gpio_flags of_flags; 443 - int ret; 444 - 445 - desc = of_get_named_gpiod_flags(node, propname, index, &of_flags); 446 - if (!desc || IS_ERR(desc)) 447 - return desc; 448 - 449 - ret = gpiod_request(desc, label); 450 - if (ret == -EBUSY && (dflags & GPIOD_FLAGS_BIT_NONEXCLUSIVE)) 451 - return desc; 452 - if (ret) 453 - return ERR_PTR(ret); 454 - 455 - lflags = of_convert_gpio_flags(of_flags); 456 - 457 - ret = gpiod_configure_flags(desc, propname, lflags, dflags); 458 - if (ret < 0) { 459 - gpiod_put(desc); 460 - return ERR_PTR(ret); 461 - } 462 - 463 - return desc; 464 - } 465 - EXPORT_SYMBOL_GPL(gpiod_get_from_of_node); 466 - 467 421 static struct gpio_desc *of_find_gpio_rename(struct device_node *np, 468 422 const char *con_id, 469 423 unsigned int idx,
-48
include/linux/gpio/consumer.h
··· 581 581 flags, label); 582 582 } 583 583 584 - #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_OF_GPIO) 585 - struct device_node; 586 - 587 - struct gpio_desc *gpiod_get_from_of_node(const struct device_node *node, 588 - const char *propname, int index, 589 - enum gpiod_flags dflags, 590 - const char *label); 591 - 592 - #else /* CONFIG_GPIOLIB && CONFIG_OF_GPIO */ 593 - 594 - struct device_node; 595 - 596 - static inline 597 - struct gpio_desc *gpiod_get_from_of_node(const struct device_node *node, 598 - const char *propname, int index, 599 - enum gpiod_flags dflags, 600 - const char *label) 601 - { 602 - return ERR_PTR(-ENOSYS); 603 - } 604 - 605 - #endif /* CONFIG_GPIOLIB && CONFIG_OF_GPIO */ 606 - 607 - #ifdef CONFIG_GPIOLIB 608 - struct device_node; 609 - 610 - struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev, 611 - const struct device_node *node, 612 - const char *propname, int index, 613 - enum gpiod_flags dflags, 614 - const char *label); 615 - 616 - #else /* CONFIG_GPIOLIB */ 617 - 618 - struct device_node; 619 - 620 - static inline 621 - struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev, 622 - const struct device_node *node, 623 - const char *propname, int index, 624 - enum gpiod_flags dflags, 625 - const char *label) 626 - { 627 - return ERR_PTR(-ENOSYS); 628 - } 629 - 630 - #endif /* CONFIG_GPIOLIB */ 631 - 632 584 struct acpi_gpio_params { 633 585 unsigned int crs_entry_index; 634 586 unsigned int line_index;