Defer wakeup() to a soft interrupt, since lptintr() can be called above
IPL_SCHED.
This commit is contained in:
parent
a6aa4ab63d
commit
2823fb7428
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lpt.c,v 1.70 2007/07/09 21:00:37 ad Exp $ */
|
||||
/* $NetBSD: lpt.c,v 1.71 2007/10/09 12:45:27 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993, 1994 Charles M. Hannum.
|
||||
@ -54,7 +54,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lpt.c,v 1.70 2007/07/09 21:00:37 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lpt.c,v 1.71 2007/10/09 12:45:27 ad Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -67,9 +67,9 @@ __KERNEL_RCSID(0, "$NetBSD: lpt.c,v 1.70 2007/07/09 21:00:37 ad Exp $");
|
||||
#include <sys/device.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/intr.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/intr.h>
|
||||
|
||||
#include <dev/ic/lptreg.h>
|
||||
#include <dev/ic/lptvar.h>
|
||||
@ -104,6 +104,8 @@ const struct cdevsw lpt_cdevsw = {
|
||||
#define LPTUNIT(s) (minor(s) & 0x1f)
|
||||
#define LPTFLAGS(s) (minor(s) & 0xe0)
|
||||
|
||||
static void lptsoftintr(void *);
|
||||
|
||||
void
|
||||
lpt_attach_subr(sc)
|
||||
struct lpt_softc *sc;
|
||||
@ -119,6 +121,7 @@ lpt_attach_subr(sc)
|
||||
bus_space_write_1(iot, ioh, lpt_control, LPC_NINIT);
|
||||
|
||||
callout_init(&sc->sc_wakeup_ch, 0);
|
||||
sc->sc_sih = softint_establish(SOFTINT_SERIAL, lptsoftintr, sc);
|
||||
|
||||
sc->sc_dev_ok = 1;
|
||||
}
|
||||
@ -402,12 +405,19 @@ lptintr(arg)
|
||||
|
||||
if (sc->sc_count == 0) {
|
||||
/* none, wake up the top half to get more */
|
||||
wakeup((void *)sc);
|
||||
softint_schedule(sc->sc_sih);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
lptsoftintr(void *cookie)
|
||||
{
|
||||
|
||||
wakeup(cookie);
|
||||
}
|
||||
|
||||
int
|
||||
lptioctl(dev_t dev, u_long cmd, void *data,
|
||||
int flag, struct lwp *l)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lptvar.h,v 1.53 2005/12/11 12:21:27 christos Exp $ */
|
||||
/* $NetBSD: lptvar.h,v 1.54 2007/10/09 12:45:27 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993, 1994 Charles M. Hannum.
|
||||
@ -61,8 +61,9 @@
|
||||
struct lpt_softc {
|
||||
struct device sc_dev;
|
||||
void *sc_ih;
|
||||
struct callout sc_wakeup_ch;
|
||||
callout_t sc_wakeup_ch;
|
||||
size_t sc_count;
|
||||
void *sc_sih;
|
||||
void *sc_inbuf;
|
||||
u_char *sc_cp;
|
||||
int sc_spinmax;
|
||||
|
Loading…
Reference in New Issue
Block a user