summaryrefslogtreecommitdiff
path: root/drivers/scsi/megaraid.h
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2022-02-18 11:51:00 -0800
committerMartin K. Petersen <martin.petersen@oracle.com>2022-02-22 21:11:05 -0500
commitfb597392b1f49b4fe1a280471f00817daee1436c (patch)
tree132609fcdf9fcd33abc4f6aaf38b5cc04739562b /drivers/scsi/megaraid.h
parentcb2b62082c3ab5d6f34264c6e9bbd9e84389d9a5 (diff)
downloadlwn-fb597392b1f49b4fe1a280471f00817daee1436c.tar.gz
lwn-fb597392b1f49b4fe1a280471f00817daee1436c.zip
scsi: megaraid: Stop using the SCSI pointer
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd. Link: https://lore.kernel.org/r/20220218195117.25689-33-bvanassche@acm.org Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/megaraid.h')
-rw-r--r--drivers/scsi/megaraid.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/scsi/megaraid.h b/drivers/scsi/megaraid.h
index cce23a086fbe..013fbfb911b9 100644
--- a/drivers/scsi/megaraid.h
+++ b/drivers/scsi/megaraid.h
@@ -4,6 +4,7 @@
#include <linux/spinlock.h>
#include <linux/mutex.h>
+#include <scsi/scsi_cmnd.h>
#define MEGARAID_VERSION \
"v2.00.4 (Release Date: Thu Feb 9 08:51:30 EST 2006)\n"
@@ -756,8 +757,28 @@ struct private_bios_data {
#define CACHED_IO 0
#define DIRECT_IO 1
+struct megaraid_cmd_priv {
+ struct list_head entry;
+};
+
+#define SCSI_LIST(scp) \
+ (&((struct megaraid_cmd_priv *)scsi_cmd_priv(scp))->entry)
+
+struct scsi_cmd_and_priv {
+ struct scsi_cmnd cmd;
+ struct megaraid_cmd_priv priv;
+};
+
+static inline struct scsi_cmnd *
+megaraid_to_scsi_cmd(struct megaraid_cmd_priv *cmd_priv)
+{
+ /* See also scsi_mq_setup_tags() */
+ BUILD_BUG_ON(sizeof(struct scsi_cmd_and_priv) !=
+ sizeof(struct scsi_cmnd) +
+ sizeof(struct megaraid_cmd_priv));
-#define SCSI_LIST(scp) ((struct list_head *)(&(scp)->SCp))
+ return &container_of(cmd_priv, struct scsi_cmd_and_priv, priv)->cmd;
+}
/*
* Each controller's soft state