aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Holland <samuel.holland@sifive.com>2024-09-03 19:09:37 -0700
committerAnup Patel <anup@brainfault.org>2024-11-05 17:54:37 +0530
commit598cf961d82a12afa3ccbed9645edae2275b76f3 (patch)
tree4cc108a9bf449a9c0c2789c0af71de71b2d87c37
parent99b01ab610acf6ff7c3d0199f13f5b41322a22e2 (diff)
downloadopensbi-598cf961d82a12afa3ccbed9645edae2275b76f3.zip
opensbi-598cf961d82a12afa3ccbed9645edae2275b76f3.tar.gz
opensbi-598cf961d82a12afa3ccbed9645edae2275b76f3.tar.bz2
lib: utils/gpio: Remove fdt_gpio_driver() function
This function looks up a chip's driver by matching known drivers against chip->driver, but that is equivalent to using chip->driver directly. Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
-rw-r--r--lib/utils/gpio/fdt_gpio.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/lib/utils/gpio/fdt_gpio.c b/lib/utils/gpio/fdt_gpio.c
index d8d847f..6422c45 100644
--- a/lib/utils/gpio/fdt_gpio.c
+++ b/lib/utils/gpio/fdt_gpio.c
@@ -16,21 +16,6 @@
extern struct fdt_gpio *fdt_gpio_drivers[];
extern unsigned long fdt_gpio_drivers_size;
-static struct fdt_gpio *fdt_gpio_driver(struct gpio_chip *chip)
-{
- int pos;
-
- if (!chip)
- return NULL;
-
- for (pos = 0; pos < fdt_gpio_drivers_size; pos++) {
- if (chip->driver == fdt_gpio_drivers[pos])
- return fdt_gpio_drivers[pos];
- }
-
- return NULL;
-}
-
static int fdt_gpio_init(const void *fdt, u32 phandle)
{
int pos, nodeoff, rc;
@@ -112,7 +97,7 @@ int fdt_gpio_pin_get(const void *fdt, int nodeoff, int index,
if (rc)
return rc;
- drv = fdt_gpio_driver(chip);
+ drv = chip->driver;
if (!drv || !drv->xlate)
return SBI_ENOSYS;