Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: core: Change the type of the second argument of scsi_host_complete_all_commands()

Allow the compiler to verify the type of the second argument passed to
scsi_host_complete_all_commands().

Link: https://lore.kernel.org/r/20210524025457.11299-4-bvanassche@acm.org
Cc: Hannes Reinecke <hare@suse.com>
Cc: John Garry <john.garry@huawei.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>

authored by

Bart Van Assche and committed by
Martin K. Petersen
62af0ee9 149d0e48

+6 -4
+5 -3
drivers/scsi/hosts.c
··· 655 655 static bool complete_all_cmds_iter(struct request *rq, void *data, bool rsvd) 656 656 { 657 657 struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(rq); 658 - int status = *(int *)data; 658 + enum scsi_host_status status = *(enum scsi_host_status *)data; 659 659 660 660 scsi_dma_unmap(scmd); 661 - scmd->result = status << 16; 661 + scmd->result = 0; 662 + set_host_byte(scmd, status); 662 663 scmd->scsi_done(scmd); 663 664 return true; 664 665 } ··· 674 673 * caller to ensure that concurrent I/O submission and/or 675 674 * completion is stopped when calling this function. 676 675 */ 677 - void scsi_host_complete_all_commands(struct Scsi_Host *shost, int status) 676 + void scsi_host_complete_all_commands(struct Scsi_Host *shost, 677 + enum scsi_host_status status) 678 678 { 679 679 blk_mq_tagset_busy_iter(&shost->tag_set, complete_all_cmds_iter, 680 680 &status);
+1 -1
include/scsi/scsi_host.h
··· 764 764 extern struct Scsi_Host *scsi_host_lookup(unsigned short); 765 765 extern const char *scsi_host_state_name(enum scsi_host_state); 766 766 extern void scsi_host_complete_all_commands(struct Scsi_Host *shost, 767 - int status); 767 + enum scsi_host_status status); 768 768 769 769 static inline int __must_check scsi_add_host(struct Scsi_Host *host, 770 770 struct device *dev)