FreeBSD/sys/dev/twe/twe_freebsd.c
/********************************************************************************
 * Disconnect from the controller completely, in preparation for unload.
 */
Disconnect from the controller completely, in preparation for unload.
Disconnect from the controller completely in preparation for unload .
static int
twe_detach(device_t dev)
{
    struct twe_softc	*sc = device_get_softc(dev);
    debug_called(4);
    TWE_IO_LOCK(sc);
    if (sc->twe_state & TWE_STATE_OPEN) {
	TWE_IO_UNLOCK(sc);
	return (EBUSY);
    }
    sc->twe_state |= TWE_STATE_DETACHING;
    TWE_IO_UNLOCK(sc);
    if (twe_shutdown(dev)) {
	TWE_IO_LOCK(sc);
	sc->twe_state &= ~TWE_STATE_DETACHING;
	TWE_IO_UNLOCK(sc);
	return (EBUSY);
    }
    twe_free(sc);
    return(0);
}
static int twe_detach ( device_t dev ) { struct twe_softc * sc = device_get_softc ( dev ) ; debug_called ( 4 ) ; TWE_IO_LOCK ( sc ) ; if ( sc -> twe_state & TWE_STATE_OPEN ) { TWE_IO_UNLOCK ( sc ) ; return ( EBUSY ) ; } sc -> twe_state |= TWE_STATE_DETACHING ; TWE_IO_UNLOCK ( sc ) ; if ( twe_shutdown ( dev ) ) { TWE_IO_LOCK ( sc ) ; sc -> twe_state &= ~ TWE_STATE_DETACHING ; TWE_IO_UNLOCK ( sc ) ; return ( EBUSY ) ; } twe_free ( sc ) ; return ( 0 ) ; }
Disconnect from the controller completely, in preparation for unload.
Disconnect from the controller completely in preparation for unload .
/*	
     * Shut the controller down.
     */