git: 2c1b8eb29d92 - main - ftgpio: Fix panic at attach and use better device description
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 02 Mar 2023 15:27:47 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2c1b8eb29d92d0911e7493c6a16be04ff6064ad1 commit 2c1b8eb29d92d0911e7493c6a16be04ff6064ad1 Author: Stéphane Rochoy <stephane.rochoy@stormshield.eu> AuthorDate: 2023-03-02 15:16:35 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2023-03-02 15:17:04 +0000 ftgpio: Fix panic at attach and use better device description Use ftgpio_group_get_status instead of inlining an imperfect version of it to get correct register and avoid panic: ftgpio_group_get_ioreg: invalid register 0 for group 0 Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/677 --- sys/dev/ftgpio/ftgpio.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/sys/dev/ftgpio/ftgpio.c b/sys/dev/ftgpio/ftgpio.c index 874f6e832949..7acfdd5b900e 100644 --- a/sys/dev/ftgpio/ftgpio.c +++ b/sys/dev/ftgpio/ftgpio.c @@ -103,7 +103,7 @@ struct ftgpio_device { } ftgpio_devices[] = { { .devid = 0x0704, - .descr = "GPIO Controller on Fintek Super I/O", + .descr = "Fintek F81865", }, }; @@ -289,18 +289,12 @@ static bool ftgpio_pin_is_output(struct ftgpio_softc *sc, uint32_t pin_num) { unsigned group, index; - uint8_t group_io, ioreg; bool is_output; index = FTGPIO_PIN_GETINDEX(pin_num); group = FTGPIO_PIN_GETGROUP(pin_num); - ioreg = ftgpio_group_get_ioreg(sc, REG_OUTPUT_ENABLE, group); - group_io = superio_read(sc->dev, ioreg); - FTGPIO_VERBOSE_PRINTF(sc->dev, "group GPIO%u io is 0x%x (ioreg=0x%x)\n", - group, group_io, ioreg); - - is_output = group_io & (1 << index); + is_output = ftgpio_group_get_status(sc, group) & (1 << index); FTGPIO_VERBOSE_PRINTF(sc->dev, "pin %u<GPIO%u%u> io is %s\n", pin_num, group, index, (is_output ? "output" : "input")); return (is_output);