lib: utils/gpio: Use fdt_driver for initialization

FDT gpio drivers have an extra .xlate operation, so they need to embed
the `struct fdt_driver` inside the subsystem-specific type. The gpio
subsystem always initializes the driver for a specific DT node.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Samuel Holland
2024-11-11 14:02:49 -08:00
committed by Anup Patel
parent 10df2d6fb5
commit bef8f9b806
7 changed files with 28 additions and 40 deletions

View File

@@ -30,7 +30,7 @@ struct dw_gpio_chip {
struct gpio_chip chip;
};
extern struct fdt_gpio fdt_gpio_designware;
const struct fdt_gpio fdt_gpio_designware;
#define pin_to_chip(__p) container_of((__p)->chip, struct dw_gpio_chip, chip);
@@ -132,8 +132,10 @@ static const struct fdt_match dw_gpio_match[] = {
{ },
};
struct fdt_gpio fdt_gpio_designware = {
.match_table = dw_gpio_match,
const struct fdt_gpio fdt_gpio_designware = {
.driver = {
.match_table = dw_gpio_match,
.init = dw_gpio_init_bank,
},
.xlate = fdt_gpio_simple_xlate,
.init = dw_gpio_init_bank,
};