mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									cb2b62082c
								
							
						
					
					
						commit
						fb597392b1
					
				
					 2 changed files with 26 additions and 10 deletions
				
			
		| 
						 | 
					@ -1644,16 +1644,10 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
mega_rundoneq (adapter_t *adapter)
 | 
					mega_rundoneq (adapter_t *adapter)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct scsi_cmnd *cmd;
 | 
						struct megaraid_cmd_priv *cmd_priv;
 | 
				
			||||||
	struct list_head *pos;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	list_for_each(pos, &adapter->completed_list) {
 | 
						list_for_each_entry(cmd_priv, &adapter->completed_list, entry)
 | 
				
			||||||
 | 
							scsi_done(megaraid_to_scsi_cmd(cmd_priv));
 | 
				
			||||||
		struct scsi_pointer* spos = (struct scsi_pointer *)pos;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		cmd = list_entry(spos, struct scsi_cmnd, SCp);
 | 
					 | 
				
			||||||
		scsi_done(cmd);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	INIT_LIST_HEAD(&adapter->completed_list);
 | 
						INIT_LIST_HEAD(&adapter->completed_list);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -4123,6 +4117,7 @@ static struct scsi_host_template megaraid_template = {
 | 
				
			||||||
	.eh_bus_reset_handler		= megaraid_reset,
 | 
						.eh_bus_reset_handler		= megaraid_reset,
 | 
				
			||||||
	.eh_host_reset_handler		= megaraid_reset,
 | 
						.eh_host_reset_handler		= megaraid_reset,
 | 
				
			||||||
	.no_write_same			= 1,
 | 
						.no_write_same			= 1,
 | 
				
			||||||
 | 
						.cmd_size			= sizeof(struct megaraid_cmd_priv),
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,6 +4,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <linux/spinlock.h>
 | 
					#include <linux/spinlock.h>
 | 
				
			||||||
#include <linux/mutex.h>
 | 
					#include <linux/mutex.h>
 | 
				
			||||||
 | 
					#include <scsi/scsi_cmnd.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MEGARAID_VERSION	\
 | 
					#define MEGARAID_VERSION	\
 | 
				
			||||||
	"v2.00.4 (Release Date: Thu Feb 9 08:51:30 EST 2006)\n"
 | 
						"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 CACHED_IO		0
 | 
				
			||||||
#define DIRECT_IO		1
 | 
					#define DIRECT_IO		1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct megaraid_cmd_priv {
 | 
				
			||||||
 | 
						struct list_head entry;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define SCSI_LIST(scp) ((struct list_head *)(&(scp)->SCp))
 | 
					#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));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return &container_of(cmd_priv, struct scsi_cmd_and_priv, priv)->cmd;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Each controller's soft state
 | 
					 * Each controller's soft state
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue