scsi/core: Improve static type checking
authorBart Van Assche <bvanassche@acm.org>
Thu, 14 Jul 2022 18:07:05 +0000 (11:07 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 14 Jul 2022 18:14:32 +0000 (12:14 -0600)
Improve static type checking by using the new blk_opf_t type for the
combination of a request operation and its flags.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: John Garry <john.garry@huawei.com>
Cc: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20220714180729.1065367-40-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/scsi/scsi_lib.c
include/scsi/scsi_cmnd.h

index 1b3ca5c..06ec470 100644 (file)
@@ -1125,12 +1125,12 @@ static void scsi_initialize_rq(struct request *rq)
        cmd->retries = 0;
 }
 
-struct request *scsi_alloc_request(struct request_queue *q,
-               unsigned int op, blk_mq_req_flags_t flags)
+struct request *scsi_alloc_request(struct request_queue *q, blk_opf_t opf,
+                                  blk_mq_req_flags_t flags)
 {
        struct request *rq;
 
-       rq = blk_mq_alloc_request(q, op, flags);
+       rq = blk_mq_alloc_request(q, opf, flags);
        if (!IS_ERR(rq))
                scsi_initialize_rq(rq);
        return rq;
index 1e80e70..bac55de 100644 (file)
@@ -386,7 +386,7 @@ static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd)
 extern void scsi_build_sense(struct scsi_cmnd *scmd, int desc,
                             u8 key, u8 asc, u8 ascq);
 
-struct request *scsi_alloc_request(struct request_queue *q,
-               unsigned int op, blk_mq_req_flags_t flags);
+struct request *scsi_alloc_request(struct request_queue *q, blk_opf_t opf,
+                                  blk_mq_req_flags_t flags);
 
 #endif /* _SCSI_SCSI_CMND_H */