From 761481dc63723552e70245f7e6a0d992260a0b1b Mon Sep 17 00:00:00 2001 From: Nick Hibma Date: Fri, 5 Nov 2010 09:06:23 +0000 Subject: - Remove an unused entry from the softc (only used in a debugging printf). - Fix the loop count on detach (causing a panic on detaching a serial dongle). - Increase a buffer in case some driver want extra long tty device names (postfixing the purpose of the tty for example, e.g. u3g.ppp). --- sys/dev/usb/serial/usb_serial.c | 10 +++++----- sys/dev/usb/serial/usb_serial.h | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/usb/serial/usb_serial.c b/sys/dev/usb/serial/usb_serial.c index d1859777bad9..7ba74d9f6488 100644 --- a/sys/dev/usb/serial/usb_serial.c +++ b/sys/dev/usb/serial/usb_serial.c @@ -255,7 +255,7 @@ ucom_attach(struct ucom_super_softc *ssc, struct ucom_softc *sc, } ssc->sc_subunits = subunits; - for (subunit = 0; subunit != ssc->sc_subunits; subunit++) { + for (subunit = 0; subunit < ssc->sc_subunits; subunit++) { sc[subunit].sc_subunit = subunit; sc[subunit].sc_super = ssc; sc[subunit].sc_mtx = mtx; @@ -270,8 +270,8 @@ ucom_attach(struct ucom_super_softc *ssc, struct ucom_softc *sc, sc[subunit].sc_flag |= UCOM_FLAG_ATTACHED; } - DPRINTF("tp = %p, unit = %d, subunits = %d, device name subunit 0 = %s\n", - sc->sc_tty, ssc->sc_unit, ssc->sc_subunits, sc[0].sc_devname); + DPRINTF("tp = %p, unit = %d, subunits = %d\n", + sc->sc_tty, ssc->sc_unit, ssc->sc_subunits); return (0); } @@ -287,7 +287,7 @@ ucom_detach(struct ucom_super_softc *ssc, struct ucom_softc *sc) usb_proc_drain(&ssc->sc_tq); - for (subunit = 0; subunit <= ssc->sc_subunits; subunit++) { + for (subunit = 0; subunit < ssc->sc_subunits; subunit++) { if (sc[subunit].sc_flag & UCOM_FLAG_ATTACHED) { ucom_detach_tty(&sc[subunit]); @@ -304,7 +304,7 @@ static int ucom_attach_tty(struct ucom_super_softc *ssc, struct ucom_softc *sc) { struct tty *tp; - char buf[10]; /* temporary TTY device name buffer */ + char buf[32]; /* temporary TTY device name buffer */ tp = tty_alloc_mutex(&ucom_class, sc, sc->sc_mtx); if (tp == NULL) diff --git a/sys/dev/usb/serial/usb_serial.h b/sys/dev/usb/serial/usb_serial.h index eb2cc8a8d563..d1dbc650e571 100644 --- a/sys/dev/usb/serial/usb_serial.h +++ b/sys/dev/usb/serial/usb_serial.h @@ -160,7 +160,6 @@ struct ucom_softc { const struct ucom_callback *sc_callback; struct ucom_super_softc *sc_super; struct tty *sc_tty; - char sc_devname[10]; struct mtx *sc_mtx; void *sc_parent; uint32_t sc_subunit; -- cgit v1.2.3