svn commit: r300392 - head/sys/dev/gpio
Luiz Otavio O Souza
loos at FreeBSD.org
Sun May 22 03:55:59 UTC 2016
Author: loos
Date: Sun May 22 03:55:57 2016
New Revision: 300392
URL: https://svnweb.freebsd.org/changeset/base/300392
Log:
Get rid of two consumers of gpiobus acquire/release.
The GPIO hardware should not be owned by a single device, this defeats any
chance of use of the GPIO controller as an interrupt source.
ow(4) is now the only consumer of this 'feature' before we can remove it
for good.
Discussed with: ian, bsdimp
Modified:
head/sys/dev/gpio/gpioiic.c
head/sys/dev/gpio/gpioled.c
Modified: head/sys/dev/gpio/gpioiic.c
==============================================================================
--- head/sys/dev/gpio/gpioiic.c Sun May 22 03:34:18 2016 (r300391)
+++ head/sys/dev/gpio/gpioiic.c Sun May 22 03:55:57 2016 (r300392)
@@ -70,7 +70,6 @@ static int gpioiic_attach(device_t);
/* iicbb interface */
static void gpioiic_reset_bus(device_t);
-static int gpioiic_callback(device_t, int, caddr_t);
static void gpioiic_setsda(device_t, int);
static void gpioiic_setscl(device_t, int);
static int gpioiic_getsda(device_t);
@@ -161,30 +160,6 @@ gpioiic_reset_bus(device_t dev)
GPIO_PIN_INPUT);
}
-static int
-gpioiic_callback(device_t dev, int index, caddr_t data)
-{
- struct gpioiic_softc *sc = device_get_softc(dev);
- int error, how;
-
- how = GPIOBUS_DONTWAIT;
- if (data != NULL && *(int*)data == IIC_WAIT)
- how = GPIOBUS_WAIT;
- error = 0;
- switch (index) {
- case IIC_REQUEST_BUS:
- error = GPIOBUS_ACQUIRE_BUS(sc->sc_busdev, sc->sc_dev, how);
- break;
- case IIC_RELEASE_BUS:
- GPIOBUS_RELEASE_BUS(sc->sc_busdev, sc->sc_dev);
- break;
- default:
- error = EINVAL;
- }
-
- return (error);
-}
-
static void
gpioiic_setsda(device_t dev, int val)
{
@@ -271,7 +246,6 @@ static device_method_t gpioiic_methods[]
DEVMETHOD(device_detach, bus_generic_detach),
/* iicbb interface */
- DEVMETHOD(iicbb_callback, gpioiic_callback),
DEVMETHOD(iicbb_setsda, gpioiic_setsda),
DEVMETHOD(iicbb_setscl, gpioiic_setscl),
DEVMETHOD(iicbb_getsda, gpioiic_getsda),
Modified: head/sys/dev/gpio/gpioled.c
==============================================================================
--- head/sys/dev/gpio/gpioled.c Sun May 22 03:34:18 2016 (r300391)
+++ head/sys/dev/gpio/gpioled.c Sun May 22 03:55:57 2016 (r300392)
@@ -76,23 +76,15 @@ static int gpioled_detach(device_t);
static void
gpioled_control(void *priv, int onoff)
{
- int error;
struct gpioled_softc *sc;
sc = (struct gpioled_softc *)priv;
GPIOLED_LOCK(sc);
- error = GPIOBUS_ACQUIRE_BUS(sc->sc_busdev, sc->sc_dev,
- GPIOBUS_DONTWAIT);
- if (error != 0) {
- GPIOLED_UNLOCK(sc);
- return;
- }
- error = GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev,
- GPIOLED_PIN, GPIO_PIN_OUTPUT);
- if (error == 0)
+ if (GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, GPIOLED_PIN,
+ GPIO_PIN_OUTPUT) == 0) {
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);
+ }
GPIOLED_UNLOCK(sc);
}
More information about the svn-src-head
mailing list