diff options
| author | ad <ad@NetBSD.org> | 2007-07-29 12:15:35 +0000 |
|---|---|---|
| committer | ad <ad@NetBSD.org> | 2007-07-29 12:15:35 +0000 |
| commit | 66fefd117bcf82d547bfa88ca68a5b43f17a7103 (patch) | |
| tree | 6344a9f4cbb126386fe0895fb71a9fab75c81aa6 /sys/dev | |
| parent | 480f8d26c5a97f0c8620ae2e36349bfc462ca19c (diff) | |
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/gpib/ct.c | 6 | ||||
| -rw-r--r-- | sys/dev/gpib/mt.c | 17 | ||||
| -rw-r--r-- | sys/dev/gpib/rd.c | 12 | ||||
| -rw-r--r-- | sys/dev/mscp/mscp.c | 9 | ||||
| -rw-r--r-- | sys/dev/mscp/mscp_disk.c | 9 | ||||
| -rw-r--r-- | sys/dev/mscp/mscp_tape.c | 12 | ||||
| -rw-r--r-- | sys/dev/ofw/ofdisk.c | 5 | ||||
| -rw-r--r-- | sys/dev/qbus/qd.c | 6 | ||||
| -rw-r--r-- | sys/dev/qbus/rf.c | 35 | ||||
| -rw-r--r-- | sys/dev/qbus/rl.c | 6 | ||||
| -rw-r--r-- | sys/dev/qbus/ts.c | 19 | ||||
| -rw-r--r-- | sys/dev/spi/spiflash.c | 10 | ||||
| -rw-r--r-- | sys/dev/vme/xd.c | 14 | ||||
| -rw-r--r-- | sys/dev/vme/xy.c | 14 |
14 files changed, 64 insertions, 110 deletions
diff --git a/sys/dev/gpib/ct.c b/sys/dev/gpib/ct.c index 0d12077fe1a..9254923afa7 100644 --- a/sys/dev/gpib/ct.c +++ b/sys/dev/gpib/ct.c @@ -1,4 +1,4 @@ -/* $NetBSD: ct.c,v 1.10 2007/03/04 06:01:46 christos Exp $ */ +/* $NetBSD: ct.c,v 1.11 2007/07/29 12:15:43 ad Exp $ */ /*- * Copyright (c) 1996-2003 The NetBSD Foundation, Inc. @@ -128,7 +128,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ct.c,v 1.10 2007/03/04 06:01:46 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ct.c,v 1.11 2007/07/29 12:15:43 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -657,7 +657,6 @@ cteof(sc, bp) */ if ((bp->b_flags & B_READ) == 0) { bp->b_resid = bp->b_bcount; - bp->b_flags |= B_ERROR; bp->b_error = ENOSPC; sc->sc_flags |= CTF_EOT; return; @@ -826,7 +825,6 @@ ctintr(sc) } else printf("%s: request status failed\n", sc->sc_dev.dv_xname); - bp->b_flags |= B_ERROR; bp->b_error = EIO; goto done; } else diff --git a/sys/dev/gpib/mt.c b/sys/dev/gpib/mt.c index 1296cdd7737..026e1531c0a 100644 --- a/sys/dev/gpib/mt.c +++ b/sys/dev/gpib/mt.c @@ -1,4 +1,4 @@ -/* $NetBSD: mt.c,v 1.10 2007/07/09 21:00:32 ad Exp $ */ +/* $NetBSD: mt.c,v 1.11 2007/07/29 12:15:43 ad Exp $ */ /*- * Copyright (c) 1996-2003 The NetBSD Foundation, Inc. @@ -121,7 +121,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.10 2007/07/09 21:00:32 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.11 2007/07/29 12:15:43 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -524,7 +524,7 @@ mtcommand(dev, cmd, cnt) bp->b_flags = B_BUSY | B_CMD; mtstrategy(bp); biowait(bp); - if (bp->b_flags & B_ERROR) { + if (bp->b_error != 0) { error = (int) (unsigned) bp->b_error; break; } @@ -581,7 +581,6 @@ mtstrategy(bp) #if 0 /* XXX see above */ error: #endif - bp->b_flags |= B_ERROR; bp->b_error = EIO; biodone(bp); return; @@ -693,7 +692,7 @@ mtstart(sc) case 2: if (bp->b_cmd != MTNOP || !(bp->b_flags & B_CMD)) { bp->b_error = EBUSY; - goto errdone; + goto done; } goto done; @@ -708,7 +707,7 @@ mtstart(sc) case MTWEOF: case MTFSR: bp->b_error = ENOSPC; - goto errdone; + goto done; case MTBSF: case MTOFFL: @@ -812,7 +811,7 @@ mtstart(sc) } else { if (sc->sc_flags & MTF_PASTEOT) { bp->b_error = ENOSPC; - goto errdone; + goto done; } if (bp->b_flags & B_READ) { sc->sc_flags |= MTF_IO; @@ -839,8 +838,6 @@ fatalerror: */ sc->sc_flags &= MTF_EXISTS | MTF_OPEN | MTF_REW; bp->b_error = EIO; -errdone: - bp->b_flags |= B_ERROR; done: sc->sc_flags &= ~(MTF_HITEOF | MTF_HITBOF); (void)BUFQ_GET(sc->sc_tab); @@ -958,7 +955,6 @@ mtintr(sc) if (sc->sc_flags & MTF_ATEOT) sc->sc_flags |= MTF_PASTEOT; else { - bp->b_flags |= B_ERROR; bp->b_error = ENOSPC; sc->sc_flags |= MTF_ATEOT; } @@ -1000,7 +996,6 @@ mtintr(sc) error: sc->sc_flags &= ~MTF_IO; bp->b_error = EIO; - bp->b_flags |= B_ERROR; } } /* diff --git a/sys/dev/gpib/rd.c b/sys/dev/gpib/rd.c index 16e140fd1ce..7784ddc2579 100644 --- a/sys/dev/gpib/rd.c +++ b/sys/dev/gpib/rd.c @@ -1,4 +1,4 @@ -/* $NetBSD: rd.c,v 1.16 2007/07/09 21:00:32 ad Exp $ */ +/* $NetBSD: rd.c,v 1.17 2007/07/29 12:15:43 ad Exp $ */ /*- * Copyright (c) 1996-2003 The NetBSD Foundation, Inc. @@ -118,7 +118,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.16 2007/07/09 21:00:32 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.17 2007/07/29 12:15:43 ad Exp $"); #include "rnd.h" @@ -644,7 +644,7 @@ rdstrategy(bp) } if (sz < 0) { bp->b_error = EINVAL; - goto bad; + goto done; } bp->b_bcount = dbtob(sz); } @@ -657,7 +657,7 @@ rdstrategy(bp) #endif !(bp->b_flags & B_READ) && !(sc->sc_flags & RDF_WLABEL)) { bp->b_error = EROFS; - goto bad; + goto done; } } bp->b_rawblkno = bn + offset; @@ -669,8 +669,6 @@ rdstrategy(bp) } splx(s); return; -bad: - bp->b_flags |= B_ERROR; done: biodone(bp); } @@ -808,7 +806,6 @@ again: printf("%s: rdstart err: cmd 0x%x sect %uld blk %" PRId64 " len %d\n", sc->sc_dev.dv_xname, sc->sc_ioc.c_cmd, sc->sc_ioc.c_addr, bp->b_blkno, sc->sc_resid); - bp->b_flags |= B_ERROR; bp->b_error = EIO; bp = rdfinish(sc, bp); if (bp) { @@ -866,7 +863,6 @@ rdintr(sc) rdstart(sc); return; } - bp->b_flags |= B_ERROR; bp->b_error = EIO; } if (rdfinish(sc, bp) != NULL) diff --git a/sys/dev/mscp/mscp.c b/sys/dev/mscp/mscp.c index f84a019b92f..6b0c9d57533 100644 --- a/sys/dev/mscp/mscp.c +++ b/sys/dev/mscp/mscp.c @@ -1,4 +1,4 @@ -/* $NetBSD: mscp.c,v 1.25 2007/03/04 06:02:14 christos Exp $ */ +/* $NetBSD: mscp.c,v 1.26 2007/07/29 12:15:43 ad Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. @@ -76,7 +76,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mscp.c,v 1.25 2007/03/04 06:02:14 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mscp.c,v 1.26 2007/07/29 12:15:43 ad Exp $"); #include <sys/param.h> #include <sys/buf.h> @@ -369,10 +369,7 @@ rwend: * WHAT STATUS WILL THESE HAVE? IT SURE WOULD BE NICE * IF DEC SOLD DOCUMENTATION FOR THEIR OWN CONTROLLERS. */ - if (error) { - bp->b_flags |= B_ERROR; - bp->b_error = error; - } + bp->b_error = error; if (st == M_ST_OFFLINE || st == M_ST_AVAILABLE) { #ifdef notyet (*md->md_offline)(ui, mp); diff --git a/sys/dev/mscp/mscp_disk.c b/sys/dev/mscp/mscp_disk.c index b2bf056ca19..0cd6fd53f32 100644 --- a/sys/dev/mscp/mscp_disk.c +++ b/sys/dev/mscp/mscp_disk.c @@ -1,4 +1,4 @@ -/* $NetBSD: mscp_disk.c,v 1.55 2007/07/21 19:51:48 ad Exp $ */ +/* $NetBSD: mscp_disk.c,v 1.56 2007/07/29 12:15:43 ad Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. * All rights reserved. @@ -81,7 +81,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mscp_disk.c,v 1.55 2007/07/21 19:51:48 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mscp_disk.c,v 1.56 2007/07/29 12:15:43 ad Exp $"); #include <sys/param.h> #include <sys/buf.h> @@ -365,7 +365,6 @@ rastrategy(bp) unit = DISKUNIT(bp->b_dev); if (unit > ra_cd.cd_ndevs || (ra = ra_cd.cd_devs[unit]) == NULL) { bp->b_error = ENXIO; - bp->b_flags |= B_ERROR; goto done; } /* @@ -383,7 +382,6 @@ rastrategy(bp) /* If disk is not online, try to put it online */ if (ra->ra_state == DK_CLOSED) if (ra_putonline(ra) == MSCP_FAILED) { - bp->b_flags |= B_ERROR; bp->b_error = EIO; goto done; } @@ -808,14 +806,12 @@ rxstrategy(bp) unit = DISKUNIT(bp->b_dev); if (unit > rx_cd.cd_ndevs || (rx = rx_cd.cd_devs[unit]) == NULL) { bp->b_error = ENXIO; - bp->b_flags |= B_ERROR; goto done; } /* If disk is not online, try to put it online */ if (rx->ra_state == DK_CLOSED) if (rx_putonline(rx) == MSCP_FAILED) { - bp->b_flags |= B_ERROR; bp->b_error = EIO; goto done; } @@ -1120,7 +1116,6 @@ rrioerror(usc, mp, bp) switch (code & M_ST_MASK) { /* The unit has fallen offline. Try to figure out why. */ case M_ST_OFFLINE: - bp->b_flags |= B_ERROR; bp->b_error = EIO; ra->ra_state = DK_CLOSED; if (code & M_OFFLINE_UNMOUNTED) diff --git a/sys/dev/mscp/mscp_tape.c b/sys/dev/mscp/mscp_tape.c index 6f8be2a0160..4f32fedaec5 100644 --- a/sys/dev/mscp/mscp_tape.c +++ b/sys/dev/mscp/mscp_tape.c @@ -1,4 +1,4 @@ -/* $NetBSD: mscp_tape.c,v 1.30 2007/03/04 06:02:14 christos Exp $ */ +/* $NetBSD: mscp_tape.c,v 1.31 2007/07/29 12:15:43 ad Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mscp_tape.c,v 1.30 2007/03/04 06:02:14 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mscp_tape.c,v 1.31 2007/07/29 12:15:43 ad Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -277,16 +277,13 @@ mtstrategy(bp) unit = mtunit(bp->b_dev); if (unit > mt_cd.cd_ndevs || (mt = mt_cd.cd_devs[unit]) == NULL) { bp->b_error = ENXIO; - goto bad; + biodone(bp); + return; } mt->mt_waswrite = bp->b_flags & B_READ ? 0 : 1; mscp_strategy(bp, device_parent(&mt->mt_dev)); return; - -bad: - bp->b_flags |= B_ERROR; - biodone(bp); } int @@ -424,7 +421,6 @@ mtioerror(usc, mp, bp) mt_ioerrs[st-1]); else printf("%s: error %d\n", mt->mt_dev.dv_xname, st); - bp->b_flags |= B_ERROR; bp->b_error = EROFS; } diff --git a/sys/dev/ofw/ofdisk.c b/sys/dev/ofw/ofdisk.c index 2ccc56bd1ae..0c1988b825e 100644 --- a/sys/dev/ofw/ofdisk.c +++ b/sys/dev/ofw/ofdisk.c @@ -1,4 +1,4 @@ -/* $NetBSD: ofdisk.c,v 1.36 2007/07/21 19:51:48 ad Exp $ */ +/* $NetBSD: ofdisk.c,v 1.37 2007/07/29 12:15:43 ad Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ofdisk.c,v 1.36 2007/07/21 19:51:48 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ofdisk.c,v 1.37 2007/07/29 12:15:43 ad Exp $"); #include <sys/param.h> #include <sys/buf.h> @@ -301,7 +301,6 @@ ofdisk_strategy(struct buf *bp) if (read < 0) { bp->b_error = EIO; - bp->b_flags |= B_ERROR; bp->b_resid = bp->b_bcount; } else bp->b_resid = bp->b_bcount - read; diff --git a/sys/dev/qbus/qd.c b/sys/dev/qbus/qd.c index b3265af9d9a..988c27b0450 100644 --- a/sys/dev/qbus/qd.c +++ b/sys/dev/qbus/qd.c @@ -1,4 +1,4 @@ -/* $NetBSD: qd.c,v 1.37 2007/03/04 06:02:29 christos Exp $ */ +/* $NetBSD: qd.c,v 1.38 2007/07/29 12:15:44 ad Exp $ */ /*- * Copyright (c) 1988 Regents of the University of California. @@ -58,7 +58,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: qd.c,v 1.37 2007/03/04 06:02:29 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: qd.c,v 1.38 2007/07/29 12:15:44 ad Exp $"); #include "opt_ddb.h" @@ -1759,7 +1759,7 @@ panic("qd_strategy"); dga->csr &= ~DMA_IE; dga->csr &= ~0x0600; /* halt DMA (reset fifo) */ dga->csr |= DMA_ERR; /* clear error condition */ - bp->b_flags |= B_ERROR; /* flag an error to physio() */ + bp->b_error = EIO; /* flag an error to physio() */ /* * if DMA was running, flush spurious intrpt diff --git a/sys/dev/qbus/rf.c b/sys/dev/qbus/rf.c index 930a251d3d7..5cc94c617e0 100644 --- a/sys/dev/qbus/rf.c +++ b/sys/dev/qbus/rf.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf.c,v 1.14 2007/03/08 23:56:45 he Exp $ */ +/* $NetBSD: rf.c,v 1.15 2007/07/29 12:15:44 ad Exp $ */ /* * Copyright (c) 2002 Jochen Kunz. * All rights reserved. @@ -36,7 +36,7 @@ TODO: */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf.c,v 1.14 2007/03/08 23:56:45 he Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf.c,v 1.15 2007/07/29 12:15:44 ad Exp $"); /* autoconfig stuff */ #include <sys/param.h> @@ -565,7 +565,6 @@ rfstrategy(struct buf *buf) i = DISKUNIT(buf->b_dev); if (i >= rf_cd.cd_ndevs || (rf_sc = rf_cd.cd_devs[i]) == NULL) { - buf->b_flags |= B_ERROR; buf->b_error = ENXIO; biodone(buf); return; @@ -701,7 +700,7 @@ rfc_intr(void *intarg) * can only handle blocks that are a multiple * of the physical block size */ - rfc_sc->sc_curbuf->b_flags |= B_ERROR; + rfc_sc->sc_curbuf->b_error = EIO; } RFS_SETCMD(rf_sc->sc_state, (rfc_sc->sc_curbuf->b_flags & B_READ) != 0 ? RFS_RSEC : RFS_FBUF); @@ -715,7 +714,7 @@ rfc_intr(void *intarg) printf("rfc_intr: Error reading secotr: %x\n", bus_space_read_2(rfc_sc->sc_iot, rfc_sc->sc_ioh, RX2ES) ); - rfc_sc->sc_curbuf->b_flags |= B_ERROR; + rfc_sc->sc_curbuf->b_error = EIO; } RFS_SETCMD(rf_sc->sc_state, RFS_EBUF); break; @@ -730,7 +729,7 @@ rfc_intr(void *intarg) printf("rfc_intr: Error writing secotr: %x\n", bus_space_read_2(rfc_sc->sc_iot, rfc_sc->sc_ioh, RX2ES) ); - rfc_sc->sc_curbuf->b_flags |= B_ERROR; + rfc_sc->sc_curbuf->b_error = EIO; break; } if (rfc_sc->sc_bytesleft > i) { @@ -757,7 +756,7 @@ rfc_intr(void *intarg) printf("rfc_intr: Error while DMA: %x\n", bus_space_read_2(rfc_sc->sc_iot, rfc_sc->sc_ioh, RX2ES)); - rfc_sc->sc_curbuf->b_flags |= B_ERROR; + rfc_sc->sc_curbuf->b_error = EIO; } RFS_SETCMD(rf_sc->sc_state, RFS_WSEC); break; @@ -773,7 +772,7 @@ rfc_intr(void *intarg) printf("rfc_intr: Error while DMA: %x\n", bus_space_read_2(rfc_sc->sc_iot, rfc_sc->sc_ioh, RX2ES)); - rfc_sc->sc_curbuf->b_flags |= B_ERROR; + rfc_sc->sc_curbuf->b_error = EIO; break; } if (rfc_sc->sc_bytesleft > i) { @@ -799,7 +798,7 @@ rfc_intr(void *intarg) panic("Impossible state in rfc_intr(1).\n"); } - if ((rfc_sc->sc_curbuf->b_flags & B_ERROR) != 0) { + if (rfc_sc->sc_curbuf->b_error != 0) { /* * An error occurred while processing this buffer. * Finish it and try to get a new buffer to process. @@ -828,7 +827,7 @@ rfc_intr(void *intarg) if (i != 0) { printf("rfc_intr: Error loading dmamap: %d\n", i); - rfc_sc->sc_curbuf->b_flags |= B_ERROR; + rfc_sc->sc_curbuf->b_error = EIO; break; } disk_busy(&rf_sc->sc_disk); @@ -840,7 +839,7 @@ rfc_intr(void *intarg) ? RX2_BYTE_SD : RX2_BYTE_DD) / 2, rfc_sc->sc_dmam->dm_segs[0].ds_addr & 0xffff) < 0) { disk_unbusy(&rf_sc->sc_disk, 0, 1); - rfc_sc->sc_curbuf->b_flags |= B_ERROR; + rfc_sc->sc_curbuf->b_error = EIO; bus_dmamap_unload(rfc_sc->sc_dmat, rfc_sc->sc_dmam); } @@ -853,7 +852,7 @@ rfc_intr(void *intarg) if (i != 0) { printf("rfc_intr: Error loading dmamap: %d\n", i); - rfc_sc->sc_curbuf->b_flags |= B_ERROR; + rfc_sc->sc_curbuf->b_error = EIO; break; } disk_busy(&rf_sc->sc_disk); @@ -865,7 +864,7 @@ rfc_intr(void *intarg) ? RX2_BYTE_SD : RX2_BYTE_DD) / 2, rfc_sc->sc_dmam->dm_segs[0].ds_addr & 0xffff) < 0) { disk_unbusy(&rf_sc->sc_disk, 0, 0); - rfc_sc->sc_curbuf->b_flags |= B_ERROR; + rfc_sc->sc_curbuf->b_error = EIO; bus_dmamap_unload(rfc_sc->sc_dmat, rfc_sc->sc_dmam); } @@ -876,7 +875,7 @@ rfc_intr(void *intarg) ((rf_sc->sc_state & RFS_DENS) == 0 ? RX2_BYTE_SD : RX2_BYTE_DD); if (i > RX2_TRACKS * RX2_SECTORS) { - rfc_sc->sc_curbuf->b_flags |= B_ERROR; + rfc_sc->sc_curbuf->b_error = EIO; break; } disk_busy(&rf_sc->sc_disk); @@ -885,7 +884,7 @@ rfc_intr(void *intarg) | ((rf_sc->sc_state& RFS_DENS) == 0 ? 0 : RX2CS_DD), i % RX2_SECTORS + 1, i / RX2_SECTORS) < 0) { disk_unbusy(&rf_sc->sc_disk, 0, 0); - rfc_sc->sc_curbuf->b_flags |= B_ERROR; + rfc_sc->sc_curbuf->b_error = EIO; } break; case RFS_RSEC: /* Read Sector */ @@ -894,7 +893,7 @@ rfc_intr(void *intarg) ((rf_sc->sc_state & RFS_DENS) == 0 ? RX2_BYTE_SD : RX2_BYTE_DD); if (i > RX2_TRACKS * RX2_SECTORS) { - rfc_sc->sc_curbuf->b_flags |= B_ERROR; + rfc_sc->sc_curbuf->b_error = EIO; break; } disk_busy(&rf_sc->sc_disk); @@ -903,7 +902,7 @@ rfc_intr(void *intarg) | ((rf_sc->sc_state& RFS_DENS) == 0 ? 0 : RX2CS_DD), i % RX2_SECTORS + 1, i / RX2_SECTORS) < 0) { disk_unbusy(&rf_sc->sc_disk, 0, 1); - rfc_sc->sc_curbuf->b_flags |= B_ERROR; + rfc_sc->sc_curbuf->b_error = EIO; } break; case RFS_NOTINIT: /* Device is not open */ @@ -917,7 +916,7 @@ rfc_intr(void *intarg) panic("Impossible state in rfc_intr(2).\n"); } - if ((rfc_sc->sc_curbuf->b_flags & B_ERROR) != 0) { + if (rfc_sc->sc_curbuf->b_error != 0) { /* * An error occurred while processing this buffer. * Finish it and try to get a new buffer to process. diff --git a/sys/dev/qbus/rl.c b/sys/dev/qbus/rl.c index c16ebd3856a..2d64f73d08c 100644 --- a/sys/dev/qbus/rl.c +++ b/sys/dev/qbus/rl.c @@ -1,4 +1,4 @@ -/* $NetBSD: rl.c,v 1.34 2007/07/21 19:51:48 ad Exp $ */ +/* $NetBSD: rl.c,v 1.35 2007/07/29 12:15:44 ad Exp $ */ /* * Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved. @@ -43,7 +43,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rl.c,v 1.34 2007/07/21 19:51:48 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rl.c,v 1.35 2007/07/29 12:15:44 ad Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -406,7 +406,6 @@ rlstrategy(struct buf *bp) unit = DISKUNIT(bp->b_dev); if (unit > rl_cd.cd_ndevs || (rc = rl_cd.cd_devs[unit]) == NULL) { bp->b_error = ENXIO; - bp->b_flags |= B_ERROR; goto done; } if (rc->rc_state != DK_OPEN) /* How did we end up here at all? */ @@ -611,7 +610,6 @@ rlcintr(void *arg) int error = (cs & RLCS_ERRMSK) >> 10; printf("%s: %s\n", sc->sc_dev.dv_xname, rlerr[error]); - bp->b_flags |= B_ERROR; bp->b_error = EIO; bp->b_resid = bp->b_bcount; sc->sc_bytecnt = 0; diff --git a/sys/dev/qbus/ts.c b/sys/dev/qbus/ts.c index 4c2e8a8f5cc..1a2d5de6437 100644 --- a/sys/dev/qbus/ts.c +++ b/sys/dev/qbus/ts.c @@ -1,4 +1,4 @@ -/* $NetBSD: ts.c,v 1.19 2007/03/04 06:02:30 christos Exp $ */ +/* $NetBSD: ts.c,v 1.20 2007/07/29 12:15:44 ad Exp $ */ /*- * Copyright (c) 1991 The Regents of the University of California. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ts.c,v 1.19 2007/03/04 06:02:30 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ts.c,v 1.20 2007/07/29 12:15:44 ad Exp $"); #undef TSDEBUG @@ -364,7 +364,7 @@ tscommand(struct ts_softc *sc, dev_t dev, int cmd, int count) biowait(bp); if (bp->b_flags & B_WANTED) wakeup((void *)bp); - bp->b_flags &= B_ERROR; + bp->b_flags = 0; } /* @@ -660,7 +660,6 @@ tsintr(void *arg) #ifdef TSDEBUG printf("TS_TC_TSA: EOT\n"); #endif - bp->b_flags |= B_ERROR; bp->b_error = EIO; break; } @@ -730,7 +729,6 @@ tsintr(void *arg) if (sc->sc_rtc++ == 8) { printf("%s: failed 8 retries\n", XNAME); prtstat(sc, sr); - bp->b_flags |= B_ERROR; bp->b_error = EIO; break; } @@ -750,7 +748,6 @@ tsintr(void *arg) if (sc->sc_rtc++ == 8) { printf("%s: failed 8 retries\n", XNAME); prtstat(sc, sr); - bp->b_flags |= B_ERROR; bp->b_error = EIO; break; } @@ -764,7 +761,6 @@ tsintr(void *arg) * has labels or sequence numbers. */ printf("Tape position lost\n"); - bp->b_flags |= B_ERROR; bp->b_error = EIO; break; @@ -794,8 +790,6 @@ tsintr(void *arg) uba_done((void *)device_parent(&sc->sc_dev)); } bp->b_resid = sc->sc_vts->status.rbpcr; - if ((bp->b_flags & B_ERROR) == 0) - bp->b_error = 0; biodone (bp); } tsstart(sc, 0); @@ -997,16 +991,15 @@ tsioctl(dev, cmd, data, flag, p) #endif return (EIO); } - if (bp->b_flags & B_ERROR) { + if (bp->b_error != 0) { #ifdef TSDEBUG printf("error in ioctl %d\n", mtop->mt_op); #endif break; } } while (--callcount > 0); - if (bp->b_flags & B_ERROR) - if ((error = bp->b_error) == 0) - return (EIO); + if (bp->b_error != 0) + error = bp->b_error; return (error); case MTIOCGET: /* get tape status */ diff --git a/sys/dev/spi/spiflash.c b/sys/dev/spi/spiflash.c index 6a62f814f3c..875e12324c6 100644 --- a/sys/dev/spi/spiflash.c +++ b/sys/dev/spi/spiflash.c @@ -1,4 +1,4 @@ -/* $NetBSD: spiflash.c,v 1.5 2007/07/19 00:00:09 dyoung Exp $ */ +/* $NetBSD: spiflash.c,v 1.6 2007/07/29 12:15:44 ad Exp $ */ /*- * Copyright (c) 2006 Urbana-Champaign Independent Media Center. @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: spiflash.c,v 1.5 2007/07/19 00:00:09 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spiflash.c,v 1.6 2007/07/29 12:15:44 ad Exp $"); #include <sys/param.h> #include <sys/conf.h> @@ -309,7 +309,6 @@ spiflash_strategy(struct buf *bp) sc = device_lookup(&spiflash_cd, DISKUNIT(bp->b_dev)); if (sc == NULL) { bp->b_error = ENXIO; - bp->b_flags |= B_ERROR; biodone(bp); return; } @@ -317,7 +316,6 @@ spiflash_strategy(struct buf *bp) if (((bp->b_bcount % sc->sc_write_size) != 0) || (bp->b_blkno < 0)) { bp->b_error = EINVAL; - bp->b_flags |= B_ERROR; biodone(bp); return; } @@ -352,9 +350,7 @@ spiflash_process_done(spiflash_handle_t sc, int err) while ((bp = BUFQ_GET(sc->sc_doneq)) != NULL) { flag = bp->b_flags & B_READ; - if ((bp->b_error = err) != 0) - bp->b_flags |= B_ERROR; - else + if ((bp->b_error = err) == 0) bp->b_resid = 0; cnt += bp->b_bcount - bp->b_resid; biodone(bp); diff --git a/sys/dev/vme/xd.c b/sys/dev/vme/xd.c index 396fa1d9e4d..d67e1a379d1 100644 --- a/sys/dev/vme/xd.c +++ b/sys/dev/vme/xd.c @@ -1,4 +1,4 @@ -/* $NetBSD: xd.c,v 1.68 2007/07/09 21:01:25 ad Exp $ */ +/* $NetBSD: xd.c,v 1.69 2007/07/29 12:15:44 ad Exp $ */ /* * @@ -51,7 +51,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xd.c,v 1.68 2007/07/09 21:01:25 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xd.c,v 1.69 2007/07/29 12:15:44 ad Exp $"); #undef XDC_DEBUG /* full debug */ #define XDC_DIAG /* extra sanity checks */ @@ -1260,7 +1260,7 @@ xdstrategy(bp) bp->b_blkno < 0 || (bp->b_bcount % xd->sc_dk.dk_label->d_secsize) != 0) { bp->b_error = EINVAL; - goto bad; + goto done; } /* do we need to attach the drive? */ @@ -1271,13 +1271,13 @@ xdstrategy(bp) xdattach((struct device *)xd->parent, (struct device *)xd, &xa); if (xd->state == XD_DRIVE_UNKNOWN) { bp->b_error = EIO; - goto bad; + goto done; } } if (xd->state != XD_DRIVE_ONLINE && DISKPART(bp->b_dev) != RAW_PART) { /* no I/O to unlabeled disks, unless raw partition */ bp->b_error = EIO; - goto bad; + goto done; } /* short circuit zero length request */ @@ -1329,8 +1329,6 @@ xdstrategy(bp) splx(s); return; -bad: /* tells upper layers we have an error */ - bp->b_flags |= B_ERROR; done: /* tells upper layers we are done with this * buf */ bp->b_resid = bp->b_bcount; @@ -1929,7 +1927,6 @@ xdc_reset(xdcsc, quiet, blastmode, error, xdsc) switch (XD_STATE(xdcsc->reqs[lcv].mode)) { case XD_SUB_NORM: iorq->buf->b_error = EIO; - iorq->buf->b_flags |= B_ERROR; iorq->buf->b_resid = iorq->sectcnt * XDFM_BPS; @@ -2140,7 +2137,6 @@ xdc_remove_iorq(xdcsc) bp = iorq->buf; if (errs) { bp->b_error = EIO; - bp->b_flags |= B_ERROR; bp->b_resid = iorq->sectcnt * XDFM_BPS; } else { bp->b_resid = 0; /* done */ diff --git a/sys/dev/vme/xy.c b/sys/dev/vme/xy.c index 357ec7f5152..e1368455347 100644 --- a/sys/dev/vme/xy.c +++ b/sys/dev/vme/xy.c @@ -1,4 +1,4 @@ -/* $NetBSD: xy.c,v 1.71 2007/07/09 21:01:26 ad Exp $ */ +/* $NetBSD: xy.c,v 1.72 2007/07/29 12:15:44 ad Exp $ */ /* * @@ -51,7 +51,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xy.c,v 1.71 2007/07/09 21:01:26 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xy.c,v 1.72 2007/07/29 12:15:44 ad Exp $"); #undef XYC_DEBUG /* full debug */ #undef XYC_DIAG /* extra sanity checks */ @@ -1176,7 +1176,7 @@ xystrategy(bp) bp->b_blkno < 0 || (bp->b_bcount % xy->sc_dk.dk_label->d_secsize) != 0) { bp->b_error = EINVAL; - goto bad; + goto done; } /* do we need to attach the drive? */ @@ -1187,13 +1187,13 @@ xystrategy(bp) xyattach((struct device *)xy->parent, (struct device *)xy, &xa); if (xy->state == XY_DRIVE_UNKNOWN) { bp->b_error = EIO; - goto bad; + goto done; } } if (xy->state != XY_DRIVE_ONLINE && DISKPART(bp->b_dev) != RAW_PART) { /* no I/O to unlabeled disks, unless raw partition */ bp->b_error = EIO; - goto bad; + goto done; } /* short circuit zero length request */ @@ -1238,8 +1238,6 @@ xystrategy(bp) splx(s); return; -bad: /* tells upper layers we have an error */ - bp->b_flags |= B_ERROR; done: /* tells upper layers we are done with this * buf */ bp->b_resid = bp->b_bcount; @@ -1835,7 +1833,6 @@ xyc_reset(xycsc, quiet, blastmode, error, xysc) switch (XY_STATE(iorq->mode)) { case XY_SUB_NORM: iorq->buf->b_error = EIO; - iorq->buf->b_flags |= B_ERROR; iorq->buf->b_resid = iorq->sectcnt * XYFM_BPS; bus_dmamap_sync(xycsc->dmatag, iorq->dmamap, 0, @@ -2017,7 +2014,6 @@ xyc_remove_iorq(xycsc) bp = iorq->buf; if (errs) { bp->b_error = EIO; - bp->b_flags |= B_ERROR; bp->b_resid = iorq->sectcnt * XYFM_BPS; } else { bp->b_resid = 0; /* done */ |
