From c45b84225021c61fedc3a4e1bdeb3f5b6abda748 Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Thu, 26 May 2016 15:45:36 +0000 Subject: [PATCH] Rename gpiobus_map_pin() to gpiobus_acquire_pin(), to better reflect the fact that the caller is requesting exclusive use of the pin, and also to better match the inverse operation which is named gpiobus_release_pin(). --- sys/dev/extres/regulator/regulator_fixed.c | 4 ++-- sys/dev/gpio/gpiobus.c | 8 ++++---- sys/dev/gpio/gpiobusvar.h | 2 +- sys/dev/gpio/ofw_gpiobus.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/dev/extres/regulator/regulator_fixed.c b/sys/dev/extres/regulator/regulator_fixed.c index 5a44a72ffa3..1438181eafe 100644 --- a/sys/dev/extres/regulator/regulator_fixed.c +++ b/sys/dev/extres/regulator/regulator_fixed.c @@ -115,8 +115,8 @@ regnode_get_gpio_entry(struct gpiobus_pin *gpio_pin) } /* Reserve pin. */ - /* XXX Can we call gpiobus_map_pin() with gpio_list_mtx mutex held? */ - rv = gpiobus_map_pin(busdev, gpio_pin->pin); + /* XXX Can we call gpiobus_acquire_pin() with gpio_list_mtx held? */ + rv = gpiobus_acquire_pin(busdev, gpio_pin->pin); if (rv != 0) { mtx_unlock(&gpio_list_mtx); free(entry, M_FIXEDREGULATOR); diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c index 21e33b8b36c..13768c37354 100644 --- a/sys/dev/gpio/gpiobus.c +++ b/sys/dev/gpio/gpiobus.c @@ -260,7 +260,7 @@ gpiobus_free_ivars(struct gpiobus_ivar *devi) } int -gpiobus_map_pin(device_t bus, uint32_t pin) +gpiobus_acquire_pin(device_t bus, uint32_t pin) { struct gpiobus_softc *sc; @@ -291,13 +291,13 @@ gpiobus_release_pin(device_t bus, uint32_t pin) /* Consistency check. */ if (pin >= sc->sc_npins) { device_printf(bus, - "gpiobus_map_pin: invalid pin %d, max=%d\n", + "gpiobus_acquire_pin: invalid pin %d, max=%d\n", pin, sc->sc_npins - 1); return (-1); } if (!sc->sc_pins[pin].mapped) { - device_printf(bus, "gpiobus_map_pin: pin %d is not mapped\n", pin); + device_printf(bus, "gpiobus_acquire_pin: pin %d is not mapped\n", pin); return (-1); } sc->sc_pins[pin].mapped = 0; @@ -330,7 +330,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, i) != 0) { + if (gpiobus_acquire_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 bc4e633a526..2046a6f7fb6 100644 --- a/sys/dev/gpio/gpiobusvar.h +++ b/sys/dev/gpio/gpiobusvar.h @@ -137,7 +137,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, uint32_t); +int gpiobus_acquire_pin(device_t, uint32_t); int gpiobus_release_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 f02f4f900d3..c1495a98ae8 100644 --- a/sys/dev/gpio/ofw_gpiobus.c +++ b/sys/dev/gpio/ofw_gpiobus.c @@ -95,7 +95,7 @@ gpio_pin_get_by_ofw_impl(device_t consumer, phandle_t cnode, return (ENXIO); /* Reserve GPIO pin. */ - rv = gpiobus_map_pin(busdev, pin.pin); + rv = gpiobus_acquire_pin(busdev, pin.pin); if (rv != 0) return (EBUSY); @@ -457,7 +457,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, (*pins)[j].pin) != 0) + if (gpiobus_acquire_pin(bussc->sc_busdev, (*pins)[j].pin) != 0) goto fail; j++; i += gpiocells + 1;