Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Replace some ltsleep() uses with kpause() and tsleep().
details: https://anonhg.NetBSD.org/src/rev/1ee094f13735
branches: trunk
changeset: 764949:1ee094f13735
user: rmind <rmind%NetBSD.org@localhost>
date: Fri May 13 22:35:50 2011 +0000
description:
Replace some ltsleep() uses with kpause() and tsleep().
diffstat:
sys/arch/evbarm/mpcsa/mpcsa_usart.c | 14 +++++++-------
sys/arch/mac68k/nubus/cpi_nubus.c | 10 +++++-----
sys/dev/ppbus/ppbus_base.c | 26 ++++++++++----------------
3 files changed, 22 insertions(+), 28 deletions(-)
diffs (169 lines):
diff -r cc2c282ef82e -r 1ee094f13735 sys/arch/evbarm/mpcsa/mpcsa_usart.c
--- a/sys/arch/evbarm/mpcsa/mpcsa_usart.c Fri May 13 22:31:08 2011 +0000
+++ b/sys/arch/evbarm/mpcsa/mpcsa_usart.c Fri May 13 22:35:50 2011 +0000
@@ -1,5 +1,5 @@
-/* $Id: mpcsa_usart.c,v 1.2 2008/07/03 01:15:39 matt Exp $ */
-/* $NetBSD: mpcsa_usart.c,v 1.2 2008/07/03 01:15:39 matt Exp $ */
+/* $Id: mpcsa_usart.c,v 1.3 2011/05/13 22:35:50 rmind Exp $ */
+/* $NetBSD: mpcsa_usart.c,v 1.3 2011/05/13 22:35:50 rmind Exp $ */
/*
* Copyright (c) 2007 Embedtronics Oy. All rights reserved.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpcsa_usart.c,v 1.2 2008/07/03 01:15:39 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpcsa_usart.c,v 1.3 2011/05/13 22:35:50 rmind Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -221,9 +221,9 @@
case PID_US3:
/* turn gsm on */
at91pio_clear(sc->sc_pioa, PA_GSMOFF);
- ltsleep(sc, 0, "gsmond", 4 * hz, NULL);
+ kpause("gsmond", false, 4 * hz, NULL);
at91pio_set(sc->sc_pioa, PA_GSMON);
- ltsleep(sc, 0, "gsmon", 2 * hz, NULL);
+ kpause("gsmon", false, 2 * hz, NULL);
at91pio_clear(sc->sc_pioa, PA_GSMON);
/* then attach pins to devices etc */
at91pio_per(sc->sc_pioa, PA_TXD4, 1);
@@ -253,14 +253,14 @@
at91pio_intr_disestablish(sc->sc_piob, PB_CTS4, sc->sc_cts_ih);
at91pio_clear(sc->sc_pioa, PA_GSMON);
- ltsleep(sc, 0, "gsmoffd", (hz * 350 + 999) / 1000, NULL);
+ kpause("gsmoffd", false, (hz * 350 + 999) / 1000, NULL);
at91pio_per(sc->sc_pioa, PA_TXD4, -1);
at91pio_in(sc->sc_piob, PB_RTS4);
at91pio_in(sc->sc_piod, PD_DTR4);
at91pio_set(sc->sc_pioa, PA_GSMOFF);
- ltsleep(sc, 0, "gsmoff", hz * 4, NULL);
+ kpause("gsmoff", false, hz * 4, NULL);
at91pio_clear(sc->sc_pioa, PA_GSMOFF);
break;
diff -r cc2c282ef82e -r 1ee094f13735 sys/arch/mac68k/nubus/cpi_nubus.c
--- a/sys/arch/mac68k/nubus/cpi_nubus.c Fri May 13 22:31:08 2011 +0000
+++ b/sys/arch/mac68k/nubus/cpi_nubus.c Fri May 13 22:35:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpi_nubus.c,v 1.4 2008/09/10 19:20:06 christos Exp $ */
+/* $NetBSD: cpi_nubus.c,v 1.5 2011/05/13 22:35:50 rmind Exp $ */
/*-
* Copyright (c) 2008 Hauke Fath
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpi_nubus.c,v 1.4 2008/09/10 19:20:06 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpi_nubus.c,v 1.5 2011/05/13 22:35:50 rmind Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -386,7 +386,7 @@
return EBUSY;
}
/* sleep for a second, unless we get a signal */
- err = ltsleep(sc, PZERO | PCATCH, "cpi_open", hz, NULL);
+ err = tsleep(sc, PZERO | PCATCH, "cpi_open", hz);
if (err != EWOULDBLOCK) {
sc->sc_lpstate = LP_INITIAL;
return err;
@@ -530,8 +530,8 @@
splx(s);
}
/* XXX Sure we want to wait forever for the printer? */
- err = ltsleep((void *)sc, PZERO | PCATCH,
- "cpi_flush", (60 * hz), NULL);
+ err = tsleep((void *)sc, PZERO | PCATCH,
+ "cpi_flush", (60 * hz));
}
return err;
}
diff -r cc2c282ef82e -r 1ee094f13735 sys/dev/ppbus/ppbus_base.c
--- a/sys/dev/ppbus/ppbus_base.c Fri May 13 22:31:08 2011 +0000
+++ b/sys/dev/ppbus/ppbus_base.c Fri May 13 22:35:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ppbus_base.c,v 1.17 2008/04/15 15:02:29 cegger Exp $ */
+/* $NetBSD: ppbus_base.c,v 1.18 2011/05/13 22:35:51 rmind Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999 Nicolas Souchu
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ppbus_base.c,v 1.17 2008/04/15 15:02:29 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppbus_base.c,v 1.18 2011/05/13 22:35:51 rmind Exp $");
#include "opt_ppbus_1284.h"
#include "opt_ppbus.h"
@@ -143,15 +143,15 @@
switch (how) {
case PPBUS_NOINTR:
/* wait 10 ms */
- tsleep((void *)dev, PPBUSPRI, "ppbuspoll", hz/100);
+ kpause("ppbuspoll", false, hz / 100, NULL);
break;
case PPBUS_INTR:
default:
/* wait 10 ms */
- if (((error = tsleep((void *)dev, PPBUSPRI | PCATCH,
- "ppbuspoll", hz/100)) != EWOULDBLOCK) != 0) {
- return (error);
+ error = kpause("ppbuspoll", true, hz / 100, NULL);
+ if (error != EWOULDBLOCK) {
+ return error;
}
break;
}
@@ -362,19 +362,16 @@
{
struct ppbus_softc * bus = device_private(dev);
unsigned int counter = timeout;
- int priority = PPBUSPRI;
+ bool intr = (how & PPBUS_INTR) != 0;
int error;
- if(how & PPBUS_INTR)
- priority |= PCATCH;
-
/* Loop until lock acquired (if PPBUS_WAIT) or an error occurs */
for(;;) {
if (mutex_tryenter(&(bus->sc_lock)))
break;
if(how & PPBUS_WAIT) {
- error = ltsleep(bus, priority, __func__, hz/2, NULL);
+ error = kpause("ppbusreq", intr, hz / 2, NULL);
counter -= (hz/2);
if(!(error))
continue;
@@ -414,19 +411,16 @@
{
struct ppbus_softc * bus = device_private(dev);
unsigned int counter = timeout;
- int priority = PPBUSPRI;
+ bool intr = (how & PPBUS_INTR) != 0;
int error;
- if(how & PPBUS_INTR)
- priority |= PCATCH;
-
/* Loop until lock acquired (if PPBUS_WAIT) or an error occurs */
for(;;) {
if (mutex_tryenter(&(bus->sc_lock)))
break;
if(how & PPBUS_WAIT) {
- error = ltsleep(bus, priority, __func__, hz/2, NULL);
+ error = kpause("ppbusrel", intr, hz / 2, NULL);
counter -= (hz/2);
if(!(error))
continue;
Home |
Main Index |
Thread Index |
Old Index