Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/usermode/dev don't use kmem from softint context
details: https://anonhg.NetBSD.org/src/rev/773fa639262c
branches: trunk
changeset: 768643:773fa639262c
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Tue Aug 23 15:56:12 2011 +0000
description:
don't use kmem from softint context
diffstat:
sys/arch/usermode/dev/ld_thunkbus.c | 31 ++++++++++++-------------------
1 files changed, 12 insertions(+), 19 deletions(-)
diffs (89 lines):
diff -r 42ab3e91d376 -r 773fa639262c sys/arch/usermode/dev/ld_thunkbus.c
--- a/sys/arch/usermode/dev/ld_thunkbus.c Tue Aug 23 15:35:53 2011 +0000
+++ b/sys/arch/usermode/dev/ld_thunkbus.c Tue Aug 23 15:56:12 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ld_thunkbus.c,v 1.3 2011/08/13 10:58:32 jmcneill Exp $ */
+/* $NetBSD: ld_thunkbus.c,v 1.4 2011/08/23 15:56:12 jmcneill Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld_thunkbus.c,v 1.3 2011/08/13 10:58:32 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_thunkbus.c,v 1.4 2011/08/23 15:56:12 jmcneill Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -52,7 +52,13 @@
static void ld_thunkbus_sig(int, siginfo_t *, void *);
static void ld_thunkbus_complete(void *);
-struct ld_thunkbus_transfer;
+struct ld_thunkbus_softc;
+
+struct ld_thunkbus_transfer {
+ struct ld_thunkbus_softc *tt_sc;
+ struct aiocb tt_aio;
+ struct buf *tt_bp;
+};
struct ld_thunkbus_softc {
struct ld_softc sc_ld;
@@ -61,13 +67,7 @@
struct stat sc_st;
void *sc_ih;
- struct ld_thunkbus_transfer *sc_curtt;
-};
-
-struct ld_thunkbus_transfer {
- struct ld_thunkbus_softc *tt_sc;
- struct aiocb tt_aio;
- struct buf *tt_bp;
+ struct ld_thunkbus_transfer sc_tt;
};
CFATTACH_DECL_NEW(ld_thunkbus, sizeof(struct ld_thunkbus_softc),
@@ -142,7 +142,6 @@
if (info->si_signo == SIGIO) {
tt = info->si_value.sival_ptr;
sc = tt->tt_sc;
- sc->sc_curtt = tt;
softint_schedule(sc->sc_ih);
}
@@ -153,7 +152,7 @@
ld_thunkbus_complete(void *arg)
{
struct ld_thunkbus_softc *sc = arg;
- struct ld_thunkbus_transfer *tt = sc->sc_curtt;
+ struct ld_thunkbus_transfer *tt = &sc->sc_tt;
struct buf *bp = tt->tt_bp;
if (thunk_aio_error(&tt->tt_aio) == 0 &&
@@ -164,8 +163,6 @@
bp->b_resid = bp->b_bcount;
}
- kmem_free(tt, sizeof(*tt));
-
if (bp->b_error)
printf("errpr!\n");
@@ -176,13 +173,9 @@
ld_thunkbus_ldstart(struct ld_softc *ld, struct buf *bp)
{
struct ld_thunkbus_softc *sc = (struct ld_thunkbus_softc *)ld;
- struct ld_thunkbus_transfer *tt;
+ struct ld_thunkbus_transfer *tt = &sc->sc_tt;
int error;
- tt = kmem_alloc(sizeof(*tt), KM_SLEEP);
- if (tt == NULL)
- return ENOMEM;
-
tt->tt_sc = sc;
tt->tt_bp = bp;
memset(&tt->tt_aio, 0, sizeof(tt->tt_aio));
Home |
Main Index |
Thread Index |
Old Index