diff options
| author | Nikita Shubin <[email protected]> | 2021-11-02 17:39:11 +0300 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2021-11-03 15:57:56 +0530 |
| commit | 0979ffda12b636fab58228c2b40bab1e2f6b327b (patch) | |
| tree | 8850f7326bda43655e80651bd3f771f350a0b087 /include | |
| parent | 013ba4ef3d94de67d040376535131012134ed54f (diff) | |
lib: utils/gpio: use list for drivers
Convert static array to sbi_list.
This removes size limitation, makes add/remove more efficient and
saves space.
Signed-off-by: Nikita Shubin <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
Diffstat (limited to 'include')
| -rw-r--r-- | include/sbi_utils/gpio/gpio.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/sbi_utils/gpio/gpio.h b/include/sbi_utils/gpio/gpio.h index 167d11a8..7a3d8bbe 100644 --- a/include/sbi_utils/gpio/gpio.h +++ b/include/sbi_utils/gpio/gpio.h @@ -11,6 +11,7 @@ #define __GPIO_H__ #include <sbi/sbi_types.h> +#include <sbi/sbi_list.h> #define GPIO_LINE_DIRECTION_IN 1 #define GPIO_LINE_DIRECTION_OUT 0 @@ -70,8 +71,15 @@ struct gpio_chip { int (*get)(struct gpio_pin *gp); /** Set output value for GPIO pin */ void (*set)(struct gpio_pin *gp, int value); + /** List */ + struct sbi_dlist node; }; +static inline struct gpio_chip *to_gpio_chip(struct sbi_dlist *node) +{ + return container_of(node, struct gpio_chip, node); +} + /** Find a registered GPIO chip */ struct gpio_chip *gpio_chip_find(unsigned int id); |
