Skip to content

Commit 52464f5

Browse files
broonieBartosz Golaszewski
authored andcommitted
gpiolib: Add stubs for GPIO lookup functions
The gpio_device_find_by_() functions do not have stubs which means that if they are referenced from code with an optiona dependency on gpiolib then the code will fail to link. Add stubs for lookups via fwnode and label. I have not added a stub for plain gpio_device_find() since it seems harder to see a use case for that which does not depend on gpiolib. With the addition of the GPIO reset controller (which lacks a gpiolib dependency) to the arm64 defconfig this is causing build breaks for arm64 virtconfig in -next: aarch64-linux-gnu-ld: drivers/reset/core.o: in function `__reset_add_reset_gpio_lookup': /build/stage/linux/drivers/reset/core.c:861:(.text+0xccc): undefined reference to `gpio_device_find_by_fwnode' Signed-off-by: Mark Brown <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent b344908 commit 52464f5

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

include/linux/gpio/driver.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,6 @@ int devm_gpiochip_add_data_with_key(struct device *dev, struct gpio_chip *gc,
646646
struct gpio_device *gpio_device_find(const void *data,
647647
int (*match)(struct gpio_chip *gc,
648648
const void *data));
649-
struct gpio_device *gpio_device_find_by_label(const char *label);
650-
struct gpio_device *gpio_device_find_by_fwnode(const struct fwnode_handle *fwnode);
651649

652650
struct gpio_device *gpio_device_get(struct gpio_device *gdev);
653651
void gpio_device_put(struct gpio_device *gdev);
@@ -814,6 +812,9 @@ struct gpio_device *gpiod_to_gpio_device(struct gpio_desc *desc);
814812
int gpio_device_get_base(struct gpio_device *gdev);
815813
const char *gpio_device_get_label(struct gpio_device *gdev);
816814

815+
struct gpio_device *gpio_device_find_by_label(const char *label);
816+
struct gpio_device *gpio_device_find_by_fwnode(const struct fwnode_handle *fwnode);
817+
817818
#else /* CONFIG_GPIOLIB */
818819

819820
#include <asm/bug.h>
@@ -843,6 +844,18 @@ static inline const char *gpio_device_get_label(struct gpio_device *gdev)
843844
return NULL;
844845
}
845846

847+
static inline struct gpio_device *gpio_device_find_by_label(const char *label)
848+
{
849+
WARN_ON(1);
850+
return NULL;
851+
}
852+
853+
static inline struct gpio_device *gpio_device_find_by_fwnode(const struct fwnode_handle *fwnode)
854+
{
855+
WARN_ON(1);
856+
return NULL;
857+
}
858+
846859
static inline int gpiochip_lock_as_irq(struct gpio_chip *gc,
847860
unsigned int offset)
848861
{

0 commit comments

Comments
 (0)