Skip to content

Commit

Permalink
lib: utils/gpio: Fix RV32 compile error for designware GPIO driver
Browse files Browse the repository at this point in the history
Currently, we see following compile error in the designeware GPIO driver
for RV32 systems:

lib/utils/gpio/fdt_gpio_designware.c:115:20: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
  115 |         chip->dr = (void *)addr + (bank * 0xc);
      |                    ^
lib/utils/gpio/fdt_gpio_designware.c:116:21: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
  116 |         chip->ext = (void *)addr + (bank * 4) + 0x50;

We fix the above error using an explicit type-cast to 'unsigned long'.

Fixes: 7828eeb ("gpio/desginware: add Synopsys DesignWare APB GPIO support")
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Xiang W <wxjstz@126.com>
  • Loading branch information
avpatel committed Jul 19, 2023
1 parent c6a3573 commit 057eb10
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/utils/gpio/fdt_gpio_designware.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ static int dw_gpio_init_bank(void *fdt, int nodeoff, u32 phandle,

chip = &dw_gpio_chip_array[dw_gpio_chip_count];

chip->dr = (void *)addr + (bank * 0xc);
chip->ext = (void *)addr + (bank * 4) + 0x50;
chip->dr = (void *)(uintptr_t)addr + (bank * 0xc);
chip->ext = (void *)(uintptr_t)addr + (bank * 4) + 0x50;
chip->chip.driver = &fdt_gpio_designware;
chip->chip.id = phandle;
chip->chip.ngpio = nr_pins;
Expand Down

0 comments on commit 057eb10

Please sign in to comment.