summaryrefslogtreecommitdiff
path: root/sys/arch/sparc/dev/xd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/sparc/dev/xd.c')
-rw-r--r--sys/arch/sparc/dev/xd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/arch/sparc/dev/xd.c b/sys/arch/sparc/dev/xd.c
index dd5df1fa016..70caf5e3e48 100644
--- a/sys/arch/sparc/dev/xd.c
+++ b/sys/arch/sparc/dev/xd.c
@@ -103,7 +103,8 @@
* XDC_HWAIT: add iorq "N" to head of SC's wait queue
*/
#define XDC_HWAIT(SC, N) { \
- (SC)->waithead = ((SC)->waithead - 1) % XDC_MAXIOPB; \
+ (SC)->waithead = ((SC)->waithead == 0) ? \
+ (XDC_MAXIOPB - 1) : ((SC)->waithead - 1); \
(SC)->waitq[(SC)->waithead] = (N); \
(SC)->nwait++; \
}