Lines Matching refs:ssc
265 ucom_attach(struct ucom_super_softc *ssc, struct ucom_softc *sc, in ucom_attach() argument
280 ssc->sc_unit = ucom_unit_alloc(); in ucom_attach()
281 if (ssc->sc_unit == -1) in ucom_attach()
285 snprintf(ssc->sc_ttyname, sizeof(ssc->sc_ttyname), in ucom_attach()
286 UCOM_TTY_PREFIX "%d", ssc->sc_unit); in ucom_attach()
289 error = usb_proc_create(&ssc->sc_tq, mtx, "ucom", USB_PRI_MED); in ucom_attach()
291 ucom_unit_free(ssc->sc_unit); in ucom_attach()
294 ssc->sc_subunits = subunits; in ucom_attach()
295 ssc->sc_flag = UCOM_FLAG_ATTACHED | in ucom_attach()
296 UCOM_FLAG_FREE_UNIT | (ssc->sc_flag & UCOM_FLAG_DEVICE_MODE); in ucom_attach()
299 ssc->sc_flag |= UCOM_FLAG_WAIT_REFS; in ucom_attach()
302 ucom_ref(ssc); in ucom_attach()
304 for (subunit = 0; subunit < ssc->sc_subunits; subunit++) { in ucom_attach()
306 sc[subunit].sc_super = ssc; in ucom_attach()
311 error = ucom_attach_tty(ssc, &sc[subunit]); in ucom_attach()
313 ucom_detach(ssc, &sc[0]); in ucom_attach()
317 ucom_ref(ssc); in ucom_attach()
324 sc->sc_tty, ssc->sc_unit, ssc->sc_subunits); in ucom_attach()
334 ucom_detach(struct ucom_super_softc *ssc, struct ucom_softc *sc) in ucom_detach() argument
338 if (!(ssc->sc_flag & UCOM_FLAG_ATTACHED)) in ucom_detach()
341 if (ssc->sc_sysctl_ttyname != NULL) { in ucom_detach()
342 sysctl_remove_oid(ssc->sc_sysctl_ttyname, 1, 0); in ucom_detach()
343 ssc->sc_sysctl_ttyname = NULL; in ucom_detach()
346 if (ssc->sc_sysctl_ttyports != NULL) { in ucom_detach()
347 sysctl_remove_oid(ssc->sc_sysctl_ttyports, 1, 0); in ucom_detach()
348 ssc->sc_sysctl_ttyports = NULL; in ucom_detach()
351 usb_proc_drain(&ssc->sc_tq); in ucom_detach()
353 for (subunit = 0; subunit < ssc->sc_subunits; subunit++) { in ucom_detach()
355 ucom_detach_tty(ssc, &sc[subunit]); in ucom_detach()
361 usb_proc_free(&ssc->sc_tq); in ucom_detach()
363 ucom_unref(ssc); in ucom_detach()
365 if (ssc->sc_flag & UCOM_FLAG_WAIT_REFS) in ucom_detach()
366 ucom_drain(ssc); in ucom_detach()
369 ssc->sc_flag &= ~UCOM_FLAG_ATTACHED; in ucom_detach()
373 ucom_drain(struct ucom_super_softc *ssc) in ucom_drain() argument
376 while (ssc->sc_refs > 0) { in ucom_drain()
414 ucom_attach_tty(struct ucom_super_softc *ssc, struct ucom_softc *sc) in ucom_attach_tty() argument
427 sizeof(buf), ssc->sc_unit, sc->sc_subunit); in ucom_attach_tty()
431 if (ssc->sc_subunits > 1) { in ucom_attach_tty()
434 ssc->sc_unit, sc->sc_subunit); in ucom_attach_tty()
438 ssc->sc_unit); in ucom_attach_tty()
454 (ssc->sc_unit == ucom_cons_unit) && in ucom_attach_tty()
457 ssc->sc_unit, sc->sc_subunit); in ucom_attach_tty()
474 if ((ssc->sc_flag & UCOM_FLAG_DEVICE_MODE) != 0 && in ucom_attach_tty()
496 ucom_detach_tty(struct ucom_super_softc *ssc, struct ucom_softc *sc) in ucom_detach_tty() argument
547 ucom_set_pnpinfo_usb(struct ucom_super_softc *ssc, device_t dev) in ucom_set_pnpinfo_usb() argument
554 "%d ttyports=%d", ssc->sc_unit, ssc->sc_subunits); in ucom_set_pnpinfo_usb()
567 if (ssc->sc_sysctl_ttyname == NULL) { in ucom_set_pnpinfo_usb()
568 ssc->sc_sysctl_ttyname = SYSCTL_ADD_STRING(NULL, in ucom_set_pnpinfo_usb()
570 OID_AUTO, "ttyname", CTLFLAG_RD, ssc->sc_ttyname, 0, in ucom_set_pnpinfo_usb()
573 if (ssc->sc_sysctl_ttyports == NULL) { in ucom_set_pnpinfo_usb()
574 ssc->sc_sysctl_ttyports = SYSCTL_ADD_INT(NULL, in ucom_set_pnpinfo_usb()
577 NULL, ssc->sc_subunits, "Number of ports"); in ucom_set_pnpinfo_usb()
582 ucom_set_usb_mode(struct ucom_super_softc *ssc, enum usb_hc_mode usb_mode) in ucom_set_usb_mode() argument
587 ssc->sc_flag |= UCOM_FLAG_DEVICE_MODE; in ucom_set_usb_mode()
590 ssc->sc_flag &= ~UCOM_FLAG_DEVICE_MODE; in ucom_set_usb_mode()
600 struct ucom_super_softc *ssc = sc->sc_super; in ucom_queue_command() local
605 if (usb_proc_is_gone(&ssc->sc_tq)) { in ucom_queue_command()
615 usb_proc_msignal(&ssc->sc_tq, t0, t1); in ucom_queue_command()
632 usb_proc_mwait(&ssc->sc_tq, t0, t1); in ucom_queue_command()
667 struct ucom_super_softc *ssc = sc->sc_super; in ucom_cfg_is_gone() local
669 return (usb_proc_is_gone(&ssc->sc_tq)); in ucom_cfg_is_gone()
1693 ucom_ref(struct ucom_super_softc *ssc) in ucom_ref() argument
1696 ssc->sc_refs++; in ucom_ref()
1708 ucom_free_unit(struct ucom_super_softc *ssc) in ucom_free_unit() argument
1710 if (!(ssc->sc_flag & UCOM_FLAG_FREE_UNIT)) in ucom_free_unit()
1713 ucom_unit_free(ssc->sc_unit); in ucom_free_unit()
1715 ssc->sc_flag &= ~UCOM_FLAG_FREE_UNIT; in ucom_free_unit()
1728 ucom_unref(struct ucom_super_softc *ssc) in ucom_unref() argument
1733 retval = (ssc->sc_refs < 2); in ucom_unref()
1734 ssc->sc_refs--; in ucom_unref()
1738 ucom_free_unit(ssc); in ucom_unref()