In struct wdc_xfer, change 'channel' to a pointer to a channel_softc, to avoid

a double-pointer dereference at run-time. Suggested by Matthias Drochner.
This commit is contained in:
bouyer 1998-12-02 15:53:34 +00:00
parent 4cb00b9fe2
commit 1d5d5ab40a
2 changed files with 9 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: wdc.c,v 1.48 1998/12/02 10:52:25 bouyer Exp $ */
/* $NetBSD: wdc.c,v 1.49 1998/12/02 15:53:34 bouyer Exp $ */
/*
@ -420,7 +420,6 @@ wdcstart(chp)
struct channel_softc *chp;
{
struct wdc_xfer *xfer;
struct wdc_softc *wdc = chp->wdc;
#ifdef WDC_DIAGNOSTIC
int spl1, spl2;
@ -440,7 +439,7 @@ wdcstart(chp)
return;
/* adjust chp, in case we have a shared queue */
chp = wdc->channels[xfer->channel];
chp = xfer->chp;
if ((chp->ch_flags & WDCF_ACTIVE) != 0 ) {
return; /* channel aleady active */
@ -454,7 +453,7 @@ wdcstart(chp)
return;
WDCDEBUG_PRINT(("wdcstart: xfer %p channel %d drive %d\n", xfer,
xfer->channel, xfer->drive), DEBUG_XFERS);
chp->channel, xfer->drive), DEBUG_XFERS);
chp->ch_flags |= WDCF_ACTIVE;
if (chp->ch_drive[xfer->drive].drive_flags & DRIVE_RESET) {
chp->ch_drive[xfer->drive].drive_flags &= ~DRIVE_RESET;
@ -673,7 +672,7 @@ wdcwait(chp, mask, bits, timeout)
WDCDELAY * time);
else
printf("%s:%d:%d: warning: busy-wait took %dus\n",
chp->wdc->sc_dev.dv_xname, xfer->channel,
chp->wdc->sc_dev.dv_xname, chp->channel,
xfer->drive,
WDCDELAY * time);
}
@ -1129,7 +1128,7 @@ wdc_exec_xfer(chp, xfer)
chp->channel, xfer->drive), DEBUG_XFERS);
/* complete xfer setup */
xfer->channel = chp->channel;
xfer->chp = chp;
/*
* If we are a polled command, and the list is not empty,
@ -1215,7 +1214,7 @@ __wdcerror(chp, msg)
msg);
else
printf("%s:%d:%d: %s\n", chp->wdc->sc_dev.dv_xname,
xfer->channel, xfer->drive, msg);
chp->channel, xfer->drive, msg);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: wdcvar.h,v 1.10 1998/11/21 15:41:42 drochner Exp $ */
/* $NetBSD: wdcvar.h,v 1.11 1998/12/02 15:53:35 bouyer Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -129,9 +129,9 @@ struct wdc_xfer {
#define C_DMA 0x0040 /* cmd uses DMA */
#define C_SENSE 0x0080 /* cmd is a internal command */
/* Information about our location */
/* Informations about our location */
struct channel_softc *chp;
u_int8_t drive;
u_int8_t channel;
/* Information about the current transfer */
void *cmd; /* wdc, ata or scsipi command structure */