Date: Wed, 7 Nov 2012 11:46:34 -0800 From: Adrian Chadd <adrian@freebsd.org> To: Hans Petter Selasky <hselasky@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r242703 - head/sys/dev/usb/serial Message-ID: <CAJ-Vmom60Wn8PWgLRHhATzjYeu2a9F%2BboRykZO=wZaMcxqwYzA@mail.gmail.com> In-Reply-To: <201211071859.qA7IxgjE085220@svn.freebsd.org> References: <201211071859.qA7IxgjE085220@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Thanks for this. The auto-locking method is .. highly wrong/suspect. Please don't do that. :) Adrian On 7 November 2012 10:59, Hans Petter Selasky <hselasky@freebsd.org> wrote: > Author: hselasky > Date: Wed Nov 7 18:59:42 2012 > New Revision: 242703 > URL: http://svnweb.freebsd.org/changeset/base/242703 > > Log: > Add lock asserts instead of "auto-locking". > > MFC after: 1 weeks > Suggested by: ed @ > > Modified: > head/sys/dev/usb/serial/usb_serial.c > > Modified: head/sys/dev/usb/serial/usb_serial.c > ============================================================================== > --- head/sys/dev/usb/serial/usb_serial.c Wed Nov 7 18:44:05 2012 (r242702) > +++ head/sys/dev/usb/serial/usb_serial.c Wed Nov 7 18:59:42 2012 (r242703) > @@ -788,20 +788,16 @@ ucom_inwakeup(struct tty *tp) > { > struct ucom_softc *sc = tty_softc(tp); > uint16_t pos; > - int locked; > > if (sc == NULL) > return; > > - locked = mtx_owned(sc->sc_mtx); > + UCOM_MTX_ASSERT(sc, MA_OWNED); > > - if (locked == 0) > - tty_lock(tp); > + DPRINTF("tp=%p\n", tp); > > if (ttydisc_can_bypass(tp) != 0 || > (sc->sc_flag & UCOM_FLAG_HL_READY) == 0) { > - if (locked == 0) > - tty_unlock(tp); > return; > } > > @@ -825,9 +821,6 @@ ucom_inwakeup(struct tty *tp) > if ((sc->sc_jitterbuf_in == pos) && > (sc->sc_flag & UCOM_FLAG_RTS_IFLOW)) > ucom_rts(sc, 0); > - > - if (locked == 0) > - tty_unlock(tp); > } > > static int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmom60Wn8PWgLRHhATzjYeu2a9F%2BboRykZO=wZaMcxqwYzA>