summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuiz Otavio O Souza <loos@FreeBSD.org>2016-05-22 03:55:57 +0000
committerLuiz Otavio O Souza <loos@FreeBSD.org>2016-05-22 03:55:57 +0000
commit03302aa37f00a2cba5baebcb93b726befb671dc2 (patch)
tree61a8d4294529072a66ca2344d08c891a805ee386
parent16119eeded56322fd90ec4b39f0fa722229983ea (diff)
Notes
-rw-r--r--sys/dev/gpio/gpioiic.c26
-rw-r--r--sys/dev/gpio/gpioled.c14
2 files changed, 3 insertions, 37 deletions
diff --git a/sys/dev/gpio/gpioiic.c b/sys/dev/gpio/gpioiic.c
index 4b39bd110750..0a84a295e0db 100644
--- a/sys/dev/gpio/gpioiic.c
+++ b/sys/dev/gpio/gpioiic.c
@@ -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),
diff --git a/sys/dev/gpio/gpioled.c b/sys/dev/gpio/gpioled.c
index 17ae8323dc5e..bd77f5386d53 100644
--- a/sys/dev/gpio/gpioled.c
+++ b/sys/dev/gpio/gpioled.c
@@ -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);
}