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().
This commit is contained in:
parent
83829b483d
commit
c45b842250
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user