In detach(), call bus_generic_detach() before deleting the iicbus child.
This gives the bus and its children the chance to return EBUSY to abort the detach if they're in the middle of doing some IO.
This commit is contained in:
parent
b93539730b
commit
b71764df96
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=349116
@ -735,8 +735,6 @@ ti_i2c_deactivate(device_t dev)
|
|||||||
sc->sc_irq_h = NULL;
|
sc->sc_irq_h = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bus_generic_detach(sc->sc_dev);
|
|
||||||
|
|
||||||
/* Unmap the I2C controller registers. */
|
/* Unmap the I2C controller registers. */
|
||||||
if (sc->sc_mem_res != NULL) {
|
if (sc->sc_mem_res != NULL) {
|
||||||
bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
|
bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
|
||||||
@ -925,12 +923,19 @@ ti_i2c_detach(device_t dev)
|
|||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
sc = device_get_softc(dev);
|
sc = device_get_softc(dev);
|
||||||
ti_i2c_deactivate(dev);
|
|
||||||
TI_I2C_LOCK_DESTROY(sc);
|
if ((rv = bus_generic_detach(dev)) != 0) {
|
||||||
if (sc->sc_iicbus &&
|
device_printf(dev, "cannot detach child devices\n");
|
||||||
|
return (rv);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sc->sc_iicbus &&
|
||||||
(rv = device_delete_child(dev, sc->sc_iicbus)) != 0)
|
(rv = device_delete_child(dev, sc->sc_iicbus)) != 0)
|
||||||
return (rv);
|
return (rv);
|
||||||
|
|
||||||
|
ti_i2c_deactivate(dev);
|
||||||
|
TI_I2C_LOCK_DESTROY(sc);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user