Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Simplify allocation of the channel queue.
details: https://anonhg.NetBSD.org/src/rev/eb574ab3118f
branches: trunk
changeset: 556953:eb574ab3118f
user: thorpej <thorpej%NetBSD.org@localhost>
date: Wed Dec 31 02:41:22 2003 +0000
description:
Simplify allocation of the channel queue.
diffstat:
sys/arch/acorn32/mainbus/wdc_pioc.c | 19 +++++++------------
sys/arch/acorn32/podulebus/icside.c | 14 ++++----------
sys/arch/acorn32/podulebus/rapide.c | 14 ++++----------
sys/arch/acorn32/podulebus/simide.c | 14 ++++----------
sys/arch/amiga/dev/wdc_amiga.c | 19 +++++++------------
5 files changed, 26 insertions(+), 54 deletions(-)
diffs (228 lines):
diff -r 9296d6ade586 -r eb574ab3118f sys/arch/acorn32/mainbus/wdc_pioc.c
--- a/sys/arch/acorn32/mainbus/wdc_pioc.c Wed Dec 31 02:40:26 2003 +0000
+++ b/sys/arch/acorn32/mainbus/wdc_pioc.c Wed Dec 31 02:41:22 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wdc_pioc.c,v 1.11 2003/12/02 23:47:20 bjh21 Exp $ */
+/* $NetBSD: wdc_pioc.c,v 1.12 2003/12/31 02:41:22 thorpej Exp $ */
/*
* Copyright (c) 1997-1998 Mark Brinicombe.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_pioc.c,v 1.11 2003/12/02 23:47:20 bjh21 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_pioc.c,v 1.12 2003/12/31 02:41:22 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -58,8 +58,9 @@
struct wdc_pioc_softc {
struct wdc_softc sc_wdcdev;
- struct channel_softc *wdc_chanptr;
+ struct channel_softc *wdc_chanlist[1];
struct channel_softc wdc_channel;
+ struct channel_queue wdc_chqueue;
void *sc_ih;
};
@@ -174,18 +175,12 @@
panic("%s: Cannot claim IRQ %d", self->dv_xname, pa->pa_irq);
sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16;
sc->sc_wdcdev.PIO_cap = 0;
- sc->wdc_chanptr = &sc->wdc_channel;
- sc->sc_wdcdev.channels = &sc->wdc_chanptr;
+ sc->wdc_chanlist[0] = &sc->wdc_channel;
+ sc->sc_wdcdev.channels = sc->wdc_chanlist;
sc->wdc_channel.wdc = &sc->sc_wdcdev;
sc->sc_wdcdev.nchannels = 1;
sc->wdc_channel.channel = 0;
- sc->wdc_channel.ch_queue = malloc(sizeof(struct channel_queue),
- M_DEVBUF, M_NOWAIT);
- if (sc->wdc_channel.ch_queue == NULL) {
- printf("%s: can't allocate memory for command queue",
- sc->sc_wdcdev.sc_dev.dv_xname);
- return;
- }
+ sc->wdc_channel.ch_queue = &sc->wdc_chqueue;
wdcattach(&sc->wdc_channel);
}
diff -r 9296d6ade586 -r eb574ab3118f sys/arch/acorn32/podulebus/icside.c
--- a/sys/arch/acorn32/podulebus/icside.c Wed Dec 31 02:40:26 2003 +0000
+++ b/sys/arch/acorn32/podulebus/icside.c Wed Dec 31 02:41:22 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: icside.c,v 1.16 2003/12/02 23:47:20 bjh21 Exp $ */
+/* $NetBSD: icside.c,v 1.17 2003/12/31 02:41:22 thorpej Exp $ */
/*
* Copyright (c) 1997-1998 Mark Brinicombe
@@ -42,7 +42,7 @@
#include <sys/param.h>
-__KERNEL_RCSID(0, "$NetBSD: icside.c,v 1.16 2003/12/02 23:47:20 bjh21 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icside.c,v 1.17 2003/12/31 02:41:22 thorpej Exp $");
#include <sys/systm.h>
#include <sys/conf.h>
@@ -86,6 +86,7 @@
struct channel_softc *sc_chp[ICSIDE_MAX_CHANNELS];
struct icside_channel {
struct channel_softc wdc_channel; /* generic part */
+ struct channel_queue wdc_chqueue; /* channel queue */
void *ic_ih; /* interrupt handler */
struct evcnt ic_intrcnt; /* interrupt count */
u_int ic_irqaddr; /* interrupt flag */
@@ -262,14 +263,7 @@
cp->channel = channel;
cp->wdc = &sc->sc_wdcdev;
- cp->ch_queue = malloc(sizeof(struct channel_queue), M_DEVBUF,
- M_NOWAIT);
- if (cp->ch_queue == NULL) {
- printf("%s:%d: "
- "can't allocate memory for command queue",
- sc->sc_wdcdev.sc_dev.dv_xname, channel);
- continue;
- }
+ cp->ch_queue = &icp->wdc_chqueue;
cp->cmd_iot = &sc->sc_tag;
cp->ctl_iot = &sc->sc_tag;
if (ide->modspace)
diff -r 9296d6ade586 -r eb574ab3118f sys/arch/acorn32/podulebus/rapide.c
--- a/sys/arch/acorn32/podulebus/rapide.c Wed Dec 31 02:40:26 2003 +0000
+++ b/sys/arch/acorn32/podulebus/rapide.c Wed Dec 31 02:41:22 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rapide.c,v 1.15 2003/12/02 23:47:20 bjh21 Exp $ */
+/* $NetBSD: rapide.c,v 1.16 2003/12/31 02:41:22 thorpej Exp $ */
/*
* Copyright (c) 1997-1998 Mark Brinicombe
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rapide.c,v 1.15 2003/12/02 23:47:20 bjh21 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rapide.c,v 1.16 2003/12/31 02:41:22 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -119,6 +119,7 @@
bus_space_handle_t sc_ctlioh; /* control handler */
struct rapide_channel {
struct channel_softc wdc_channel; /* generic part */
+ struct channel_queue wdc_chqueue; /* channel queue */
irqhandler_t rc_ih; /* interrupt handler */
int rc_irqmask; /* IRQ mask for this channel */
} rapide_channels[2];
@@ -256,14 +257,7 @@
cp->channel = channel;
cp->wdc = &sc->sc_wdcdev;
- cp->ch_queue = malloc(sizeof(struct channel_queue),
- M_DEVBUF, M_NOWAIT);
- if (cp->ch_queue == NULL) {
- printf("%s %s channel: can't allocate memory for "
- "command queue", self->dv_xname,
- (channel == 0) ? "primary" : "secondary");
- continue;
- }
+ cp->ch_queue = &rcp->wdc_chqueue;
cp->cmd_iot = iot;
cp->ctl_iot = iot;
cp->data32iot = iot;
diff -r 9296d6ade586 -r eb574ab3118f sys/arch/acorn32/podulebus/simide.c
--- a/sys/arch/acorn32/podulebus/simide.c Wed Dec 31 02:40:26 2003 +0000
+++ b/sys/arch/acorn32/podulebus/simide.c Wed Dec 31 02:41:22 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: simide.c,v 1.14 2003/12/02 23:47:20 bjh21 Exp $ */
+/* $NetBSD: simide.c,v 1.15 2003/12/31 02:41:22 thorpej Exp $ */
/*
* Copyright (c) 1997-1998 Mark Brinicombe
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: simide.c,v 1.14 2003/12/02 23:47:20 bjh21 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: simide.c,v 1.15 2003/12/31 02:41:22 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -89,6 +89,7 @@
struct bus_space sc_tag; /* custom tag */
struct simide_channel {
struct channel_softc wdc_channel; /* generic part */
+ struct channel_queue wdc_chqueue; /* channel queue */
irqhandler_t sc_ih; /* interrupt handler */
int sc_irqmask; /* IRQ mask for this channel */
} simide_channels[2];
@@ -254,14 +255,7 @@
cp->channel = channel;
cp->wdc = &sc->sc_wdcdev;
- cp->ch_queue = malloc(sizeof(struct channel_queue),
- M_DEVBUF, M_NOWAIT);
- if (cp->ch_queue == NULL) {
- printf("%s %s channel: can't allocate memory for "
- "command queue", self->dv_xname,
- (channel == 0) ? "primary" : "secondary");
- continue;
- }
+ cp->ch_queue = &scp->wdc_chqueue;
cp->cmd_iot = cp->ctl_iot = &sc->sc_tag;
iobase = pa->pa_podule->mod_base;
if (bus_space_map(cp->cmd_iot, iobase +
diff -r 9296d6ade586 -r eb574ab3118f sys/arch/amiga/dev/wdc_amiga.c
--- a/sys/arch/amiga/dev/wdc_amiga.c Wed Dec 31 02:40:26 2003 +0000
+++ b/sys/arch/amiga/dev/wdc_amiga.c Wed Dec 31 02:41:22 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wdc_amiga.c,v 1.15 2003/12/07 20:59:00 is Exp $ */
+/* $NetBSD: wdc_amiga.c,v 1.16 2003/12/31 02:44:02 thorpej Exp $ */
/*-
* Copyright (c) 2000, 2003 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_amiga.c,v 1.15 2003/12/07 20:59:00 is Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_amiga.c,v 1.16 2003/12/31 02:44:02 thorpej Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -61,8 +61,9 @@
struct wdc_amiga_softc {
struct wdc_softc sc_wdcdev;
- struct channel_softc *wdc_chanptr;
+ struct channel_softc wdc_chanlist[1];
struct channel_softc wdc_channel;
+ struct channel_queue wdc_chqueue;
struct isr sc_isr;
volatile u_char *sc_intreg;
struct bus_space_tag cmd_iot;
@@ -136,18 +137,12 @@
sc->sc_wdcdev.cap = WDC_CAPABILITY_DATA16;
sc->sc_wdcdev.PIO_cap = 0;
- sc->wdc_chanptr = &sc->wdc_channel;
- sc->sc_wdcdev.channels = &sc->wdc_chanptr;
+ sc->wdc_chanlist[0] = &sc->wdc_channel;
+ sc->sc_wdcdev.channels = sc->wdc_chanlist;
sc->sc_wdcdev.nchannels = 1;
sc->wdc_channel.channel = 0;
sc->wdc_channel.wdc = &sc->sc_wdcdev;
- sc->wdc_channel.ch_queue = malloc(sizeof(struct channel_queue),
- M_DEVBUF, M_NOWAIT);
- if (sc->wdc_channel.ch_queue == NULL) {
- printf("%s: can't allocate memory for command queue",
- sc->sc_wdcdev.sc_dev.dv_xname);
- return;
- }
+ sc->wdc_channel.ch_queue = &sc->wdc_chqueue;
sc->sc_isr.isr_intr = wdc_amiga_intr;
sc->sc_isr.isr_arg = sc;
sc->sc_isr.isr_ipl = 2;
Home |
Main Index |
Thread Index |
Old Index