diff options
author | loos <loos@FreeBSD.org> | 2014-11-18 17:22:08 +0000 |
---|---|---|
committer | loos <loos@FreeBSD.org> | 2014-11-18 17:22:08 +0000 |
commit | 9ad347c496791d44755a039c789c80c0d24da3cb (patch) | |
tree | eda20a10765b9706a2970cc5bb5554d7f74e4af9 /sys/arm/xscale | |
parent | e1857bb370d9a97ed8bd6dc4ca7cdc6e4836fe0b (diff) | |
download | FreeBSD-src-9ad347c496791d44755a039c789c80c0d24da3cb.zip FreeBSD-src-9ad347c496791d44755a039c789c80c0d24da3cb.tar.gz |
Moves all the duplicate code to a single function.
Verify for invalid modes and unwanted flags before pass the new flags to
driver.
Diffstat (limited to 'sys/arm/xscale')
-rw-r--r-- | sys/arm/xscale/ixp425/avila_gpio.c | 10 | ||||
-rw-r--r-- | sys/arm/xscale/ixp425/cambria_gpio.c | 9 |
2 files changed, 1 insertions, 18 deletions
diff --git a/sys/arm/xscale/ixp425/avila_gpio.c b/sys/arm/xscale/ixp425/avila_gpio.c index 48f970d..4a2d1e9 100644 --- a/sys/arm/xscale/ixp425/avila_gpio.c +++ b/sys/arm/xscale/ixp425/avila_gpio.c @@ -220,16 +220,8 @@ avila_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) if (pin >= IXP4XX_GPIO_PINS || !(sc->sc_valid & mask)) return (EINVAL); - /* Check for unwanted flags. */ - if ((flags & sc->sc_pins[pin].gp_caps) != flags) - return (EINVAL); - - /* Can't mix input/output together */ - if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) == - (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) - return (EINVAL); - avila_gpio_pin_configure(sc, &sc->sc_pins[pin], flags); + return (0); } diff --git a/sys/arm/xscale/ixp425/cambria_gpio.c b/sys/arm/xscale/ixp425/cambria_gpio.c index baa3483..7a773db 100644 --- a/sys/arm/xscale/ixp425/cambria_gpio.c +++ b/sys/arm/xscale/ixp425/cambria_gpio.c @@ -317,15 +317,6 @@ cambria_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) if (pin >= GPIO_PINS) return (EINVAL); - /* Check for unwanted flags. */ - if ((flags & sc->sc_pins[pin].gp_caps) != flags) - return (EINVAL); - - /* Can't mix input/output together */ - if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) == - (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) - return (EINVAL); - GPIO_LOCK(sc); sc->sc_pins[pin].gp_flags = flags; |