From 6153d465151113fae30d41bb2af9f77d813eea6f Mon Sep 17 00:00:00 2001 From: Luiz Otavio O Souza Date: Thu, 5 Mar 2015 03:11:47 +0000 Subject: [PATCH] Use the child device name here is lame because at the point that this happens, the child device is not yet specified. --- sys/dev/gpio/gpiobus.c | 9 ++++----- sys/dev/gpio/gpiobusvar.h | 2 +- sys/dev/gpio/ofw_gpiobus.c | 3 +-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c index 89740d1be016..11a33d73e614 100644 --- a/sys/dev/gpio/gpiobus.c +++ b/sys/dev/gpio/gpiobus.c @@ -230,21 +230,20 @@ gpiobus_free_ivars(struct gpiobus_ivar *devi) } int -gpiobus_map_pin(device_t bus, device_t child, uint32_t pin) +gpiobus_map_pin(device_t bus, uint32_t pin) { struct gpiobus_softc *sc; sc = device_get_softc(bus); /* Consistency check. */ if (pin >= sc->sc_npins) { - device_printf(child, + device_printf(bus, "invalid pin %d, max: %d\n", pin, sc->sc_npins - 1); return (-1); } /* Mark pin as mapped and give warning if it's already mapped. */ if (sc->sc_pins_mapped[pin]) { - device_printf(child, - "warning: pin %d is already mapped\n", pin); + device_printf(bus, "warning: pin %d is already mapped\n", pin); return (-1); } sc->sc_pins_mapped[pin] = 1; @@ -277,7 +276,7 @@ gpiobus_parse_pins(struct gpiobus_softc *sc, device_t child, int mask) if ((mask & (1 << i)) == 0) continue; /* Reserve the GPIO pin. */ - if (gpiobus_map_pin(sc->sc_busdev, child, i) != 0) { + if (gpiobus_map_pin(sc->sc_busdev, i) != 0) { gpiobus_free_ivars(devi); return (EINVAL); } diff --git a/sys/dev/gpio/gpiobusvar.h b/sys/dev/gpio/gpiobusvar.h index beffb7faf647..315709a448ae 100644 --- a/sys/dev/gpio/gpiobusvar.h +++ b/sys/dev/gpio/gpiobusvar.h @@ -110,7 +110,7 @@ int gpiobus_detach_bus(device_t); int gpiobus_init_softc(device_t); int gpiobus_alloc_ivars(struct gpiobus_ivar *); void gpiobus_free_ivars(struct gpiobus_ivar *); -int gpiobus_map_pin(device_t, device_t, uint32_t); +int gpiobus_map_pin(device_t, uint32_t); extern driver_t gpiobus_driver; diff --git a/sys/dev/gpio/ofw_gpiobus.c b/sys/dev/gpio/ofw_gpiobus.c index 3eb6b860d4c5..da72d4dfed20 100644 --- a/sys/dev/gpio/ofw_gpiobus.c +++ b/sys/dev/gpio/ofw_gpiobus.c @@ -282,8 +282,7 @@ ofw_gpiobus_parse_gpios_impl(device_t consumer, phandle_t cnode, char *pname, goto fail; } /* Reserve the GPIO pin. */ - if (gpiobus_map_pin(bussc->sc_busdev, consumer, - (*pins)[j].pin) != 0) + if (gpiobus_map_pin(bussc->sc_busdev, (*pins)[j].pin) != 0) goto fail; j++; i += gpiocells + 1;