Kernel build bot reported a compilation error after the commit f626d6dfb709 ("gpio: of: Break out OF-only code"): drivers/gpio/gpiolib-devres.o: In function `devm_gpiod_get_from_of_node': gpiolib-devres.c:(.text+0x19a): undefined reference to `gpiod_get_from_of_node' This happens due to move the latter under umbrella of CONFIG_OF_GPIO while customer.h contains staled data. Fix it by reshuffling contents of consumer.h to satisfy build dependencies.
Unified · Split
| @@ -170,18 +170,8 @@ struct gpio_desc *gpio_to_desc(unsigned gpio); · 169 unmodified lines | ||
| 170 | 170 | int desc_to_gpio(const struct gpio_desc *desc); |
| 171 | 171 | |
| 172 | 172 | /* Child properties interface */ |
| 173 | −struct device_node; | |
| 174 | 173 | struct fwnode_handle; |
| 175 | 174 | |
| 176 | −struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, | |
| 177 | − const char *propname, int index, | |
| 178 | − enum gpiod_flags dflags, | |
| 179 | − const char *label); | |
| 180 | −struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev, | |
| 181 | − struct device_node *node, | |
| 182 | − const char *propname, int index, | |
| 183 | − enum gpiod_flags dflags, | |
| 184 | − const char *label); | |
| 185 | 175 | struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, |
| 186 | 176 | const char *propname, int index, |
| 187 | 177 | enum gpiod_flags dflags, |
| @@ -530,28 +520,8 @@ static inline int desc_to_gpio(const struct gpio_desc *desc) · 342 unmodified lines | ||
| 530 | 520 | } |
| 531 | 521 | |
| 532 | 522 | /* Child properties interface */ |
| 533 | −struct device_node; | |
| 534 | 523 | struct fwnode_handle; |
| 535 | 524 | |
| 536 | −static inline | |
| 537 | −struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, | |
| 538 | − const char *propname, int index, | |
| 539 | − enum gpiod_flags dflags, | |
| 540 | − const char *label) | |
| 541 | −{ | |
| 542 | − return ERR_PTR(-ENOSYS); | |
| 543 | −} | |
| 544 | − | |
| 545 | −static inline | |
| 546 | −struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev, | |
| 547 | − struct device_node *node, | |
| 548 | − const char *propname, int index, | |
| 549 | − enum gpiod_flags dflags, | |
| 550 | − const char *label) | |
| 551 | −{ | |
| 552 | − return ERR_PTR(-ENOSYS); | |
| 553 | −} | |
| 554 | − | |
| 555 | 525 | static inline |
| 556 | 526 | struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, |
| 557 | 527 | const char *propname, int index, |
| @@ -584,6 +554,54 @@ struct gpio_desc *devm_fwnode_get_gpiod_from_child(struct device *dev, · 26 unmodified lines | ||
| 584 | 554 | flags, label); |
| 585 | 555 | } |
| 586 | 556 | |
| 557 | +#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_OF_GPIO) | |
| 558 | +struct device_node; | |
| 559 | + | |
| 560 | +struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, | |
| 561 | + const char *propname, int index, | |
| 562 | + enum gpiod_flags dflags, | |
| 563 | + const char *label); | |
| 564 | + | |
| 565 | +#else /* CONFIG_GPIOLIB && CONFIG_OF_GPIO */ | |
| 566 | + | |
| 567 | +struct device_node; | |
| 568 | + | |
| 569 | +static inline | |
| 570 | +struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, | |
| 571 | + const char *propname, int index, | |
| 572 | + enum gpiod_flags dflags, | |
| 573 | + const char *label) | |
| 574 | +{ | |
| 575 | + return ERR_PTR(-ENOSYS); | |
| 576 | +} | |
| 577 | + | |
| 578 | +#endif /* CONFIG_GPIOLIB && CONFIG_OF_GPIO */ | |
| 579 | + | |
| 580 | +#ifdef CONFIG_GPIOLIB | |
| 581 | +struct device_node; | |
| 582 | + | |
| 583 | +struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev, | |
| 584 | + struct device_node *node, | |
| 585 | + const char *propname, int index, | |
| 586 | + enum gpiod_flags dflags, | |
| 587 | + const char *label); | |
| 588 | + | |
| 589 | +#else /* CONFIG_GPIOLIB */ | |
| 590 | + | |
| 591 | +struct device_node; | |
| 592 | + | |
| 593 | +static inline | |
| 594 | +struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev, | |
| 595 | + struct device_node *node, | |
| 596 | + const char *propname, int index, | |
| 597 | + enum gpiod_flags dflags, | |
| 598 | + const char *label) | |
| 599 | +{ | |
| 600 | + return ERR_PTR(-ENOSYS); | |
| 601 | +} | |
| 602 | + | |
| 603 | +#endif /* CONFIG_GPIOLIB */ | |
| 604 | + | |
| 587 | 605 | #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) |
| 588 | 606 | |
| 589 | 607 | int gpiod_export(struct gpio_desc *desc, bool direction_may_change); |