FreeBSD/sys/dev/twe/twe_freebsd.c
/********************************************************************************
 * Detach the specified unit if it exsists
 *
 * This is called from twe_del_unit.
 */
Detach the specified unit if it exsists
This is called from twe_del_unit.
Detach the specified unit if it exsists This is called from twe_del_unit .
int
twe_detach_drive(struct twe_softc *sc, int unit)
{
    int error = 0;
    TWE_CONFIG_ASSERT_LOCKED(sc);
    mtx_lock(&Giant);
    error = device_delete_child(sc->twe_dev, sc->twe_drive[unit].td_disk);
    mtx_unlock(&Giant);
    if (error != 0) {
	twe_printf(sc, "failed to delete unit %d\n", unit);
	return(error);
    }
    bzero(&sc->twe_drive[unit], sizeof(sc->twe_drive[unit]));
    return(error);
}
int twe_detach_drive ( struct twe_softc * sc , int unit ) { int error = 0 ; TWE_CONFIG_ASSERT_LOCKED ( sc ) ; mtx_lock ( & Giant ) ; error = device_delete_child ( sc -> twe_dev , sc -> twe_drive [ unit ] . td_disk ) ; mtx_unlock ( & Giant ) ; if ( error != 0 ) { twe_printf ( sc , " \n " , unit ) ; return ( error ) ; } bzero ( & sc -> twe_drive [ unit ] , sizeof ( sc -> twe_drive [ unit ] ) ) ; return ( error ) ; }
Detach the specified unit if it exsists
 This is called from twe_del_unit.
Detach the specified unit if it exsists This is called from twe_del_unit .