diff --git a/sys/dev/gpio/gpioled.c b/sys/dev/gpio/gpioled.c index a03c172d106f..dd7af6f8e7a2 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));