PERFORCE change 132023 for review
Kip Macy
kmacy at FreeBSD.org
Sat Dec 29 21:03:56 PST 2007
http://perforce.freebsd.org/chv.cgi?CH=132023
Change 132023 by kmacy at pandemonium:kmacy:xen31 on 2007/12/30 05:02:56
no need to use spin locks - switch to MTX_DEF
Affected files ...
.. //depot/projects/xen31/sys/dev/xen/console/console.c#3 edit
Differences ...
==== //depot/projects/xen31/sys/dev/xen/console/console.c#3 (text+ko) ====
@@ -76,9 +76,9 @@
#define XCUNIT(x) (minor(x))
#define ISTTYOPEN(tp) ((tp) && ((tp)->t_state & TS_ISOPEN))
#define CN_LOCK_INIT(x, _name) \
- mtx_init(&x, _name, _name, MTX_SPIN)
-#define CN_LOCK(l, f) mtx_lock_irqsave(&(l), (f))
-#define CN_UNLOCK(l, f) mtx_unlock_irqrestore(&(l), (f))
+ mtx_init(&x, _name, NULL, MTX_DEF)
+#define CN_LOCK(l) mtx_lock(&(l))
+#define CN_UNLOCK(l) mtx_unlock(&(l))
#define CN_LOCK_ASSERT(x) mtx_assert(&x, MA_OWNED)
#define CN_LOCK_DESTROY(x) mtx_destroy(&x)
@@ -146,24 +146,22 @@
xccncheckc(struct consdev *dev)
{
int ret = (xc_mute ? 0 : -1);
- int flags;
- CN_LOCK(cn_mtx, flags);
+ CN_LOCK(cn_mtx);
if ((rp - rc)) {
/* we need to return only one char */
ret = (int)rbuf[RBUF_MASK(rc)];
rc++;
}
- CN_UNLOCK(cn_mtx, flags);
+ CN_UNLOCK(cn_mtx);
return(ret);
}
static void
xccnputc(struct consdev *dev, int c)
{
- int flags;
- CN_LOCK(cn_mtx, flags);
+ CN_LOCK(cn_mtx);
xcons_putc(c);
- CN_UNLOCK(cn_mtx, flags);
+ CN_UNLOCK(cn_mtx);
}
static void
@@ -284,17 +282,17 @@
void
xencons_rx(char *buf, unsigned len)
{
- int i, flags;
+ int i;
struct tty *tp = xccons;
- CN_LOCK(cn_mtx, flags);
+ CN_LOCK(cn_mtx);
for (i = 0; i < len; i++) {
if (xen_console_up)
(*linesw[tp->t_line]->l_rint)(buf[i], tp);
else
rbuf[RBUF_MASK(rp++)] = buf[i];
}
- CN_UNLOCK(cn_mtx, flags);
+ CN_UNLOCK(cn_mtx);
}
static void
@@ -325,10 +323,9 @@
void
xencons_tx(void)
{
- unsigned long flags;
- CN_LOCK(cn_mtx, flags);
+ CN_LOCK(cn_mtx);
__xencons_tx_flush();
- CN_UNLOCK(cn_mtx, flags);
+ CN_UNLOCK(cn_mtx);
}
static void
@@ -432,15 +429,14 @@
static void
xcstart(struct tty *tp)
{
- int flags;
int s;
boolean_t cons_full = FALSE;
s = spltty();
- CN_LOCK(cn_mtx, flags);
+ CN_LOCK(cn_mtx);
if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) {
ttwwakeup(tp);
- CN_UNLOCK(cn_mtx, flags);
+ CN_UNLOCK(cn_mtx);
return;
}
@@ -456,7 +452,7 @@
/* let the timeout kick us in a bit */
xc_start_needed = TRUE;
}
- CN_UNLOCK(cn_mtx, flags);
+ CN_UNLOCK(cn_mtx);
splx(s);
}
More information about the p4-projects
mailing list