Simplfy allocation of the channel queue.

This commit is contained in:
thorpej 2003-12-31 02:45:04 +00:00
parent b5b951b13e
commit 2dafabdb20
1 changed files with 7 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: wdc_mb.c,v 1.16 2003/12/16 14:07:20 he Exp $ */
/* $NetBSD: wdc_mb.c,v 1.17 2003/12/31 02:45:04 thorpej Exp $ */
/*-
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wdc_mb.c,v 1.16 2003/12/16 14:07:20 he Exp $");
__KERNEL_RCSID(0, "$NetBSD: wdc_mb.c,v 1.17 2003/12/31 02:45:04 thorpej Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -72,8 +72,9 @@ static void write_multi_2_swap __P((bus_space_tag_t, bus_space_handle_t,
struct wdc_mb_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 @@ wdc_mb_attach(parent, self, aux)
sc->sc_wdcdev.PIO_cap = 0;
sc->sc_wdcdev.claim_hw = &claim_hw;
sc->sc_wdcdev.free_hw = &free_hw;
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;
/*
* Setup & enable disk related interrupts.