forked from Mirrors/opensbi
lib: utils/gpio: Use FDT node offset as GPIO chip ID
Since the FDT is not modified during driver initialization, node offsets are just as suitable as phandles for use as identifiers: they are stable and unique. With this change, it is no longer necessary to pass the phandle to the driver init functions, so these init functions now use the same prototype as other kinds of drivers. This matches what is already done for I2C adapters. Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:

committed by
Anup Patel

parent
598cf961d8
commit
d71150ee70
@@ -71,7 +71,7 @@ static void starfive_gpio_set(struct gpio_pin *gp, int value)
|
||||
|
||||
extern struct fdt_gpio fdt_gpio_starfive;
|
||||
|
||||
static int starfive_gpio_init(const void *fdt, int nodeoff, u32 phandle,
|
||||
static int starfive_gpio_init(const void *fdt, int nodeoff,
|
||||
const struct fdt_match *match)
|
||||
{
|
||||
int rc;
|
||||
@@ -90,7 +90,7 @@ static int starfive_gpio_init(const void *fdt, int nodeoff, u32 phandle,
|
||||
|
||||
chip->addr = addr;
|
||||
chip->chip.driver = &fdt_gpio_starfive;
|
||||
chip->chip.id = phandle;
|
||||
chip->chip.id = nodeoff;
|
||||
chip->chip.ngpio = STARFIVE_GPIO_PINS_DEF;
|
||||
chip->chip.direction_output = starfive_gpio_direction_output;
|
||||
chip->chip.set = starfive_gpio_set;
|
||||
|
Reference in New Issue
Block a user