Lines Matching full:ssc

264 ucom_attach(struct ucom_super_softc *ssc, struct ucom_softc *sc,  in ucom_attach()  argument
279 ssc->sc_unit = ucom_unit_alloc(); in ucom_attach()
280 if (ssc->sc_unit == -1) in ucom_attach()
284 snprintf(ssc->sc_ttyname, sizeof(ssc->sc_ttyname), in ucom_attach()
285 UCOM_TTY_PREFIX "%d", ssc->sc_unit); in ucom_attach()
288 error = usb_proc_create(&ssc->sc_tq, mtx, "ucom", USB_PRI_MED); in ucom_attach()
290 ucom_unit_free(ssc->sc_unit); in ucom_attach()
293 ssc->sc_subunits = subunits; in ucom_attach()
294 ssc->sc_flag = UCOM_FLAG_ATTACHED | in ucom_attach()
295 UCOM_FLAG_FREE_UNIT | (ssc->sc_flag & UCOM_FLAG_DEVICE_MODE); in ucom_attach()
298 ssc->sc_flag |= UCOM_FLAG_WAIT_REFS; in ucom_attach()
301 ucom_ref(ssc); in ucom_attach()
303 for (subunit = 0; subunit < ssc->sc_subunits; subunit++) { in ucom_attach()
305 sc[subunit].sc_super = ssc; in ucom_attach()
310 error = ucom_attach_tty(ssc, &sc[subunit]); in ucom_attach()
312 ucom_detach(ssc, &sc[0]); in ucom_attach()
316 ucom_ref(ssc); in ucom_attach()
323 sc->sc_tty, ssc->sc_unit, ssc->sc_subunits); in ucom_attach()
330 * by "ssc" and "sc" is zero or has already been detached.
333 ucom_detach(struct ucom_super_softc *ssc, struct ucom_softc *sc) in ucom_detach() argument
337 if (!(ssc->sc_flag & UCOM_FLAG_ATTACHED)) in ucom_detach()
340 if (ssc->sc_sysctl_ttyname != NULL) { in ucom_detach()
341 sysctl_remove_oid(ssc->sc_sysctl_ttyname, 1, 0); in ucom_detach()
342 ssc->sc_sysctl_ttyname = NULL; in ucom_detach()
345 if (ssc->sc_sysctl_ttyports != NULL) { in ucom_detach()
346 sysctl_remove_oid(ssc->sc_sysctl_ttyports, 1, 0); in ucom_detach()
347 ssc->sc_sysctl_ttyports = NULL; in ucom_detach()
350 usb_proc_drain(&ssc->sc_tq); in ucom_detach()
352 for (subunit = 0; subunit < ssc->sc_subunits; subunit++) { in ucom_detach()
354 ucom_detach_tty(ssc, &sc[subunit]); in ucom_detach()
360 usb_proc_free(&ssc->sc_tq); in ucom_detach()
362 ucom_unref(ssc); in ucom_detach()
364 if (ssc->sc_flag & UCOM_FLAG_WAIT_REFS) in ucom_detach()
365 ucom_drain(ssc); in ucom_detach()
368 ssc->sc_flag &= ~UCOM_FLAG_ATTACHED; in ucom_detach()
372 ucom_drain(struct ucom_super_softc *ssc) in ucom_drain() argument
375 while (ssc->sc_refs > 0) { in ucom_drain()
413 ucom_attach_tty(struct ucom_super_softc *ssc, struct ucom_softc *sc) in ucom_attach_tty() argument
426 sizeof(buf), ssc->sc_unit, sc->sc_subunit); in ucom_attach_tty()
430 if (ssc->sc_subunits > 1) { in ucom_attach_tty()
433 ssc->sc_unit, sc->sc_subunit); in ucom_attach_tty()
437 ssc->sc_unit); in ucom_attach_tty()
453 (ssc->sc_unit == ucom_cons_unit) && in ucom_attach_tty()
456 ssc->sc_unit, sc->sc_subunit); in ucom_attach_tty()
473 if ((ssc->sc_flag & UCOM_FLAG_DEVICE_MODE) != 0 && in ucom_attach_tty()
495 ucom_detach_tty(struct ucom_super_softc *ssc, struct ucom_softc *sc) in ucom_detach_tty() argument
546 ucom_set_pnpinfo_usb(struct ucom_super_softc *ssc, device_t dev) in ucom_set_pnpinfo_usb() argument
553 "%d ttyports=%d", ssc->sc_unit, ssc->sc_subunits); in ucom_set_pnpinfo_usb()
566 if (ssc->sc_sysctl_ttyname == NULL) { in ucom_set_pnpinfo_usb()
567 ssc->sc_sysctl_ttyname = SYSCTL_ADD_STRING(NULL, in ucom_set_pnpinfo_usb()
569 OID_AUTO, "ttyname", CTLFLAG_RD, ssc->sc_ttyname, 0, in ucom_set_pnpinfo_usb()
572 if (ssc->sc_sysctl_ttyports == NULL) { in ucom_set_pnpinfo_usb()
573 ssc->sc_sysctl_ttyports = SYSCTL_ADD_INT(NULL, in ucom_set_pnpinfo_usb()
576 NULL, ssc->sc_subunits, "Number of ports"); in ucom_set_pnpinfo_usb()
581 ucom_set_usb_mode(struct ucom_super_softc *ssc, enum usb_hc_mode usb_mode) in ucom_set_usb_mode() argument
586 ssc->sc_flag |= UCOM_FLAG_DEVICE_MODE; in ucom_set_usb_mode()
589 ssc->sc_flag &= ~UCOM_FLAG_DEVICE_MODE; in ucom_set_usb_mode()
608 struct ucom_super_softc *ssc = sc->sc_super; in ucom_command_barrier() local
615 if (usb_proc_is_gone(&ssc->sc_tq)) { in ucom_command_barrier()
620 task = usb_proc_msignal(&ssc->sc_tq, &dummy, &dummy); in ucom_command_barrier()
621 error = usb_proc_mwait_sig(&ssc->sc_tq, task, task); in ucom_command_barrier()
632 struct ucom_super_softc *ssc = sc->sc_super; in ucom_queue_command() local
638 if (usb_proc_is_gone(&ssc->sc_tq)) { in ucom_queue_command()
648 usb_proc_msignal(&ssc->sc_tq, t0, t1); in ucom_queue_command()
665 error = usb_proc_mwait_sig(&ssc->sc_tq, t0, t1); in ucom_queue_command()
709 struct ucom_super_softc *ssc = sc->sc_super; in ucom_cfg_is_gone() local
711 return (usb_proc_is_gone(&ssc->sc_tq)); in ucom_cfg_is_gone()
1756 ucom_ref(struct ucom_super_softc *ssc) in ucom_ref() argument
1759 ssc->sc_refs++; in ucom_ref()
1771 ucom_free_unit(struct ucom_super_softc *ssc) in ucom_free_unit() argument
1773 if (!(ssc->sc_flag & UCOM_FLAG_FREE_UNIT)) in ucom_free_unit()
1776 ucom_unit_free(ssc->sc_unit); in ucom_free_unit()
1778 ssc->sc_flag &= ~UCOM_FLAG_FREE_UNIT; in ucom_free_unit()
1791 ucom_unref(struct ucom_super_softc *ssc) in ucom_unref() argument
1796 retval = (ssc->sc_refs < 2); in ucom_unref()
1797 ssc->sc_refs--; in ucom_unref()
1801 ucom_free_unit(ssc); in ucom_unref()