From owner-svn-src-user@FreeBSD.ORG Fri Sep 10 18:48:26 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D79D7106564A; Fri, 10 Sep 2010 18:48:26 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC0A38FC16; Fri, 10 Sep 2010 18:48:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8AImQrd077111; Fri, 10 Sep 2010 18:48:26 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8AImQT1077107; Fri, 10 Sep 2010 18:48:26 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009101848.o8AImQT1077107@svn.freebsd.org> From: Weongyo Jeong Date: Fri, 10 Sep 2010 18:48:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212430 - user/weongyo/usb/sys/dev/usb/serial X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 18:48:27 -0000 Author: weongyo Date: Fri Sep 10 18:48:26 2010 New Revision: 212430 URL: http://svn.freebsd.org/changeset/base/212430 Log: Defines UCOM_LOCK and UCOM_UNLOCK macros and uses it. Modified: user/weongyo/usb/sys/dev/usb/serial/usb_serial.c user/weongyo/usb/sys/dev/usb/serial/usb_serial.h Modified: user/weongyo/usb/sys/dev/usb/serial/usb_serial.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/usb_serial.c Fri Sep 10 18:19:38 2010 (r212429) +++ user/weongyo/usb/sys/dev/usb/serial/usb_serial.c Fri Sep 10 18:48:26 2010 (r212430) @@ -418,10 +418,10 @@ ucom_detach_tty(struct ucom_softc *sc) /* the config thread has been stopped when we get here */ - mtx_lock(sc->sc_mtx); + UCOM_LOCK(sc); sc->sc_flag |= UCOM_FLAG_GONE; sc->sc_flag &= ~(UCOM_FLAG_HL_READY | UCOM_FLAG_LL_READY); - mtx_unlock(sc->sc_mtx); + UCOM_UNLOCK(sc); if (tp) { tty_lock(tp); @@ -429,7 +429,7 @@ ucom_detach_tty(struct ucom_softc *sc) tty_rel_gone(tp); - mtx_lock(sc->sc_mtx); + UCOM_LOCK(sc); /* Wait for the callback after the TTY is torn down */ while (sc->sc_ttyfreed == 0) cv_wait(&sc->sc_cv, sc->sc_mtx); @@ -442,7 +442,7 @@ ucom_detach_tty(struct ucom_softc *sc) if (sc->sc_callback->ucom_stop_write) { (sc->sc_callback->ucom_stop_write) (sc); } - mtx_unlock(sc->sc_mtx); + UCOM_UNLOCK(sc); } cv_destroy(&sc->sc_cv); } @@ -1283,10 +1283,10 @@ ucom_free(void *xsc) { struct ucom_softc *sc = xsc; - mtx_lock(sc->sc_mtx); + UCOM_LOCK(sc); sc->sc_ttyfreed = 1; cv_signal(&sc->sc_cv); - mtx_unlock(sc->sc_mtx); + UCOM_UNLOCK(sc); } static cn_probe_t ucom_cnprobe; @@ -1327,7 +1327,7 @@ ucom_cngetc(struct consdev *cd) if (sc == NULL) return (-1); - mtx_lock(sc->sc_mtx); + UCOM_LOCK(sc); if (ucom_cons_rx_low != ucom_cons_rx_high) { c = ucom_cons_rx_buf[ucom_cons_rx_low]; @@ -1340,7 +1340,7 @@ ucom_cngetc(struct consdev *cd) /* start USB transfers */ ucom_outwakeup(sc->sc_tty); - mtx_unlock(sc->sc_mtx); + UCOM_UNLOCK(sc); /* poll if necessary */ if (kdb_active && sc->sc_callback->ucom_poll) @@ -1360,7 +1360,7 @@ ucom_cnputc(struct consdev *cd, int c) repeat: - mtx_lock(sc->sc_mtx); + UCOM_LOCK(sc); /* compute maximum TX length */ @@ -1376,7 +1376,7 @@ ucom_cnputc(struct consdev *cd, int c) /* start USB transfers */ ucom_outwakeup(sc->sc_tty); - mtx_unlock(sc->sc_mtx); + UCOM_UNLOCK(sc); /* poll if necessary */ if (kdb_active && sc->sc_callback->ucom_poll) { Modified: user/weongyo/usb/sys/dev/usb/serial/usb_serial.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/serial/usb_serial.h Fri Sep 10 18:19:38 2010 (r212429) +++ user/weongyo/usb/sys/dev/usb/serial/usb_serial.h Fri Sep 10 18:48:26 2010 (r212430) @@ -185,6 +185,9 @@ struct ucom_softc { #define UCOM_LS_RING 0x08 }; +#define UCOM_LOCK(sc) mtx_lock(sc->sc_mtx) +#define UCOM_UNLOCK(sc) mtx_unlock(sc->sc_mtx) + #define ucom_cfg_do_request(udev,com,req,ptr,flags,timo) \ usbd_do_request_proc(udev,&(com)->sc_super->sc_tq,req,ptr,flags,NULL,timo)