Skip to content

Commit fce04b1

Browse files
andy-shevLinus Walleij
authored andcommitted
gpiolib: of: Reshuffle contents of consumer.h for new library layout
Kernel build bot reported a compilation error after the commit f626d6d ("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. Reported-by: kbuild test robot <lkp@intel.com> Fixes: f626d6d ("gpio: of: Break out OF-only code"): Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20190730104337.21235-1-andriy.shevchenko@linux.intel.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent a299726 commit fce04b1

1 file changed

Lines changed: 48 additions & 30 deletions

File tree

‎include/linux/gpio/consumer.h‎

Lines changed: 48 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,8 @@ struct gpio_desc *gpio_to_desc(unsigned gpio);
170170
int desc_to_gpio(const struct gpio_desc *desc);
171171

172172
/* Child properties interface */
173-
struct device_node;
174173
struct fwnode_handle;
175174

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);
185175
struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
186176
const char *propname, int index,
187177
enum gpiod_flags dflags,
@@ -530,28 +520,8 @@ static inline int desc_to_gpio(const struct gpio_desc *desc)
530520
}
531521

532522
/* Child properties interface */
533-
struct device_node;
534523
struct fwnode_handle;
535524

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-
555525
static inline
556526
struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
557527
const char *propname, int index,
@@ -584,6 +554,54 @@ struct gpio_desc *devm_fwnode_get_gpiod_from_child(struct device *dev,
584554
flags, label);
585555
}
586556

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+
587605
#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS)
588606

589607
int gpiod_export(struct gpio_desc *desc, bool direction_may_change);

0 commit comments

Comments
 (0)