diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 18bba1748a3552f8cb2e41919f0e06ae287513f7..e452768f316d5fcb68ff6adfe090052882c71cb8 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -3010,6 +3010,23 @@ void gpiod_set_raw_array_value_cansleep(unsigned int array_size, } EXPORT_SYMBOL_GPL(gpiod_set_raw_array_value_cansleep); +/** + * gpiod_add_lookup_tables() - register GPIO device consumers + * @tables: list of tables of consumers to register + * @n: number of tables in the list + */ +void gpiod_add_lookup_tables(struct gpiod_lookup_table **tables, size_t n) +{ + unsigned int i; + + mutex_lock(&gpio_lookup_lock); + + for (i = 0; i < n; i++) + list_add_tail(&tables[i]->list, &gpio_lookup_list); + + mutex_unlock(&gpio_lookup_lock); +} + /** * gpiod_set_array_value_cansleep() - assign values to an array of GPIOs * @array_size: number of elements in the descriptor / value arrays diff --git a/include/linux/gpio/machine.h b/include/linux/gpio/machine.h index 6e76b16fcadeb15bf78e92f3ff5b57c5cf397ec3..ba4ccfd900f91cafe1721a6a633c30b967bf9475 100644 --- a/include/linux/gpio/machine.h +++ b/include/linux/gpio/machine.h @@ -60,11 +60,14 @@ struct gpiod_lookup_table { #ifdef CONFIG_GPIOLIB void gpiod_add_lookup_table(struct gpiod_lookup_table *table); +void gpiod_add_lookup_tables(struct gpiod_lookup_table **tables, size_t n); void gpiod_remove_lookup_table(struct gpiod_lookup_table *table); #else static inline void gpiod_add_lookup_table(struct gpiod_lookup_table *table) {} static inline +void gpiod_add_lookup_tables(struct gpiod_lookup_table **tables, size_t n) {} +static inline void gpiod_remove_lookup_table(struct gpiod_lookup_table *table) {} #endif