summaryrefslogtreecommitdiff
path: root/sys/dev/gpib
diff options
context:
space:
mode:
authorad <ad@NetBSD.org>2007-07-29 12:15:35 +0000
committerad <ad@NetBSD.org>2007-07-29 12:15:35 +0000
commit66fefd117bcf82d547bfa88ca68a5b43f17a7103 (patch)
tree6344a9f4cbb126386fe0895fb71a9fab75c81aa6 /sys/dev/gpib
parent480f8d26c5a97f0c8620ae2e36349bfc462ca19c (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/gpib')
-rw-r--r--sys/dev/gpib/ct.c6
-rw-r--r--sys/dev/gpib/mt.c17
-rw-r--r--sys/dev/gpib/rd.c12
3 files changed, 12 insertions, 23 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)