Use the child device name here is lame because at the point that this
happens, the child device is not yet specified.
This commit is contained in:
parent
6ad7f49152
commit
6153d46515
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=279622
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user