aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/scsi.h
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2021-04-27 10:30:14 +0200
committerMartin K. Petersen <martin.petersen@oracle.com>2021-05-31 22:48:21 -0400
commitd0672a03e0af5dd4b07dc9175b38e44290722192 (patch)
treed7b4890299d7b8ea026d14ed7775468acf3d30fe /include/scsi/scsi.h
parentscsi: core: Introduce scsi_build_sense() (diff)
downloadlinux-dev-d0672a03e0af5dd4b07dc9175b38e44290722192.tar.xz
linux-dev-d0672a03e0af5dd4b07dc9175b38e44290722192.zip
scsi: core: Introduce scsi_status_is_check_condition()
Add a helper function scsi_status_is_check_condition() to encapsulate the frequent checks for SAM_STAT_CHECK_CONDITION. Link: https://lore.kernel.org/r/20210427083046.31620-9-hare@suse.de Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'include/scsi/scsi.h')
-rw-r--r--include/scsi/scsi.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 6dc2d1b3735e..57f0ca00ddda 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -62,6 +62,21 @@ static inline int scsi_is_wlun(u64 lun)
return (lun & 0xff00) == SCSI_W_LUN_BASE;
}
+/**
+ * scsi_status_is_check_condition - check the status return.
+ *
+ * @status: the status passed up from the driver (including host and
+ * driver components)
+ *
+ * This returns true if the status code is SAM_STAT_CHECK_CONDITION.
+ */
+static inline int scsi_status_is_check_condition(int status)
+{
+ if (status < 0)
+ return false;
+ status &= 0xfe;
+ return status == SAM_STAT_CHECK_CONDITION;
+}
/*
* MESSAGE CODES