sys/bus/u4b/serial/usb_serial.c
void
ucom_detach(struct ucom_super_softc *ssc, struct ucom_softc *sc)
{
	uint32_t subunit;

	if (ssc->sc_subunits == 0)
		return;		/* not initialized */

	if (ssc->sc_sysctl_ttyname != NULL) {
		sysctl_remove_oid(ssc->sc_sysctl_ttyname, 1, 0);
		ssc->sc_sysctl_ttyname = NULL;
	}

	if (ssc->sc_sysctl_ttyports != NULL) {
		sysctl_remove_oid(ssc->sc_sysctl_ttyports, 1, 0);
		ssc->sc_sysctl_ttyports = NULL;
	}

	usb_proc_drain(&ssc->sc_tq);

	for (subunit = 0; subunit < ssc->sc_subunits; subunit++) {
		if (sc[subunit].sc_flag & UCOM_FLAG_ATTACHED) {

			ucom_detach_tty(&sc[subunit]);

			/* avoid duplicate detach */
			sc[subunit].sc_flag &= ~UCOM_FLAG_ATTACHED;
		}
	}
	ucom_unit_free(ssc->sc_unit);
	usb_proc_free(&ssc->sc_tq);
}
/*
 * NOTE: the following function will do nothing if
 * the structure pointed to by "ssc" and "sc" is zero.
 */
the following function will do nothing if
the structure pointed to by "ssc" and "sc" is zero.
the following function will do nothing if the structure pointed to by " ssc " and " sc " is zero .
void
ucom_detach(struct ucom_super_softc *ssc, struct ucom_softc *sc)
{
	uint32_t subunit;
	if (ssc->sc_subunits == 0)
		return;		
	if (ssc->sc_sysctl_ttyname != NULL) {
		sysctl_remove_oid(ssc->sc_sysctl_ttyname, 1, 0);
		ssc->sc_sysctl_ttyname = NULL;
	}
	if (ssc->sc_sysctl_ttyports != NULL) {
		sysctl_remove_oid(ssc->sc_sysctl_ttyports, 1, 0);
		ssc->sc_sysctl_ttyports = NULL;
	}
	usb_proc_drain(&ssc->sc_tq);
	for (subunit = 0; subunit < ssc->sc_subunits; subunit++) {
		if (sc[subunit].sc_flag & UCOM_FLAG_ATTACHED) {
			ucom_detach_tty(&sc[subunit]);
			sc[subunit].sc_flag &= ~UCOM_FLAG_ATTACHED;
		}
	}
	ucom_unit_free(ssc->sc_unit);
	usb_proc_free(&ssc->sc_tq);
}
void ucom_detach ( struct ucom_super_softc * ssc , struct ucom_softc * sc ) { uint32_t subunit ; if ( ssc -> sc_subunits == 0 ) return ; if ( ssc -> sc_sysctl_ttyname != NULL ) { sysctl_remove_oid ( ssc -> sc_sysctl_ttyname , 1 , 0 ) ; ssc -> sc_sysctl_ttyname = NULL ; } if ( ssc -> sc_sysctl_ttyports != NULL ) { sysctl_remove_oid ( ssc -> sc_sysctl_ttyports , 1 , 0 ) ; ssc -> sc_sysctl_ttyports = NULL ; } usb_proc_drain ( & ssc -> sc_tq ) ; for ( subunit = 0 ; subunit < ssc -> sc_subunits ; subunit ++ ) { if ( sc [ subunit ] . sc_flag & UCOM_FLAG_ATTACHED ) { ucom_detach_tty ( & sc [ subunit ] ) ; sc [ subunit ] . sc_flag &= ~ UCOM_FLAG_ATTACHED ; } } ucom_unit_free ( ssc -> sc_unit ) ; usb_proc_free ( & ssc -> sc_tq ) ; }
NOTE: the following function will do nothing if
 the structure pointed to by "ssc" and "sc" is zero.
NOTE : the following function will do nothing if the structure pointed to by " ssc " and " sc " is zero .
/* not initialized */ /* avoid duplicate detach */