diff options
author | loos <loos@FreeBSD.org> | 2013-12-06 17:56:20 +0000 |
---|---|---|
committer | loos <loos@FreeBSD.org> | 2013-12-06 17:56:20 +0000 |
commit | 57309a802033303f21366c5b7648094711f59370 (patch) | |
tree | efb100ae09571da9482e89ec27ec7c7af9121003 /sys/dev/gpio | |
parent | 6d045dbc271fdda384cd476401e8e07c167b87fe (diff) | |
download | FreeBSD-src-57309a802033303f21366c5b7648094711f59370.zip FreeBSD-src-57309a802033303f21366c5b7648094711f59370.tar.gz |
Move the GPIOBUS_SET_PINFLAGS(..., ..., pin, GPIO_PIN_OUTPUT) to led(4)
control callback function. This makes gpioled(4) works even if the pin
is accidentally set to an input.
Approved by: adrian (mentor)
Diffstat (limited to 'sys/dev/gpio')
-rw-r--r-- | sys/dev/gpio/gpioled.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/dev/gpio/gpioled.c b/sys/dev/gpio/gpioled.c index a03c172..dd7af6f 100644 --- a/sys/dev/gpio/gpioled.c +++ b/sys/dev/gpio/gpioled.c @@ -75,6 +75,8 @@ gpioled_control(void *priv, int onoff) GPIOLED_LOCK(sc); GPIOBUS_LOCK_BUS(sc->sc_busdev); GPIOBUS_ACQUIRE_BUS(sc->sc_busdev, sc->sc_dev); + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, GPIOLED_PIN, + GPIO_PIN_OUTPUT); GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, GPIOLED_PIN, onoff ? GPIO_PIN_HIGH : GPIO_PIN_LOW); GPIOBUS_RELEASE_BUS(sc->sc_busdev, sc->sc_dev); @@ -103,9 +105,6 @@ gpioled_attach(device_t dev) device_get_unit(dev), "name", &name)) name = NULL; - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, GPIOLED_PIN, - GPIO_PIN_OUTPUT); - sc->sc_leddev = led_create(gpioled_control, sc, name ? name : device_get_nameunit(dev)); |