Date: Fri, 6 Dec 2013 17:56:20 +0000 (UTC) From: Luiz Otavio O Souza <loos@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r259036 - head/sys/dev/gpio Message-ID: <201312061756.rB6HuK78063456@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: loos Date: Fri Dec 6 17:56:20 2013 New Revision: 259036 URL: http://svnweb.freebsd.org/changeset/base/259036 Log: 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) Modified: head/sys/dev/gpio/gpioled.c Modified: head/sys/dev/gpio/gpioled.c ============================================================================== --- head/sys/dev/gpio/gpioled.c Fri Dec 6 17:49:34 2013 (r259035) +++ head/sys/dev/gpio/gpioled.c Fri Dec 6 17:56:20 2013 (r259036) @@ -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));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312061756.rB6HuK78063456>