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

Configure Feed

Select the types of activity you want to include in your feed.

scsi: core: Introduce an enumeration type for the SCSI_MLQUEUE constants

Multiple functions in the SCSI core accept an 'int reason' argument.
The 'int' type of these arguments doesn't make it clear what values are
acceptable for these arguments. Document which values are supported for
these arguments by introducing the enumeration type scsi_qc_status. 'qc'
in the type name stands for 'queuecommand' since the values passed as
the 'reason' argument are the .queuecommand() return values.

Cc: John Garry <john.g.garry@oracle.com>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20251113181730.1109331-1-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Bart Van Assche and committed by
Martin K. Petersen
0f9c4be7 c6e9ddc0

+16 -11
+6 -5
drivers/scsi/scsi_lib.c
··· 76 76 } 77 77 78 78 static void 79 - scsi_set_blocked(struct scsi_cmnd *cmd, int reason) 79 + scsi_set_blocked(struct scsi_cmnd *cmd, enum scsi_qc_status reason) 80 80 { 81 81 struct Scsi_Host *host = cmd->device->host; 82 82 struct scsi_device *device = cmd->device; ··· 139 139 * for a requeue after completion, which should only occur in this 140 140 * file. 141 141 */ 142 - static void __scsi_queue_insert(struct scsi_cmnd *cmd, int reason, bool unbusy) 142 + static void __scsi_queue_insert(struct scsi_cmnd *cmd, 143 + enum scsi_qc_status reason, bool unbusy) 143 144 { 144 145 struct scsi_device *device = cmd->device; 145 146 ··· 180 179 * Context: This could be called either from an interrupt context or a normal 181 180 * process context. 182 181 */ 183 - void scsi_queue_insert(struct scsi_cmnd *cmd, int reason) 182 + void scsi_queue_insert(struct scsi_cmnd *cmd, enum scsi_qc_status reason) 184 183 { 185 184 __scsi_queue_insert(cmd, reason, true); 186 185 } ··· 1578 1577 * Return: nonzero return request was rejected and device's queue needs to be 1579 1578 * plugged. 1580 1579 */ 1581 - static int scsi_dispatch_cmd(struct scsi_cmnd *cmd) 1580 + static enum scsi_qc_status scsi_dispatch_cmd(struct scsi_cmnd *cmd) 1582 1581 { 1583 1582 struct Scsi_Host *host = cmd->device->host; 1584 1583 int rtn = 0; ··· 1827 1826 struct Scsi_Host *shost = sdev->host; 1828 1827 struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req); 1829 1828 blk_status_t ret; 1830 - int reason; 1829 + enum scsi_qc_status reason; 1831 1830 1832 1831 WARN_ON_ONCE(cmd->budget_token < 0); 1833 1832
+2 -1
drivers/scsi/scsi_priv.h
··· 102 102 103 103 /* scsi_lib.c */ 104 104 extern void scsi_device_unbusy(struct scsi_device *sdev, struct scsi_cmnd *cmd); 105 - extern void scsi_queue_insert(struct scsi_cmnd *cmd, int reason); 105 + extern void scsi_queue_insert(struct scsi_cmnd *cmd, 106 + enum scsi_qc_status reason); 106 107 extern void scsi_io_completion(struct scsi_cmnd *, unsigned int); 107 108 extern void scsi_run_host_queues(struct Scsi_Host *shost); 108 109 extern void scsi_requeue_run_queue(struct work_struct *work);
+8 -5
include/scsi/scsi.h
··· 106 106 }; 107 107 108 108 /* 109 - * Midlevel queue return values. 109 + * Status values returned by the .queuecommand() callback if a command has not 110 + * been queued. 110 111 */ 111 - #define SCSI_MLQUEUE_HOST_BUSY 0x1055 112 - #define SCSI_MLQUEUE_DEVICE_BUSY 0x1056 113 - #define SCSI_MLQUEUE_EH_RETRY 0x1057 114 - #define SCSI_MLQUEUE_TARGET_BUSY 0x1058 112 + enum scsi_qc_status { 113 + SCSI_MLQUEUE_HOST_BUSY = 0x1055, 114 + SCSI_MLQUEUE_DEVICE_BUSY = 0x1056, 115 + SCSI_MLQUEUE_EH_RETRY = 0x1057, 116 + SCSI_MLQUEUE_TARGET_BUSY = 0x1058, 117 + }; 115 118 116 119 /* 117 120 * Use these to separate status msg and our bytes