Skip to content

Commit

Permalink
Change the type of the second argument of scsi_host_complete_all_comm…
Browse files Browse the repository at this point in the history
…ands()

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

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
  • Loading branch information
bvanassche committed Apr 10, 2021
1 parent 8311784 commit b456127
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions drivers/scsi/hosts.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,11 @@ EXPORT_SYMBOL_GPL(scsi_flush_work);
static bool complete_all_cmds_iter(struct request *rq, void *data, bool rsvd)
{
struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(rq);
int status = *(int *)data;
enum host_status status = *(enum host_status *)data;

scsi_dma_unmap(scmd);
scmd->result = status << 16;
scmd->result = 0;
set_host_byte(scmd, status);
scmd->scsi_done(scmd);
return true;
}
Expand All @@ -675,7 +676,8 @@ static bool complete_all_cmds_iter(struct request *rq, void *data, bool rsvd)
* caller to ensure that concurrent I/O submission and/or
* completion is stopped when calling this function.
*/
void scsi_host_complete_all_commands(struct Scsi_Host *shost, int status)
void scsi_host_complete_all_commands(struct Scsi_Host *shost,
enum host_status status)
{
blk_mq_tagset_busy_iter(&shost->tag_set, complete_all_cmds_iter,
&status);
Expand Down
2 changes: 1 addition & 1 deletion include/scsi/scsi_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ extern void scsi_host_put(struct Scsi_Host *t);
extern struct Scsi_Host *scsi_host_lookup(unsigned short);
extern const char *scsi_host_state_name(enum scsi_host_state);
extern void scsi_host_complete_all_commands(struct Scsi_Host *shost,
int status);
enum host_status status);

static inline int __must_check scsi_add_host(struct Scsi_Host *host,
struct device *dev)
Expand Down

0 comments on commit b456127

Please sign in to comment.