summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2019-09-29 17:57:37 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2019-09-29 17:57:37 +0000
commitea32f8792601d27c6999d7a816b2fad68f1247b4 (patch)
treec0f8d0ad9d39269df25fda259a5935ed93eb54d7 /sys/scsi
parent877d651832f891e1a8224202faf331a8a97990cf (diff)
Introduce SC_DEBUG_SENSE() and simplify code by eliminating a bunch
of three line SCSIDEBUG chunks.
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/cd.c6
-rw-r--r--sys/scsi/scsi_base.c6
-rw-r--r--sys/scsi/scsi_debug.h8
-rw-r--r--sys/scsi/scsi_ioctl.c14
-rw-r--r--sys/scsi/sd.c6
-rw-r--r--sys/scsi/st.c6
6 files changed, 18 insertions, 28 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index f4f5ac2e021..151d78ca5e9 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd.c,v 1.229 2019/09/29 15:47:29 krw Exp $ */
+/* $OpenBSD: cd.c,v 1.230 2019/09/29 17:57:36 krw Exp $ */
/* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */
/*
@@ -621,9 +621,7 @@ cd_buf_done(struct scsi_xfer *xs)
case XS_SENSE:
case XS_SHORTSENSE:
-#ifdef SCSIDEBUG
- scsi_show_sense(xs);
-#endif /* SCSIDEBUG */
+ SC_DEBUG_SENSE(xs);
error = cd_interpret_sense(xs);
if (error == 0) {
bp->b_error = 0;
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index bd60e06710a..175ed9c2256 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.236 2019/09/29 16:10:30 krw Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.237 2019/09/29 17:57:36 krw Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -1401,9 +1401,7 @@ scsi_xs_error(struct scsi_xfer *xs)
case XS_SENSE:
case XS_SHORTSENSE:
-#ifdef SCSIDEBUG
- scsi_show_sense(xs);
-#endif /* SCSIDEBUG */
+ SC_DEBUG_SENSE(xs);
error = xs->sc_link->interpret_sense(xs);
SC_DEBUG(xs->sc_link, SDEV_DB3,
("scsi_interpret_sense returned %#x\n", error));
diff --git a/sys/scsi/scsi_debug.h b/sys/scsi/scsi_debug.h
index 6d6a14e6e3e..2035ea84ce1 100644
--- a/sys/scsi/scsi_debug.h
+++ b/sys/scsi/scsi_debug.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_debug.h,v 1.18 2019/09/29 17:23:24 krw Exp $ */
+/* $OpenBSD: scsi_debug.h,v 1.19 2019/09/29 17:57:36 krw Exp $ */
/* $NetBSD: scsi_debug.h,v 1.7 1996/10/12 23:23:16 christos Exp $ */
/*
@@ -56,8 +56,12 @@ void scsi_show_flags(u_int16_t, const char **);
printf Printstuff; \
} \
} while (0)
+#define SC_DEBUG_SENSE(xs) do { \
+ scsi_show_sense(xs); \
+} while (0)
#else
-#define SC_DEBUG(A,B,C)
+#define SC_DEBUG(link,level,Printstuff)
+#define SC_DEBUG_SENSE(xs)
#endif /* SCSIDEBUG */
#endif /* _KERNEL */
diff --git a/sys/scsi/scsi_ioctl.c b/sys/scsi/scsi_ioctl.c
index ab93981416d..fddbfbadfcb 100644
--- a/sys/scsi/scsi_ioctl.c
+++ b/sys/scsi/scsi_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_ioctl.c,v 1.56 2019/09/29 15:47:29 krw Exp $ */
+/* $OpenBSD: scsi_ioctl.c,v 1.57 2019/09/29 17:57:36 krw Exp $ */
/* $NetBSD: scsi_ioctl.c,v 1.23 1996/10/12 23:23:17 christos Exp $ */
/*
@@ -148,18 +148,14 @@ scsi_ioc_cmd(struct scsi_link *link, scsireq_t *screq)
screq->retsts = SCCMD_OK;
break;
case XS_SENSE:
-#ifdef SCSIDEBUG
- scsi_show_sense(xs);
-#endif /* SCSIDEBUG */
+ SC_DEBUG_SENSE(xs);
screq->senselen_used = min(sizeof(xs->sense),
sizeof(screq->sense));
memcpy(screq->sense, &xs->sense, screq->senselen_used);
screq->retsts = SCCMD_SENSE;
break;
case XS_SHORTSENSE:
-#ifdef SCSIDEBUG
- scsi_show_sense(xs);
-#endif /* SCSIDEBUG */
+ SC_DEBUG_SENSE(xs);
printf("XS_SHORTSENSE\n");
screq->senselen_used = min(sizeof(xs->sense),
sizeof(screq->sense));
@@ -265,9 +261,7 @@ scsi_ioc_ata_cmd(struct scsi_link *link, atareq_t *atareq)
switch (xs->error) {
case XS_SENSE:
case XS_SHORTSENSE:
-#ifdef SCSIDEBUG
- scsi_show_sense(xs);
-#endif /* SCSIDEBUG */
+ SC_DEBUG_SENSE(xs);
/* XXX this is not right */
case XS_NOERROR:
atareq->retsts = ATACMD_OK;
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 8a08e400b4d..1fd35074e5f 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.284 2019/09/29 15:47:29 krw Exp $ */
+/* $OpenBSD: sd.c,v 1.285 2019/09/29 17:57:36 krw Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -765,9 +765,7 @@ sd_buf_done(struct scsi_xfer *xs)
case XS_SENSE:
case XS_SHORTSENSE:
-#ifdef SCSIDEBUG
- scsi_show_sense(xs);
-#endif /* SCSIDEBUG */
+ SC_DEBUG_SENSE(xs);
error = sd_interpret_sense(xs);
if (error == 0) {
bp->b_error = 0;
diff --git a/sys/scsi/st.c b/sys/scsi/st.c
index 4fa828cb6a0..f39b44cb75d 100644
--- a/sys/scsi/st.c
+++ b/sys/scsi/st.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: st.c,v 1.168 2019/09/29 17:23:24 krw Exp $ */
+/* $OpenBSD: st.c,v 1.169 2019/09/29 17:57:36 krw Exp $ */
/* $NetBSD: st.c,v 1.71 1997/02/21 23:03:49 thorpej Exp $ */
/*
@@ -957,9 +957,7 @@ st_buf_done(struct scsi_xfer *xs)
case XS_SENSE:
case XS_SHORTSENSE:
-#ifdef SCSIDEBUG
- scsi_show_sense(xs);
-#endif /* SCSIDEBUG */
+ SC_DEBUG_SENSE(xs);
error = st_interpret_sense(xs);
if (error == 0) {
bp->b_error = 0;