svn commit: r212430 - user/weongyo/usb/sys/dev/usb/serial

Weongyo Jeong weongyo at FreeBSD.org
Fri Sep 10 18:48:27 UTC 2010


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)
 


More information about the svn-src-user mailing list