Skip to content

Commit 92da381

Browse files
Merge patch series "Change the return type of the .queuecommand() callback"
Bart Van Assche <bvanassche@acm.org> says: Hi Martin, Most but not all .queuecommand() implementations return a SCSI_MLQUEUE_* constant. This affects code readability: in order to understand what happens if a .queuecommand() function returns a value that is not a SCSI_MLQUEUE_* constant, one has to read the scsi_dispatch_cmd() implementation and check how other values are handled. Hence this patch series that changes the return type of the .queuecommand() callback and also of the implementations of this callback. Please consider this patch series for the next merge window. Thanks, Bart. Link: https://patch.msgid.link/20260115210357.2501991-1-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 parents a9e03ec + 0db3f51 commit 92da381

104 files changed

Lines changed: 267 additions & 207 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Documentation/scsi/scsi_mid_low_api.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,8 @@ Details::
903903
*
904904
* Defined in: LLD
905905
**/
906-
int queuecommand(struct Scsi_Host *shost, struct scsi_cmnd * scp)
906+
enum scsi_qc_status queuecommand(struct Scsi_Host *shost,
907+
struct scsi_cmnd *scp)
907908

908909

909910
/**

drivers/ata/libata-scsi.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4309,7 +4309,8 @@ static inline ata_xlat_func_t ata_get_xlat_func(struct ata_device *dev, u8 cmd)
43094309
return NULL;
43104310
}
43114311

4312-
int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, struct ata_device *dev)
4312+
enum scsi_qc_status __ata_scsi_queuecmd(struct scsi_cmnd *scmd,
4313+
struct ata_device *dev)
43134314
{
43144315
struct ata_port *ap = dev->link->ap;
43154316
u8 scsi_op = scmd->cmnd[0];
@@ -4383,12 +4384,13 @@ int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, struct ata_device *dev)
43834384
* Return value from __ata_scsi_queuecmd() if @cmd can be queued,
43844385
* 0 otherwise.
43854386
*/
4386-
int ata_scsi_queuecmd(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
4387+
enum scsi_qc_status ata_scsi_queuecmd(struct Scsi_Host *shost,
4388+
struct scsi_cmnd *cmd)
43874389
{
43884390
struct ata_port *ap;
43894391
struct ata_device *dev;
43904392
struct scsi_device *scsidev = cmd->device;
4391-
int rc = 0;
4393+
enum scsi_qc_status rc = 0;
43924394
unsigned long irq_flags;
43934395

43944396
ap = ata_shost_to_port(shost);

drivers/ata/libata.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ extern int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel,
164164
void ata_scsi_sdev_config(struct scsi_device *sdev);
165165
int ata_scsi_dev_config(struct scsi_device *sdev, struct queue_limits *lim,
166166
struct ata_device *dev);
167-
int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, struct ata_device *dev);
167+
enum scsi_qc_status __ata_scsi_queuecmd(struct scsi_cmnd *scmd,
168+
struct ata_device *dev);
168169

169170
/* libata-eh.c */
170171
extern unsigned int ata_internal_cmd_timeout(struct ata_device *dev, u8 cmd);

drivers/firewire/sbp2.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,13 +1440,14 @@ static int sbp2_map_scatterlist(struct sbp2_command_orb *orb,
14401440

14411441
/* SCSI stack integration */
14421442

1443-
static int sbp2_scsi_queuecommand(struct Scsi_Host *shost,
1444-
struct scsi_cmnd *cmd)
1443+
static enum scsi_qc_status sbp2_scsi_queuecommand(struct Scsi_Host *shost,
1444+
struct scsi_cmnd *cmd)
14451445
{
14461446
struct sbp2_logical_unit *lu = cmd->device->hostdata;
14471447
struct fw_device *device = target_parent_device(lu->tgt);
1448+
enum scsi_qc_status retval = SCSI_MLQUEUE_HOST_BUSY;
14481449
struct sbp2_command_orb *orb;
1449-
int generation, retval = SCSI_MLQUEUE_HOST_BUSY;
1450+
int generation;
14501451

14511452
orb = kzalloc(sizeof(*orb), GFP_ATOMIC);
14521453
if (orb == NULL)

drivers/infiniband/ulp/srp/ib_srp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2148,7 +2148,8 @@ static void srp_handle_qp_err(struct ib_cq *cq, struct ib_wc *wc,
21482148
target->qp_in_error = true;
21492149
}
21502150

2151-
static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd)
2151+
static enum scsi_qc_status srp_queuecommand(struct Scsi_Host *shost,
2152+
struct scsi_cmnd *scmnd)
21522153
{
21532154
struct request *rq = scsi_cmd_to_rq(scmnd);
21542155
struct srp_target_port *target = host_to_target(shost);

drivers/message/fusion/mptfc.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ static u8 mptfcInternalCtx = MPT_MAX_PROTOCOL_DRIVERS;
9797

9898
static int mptfc_target_alloc(struct scsi_target *starget);
9999
static int mptfc_sdev_init(struct scsi_device *sdev);
100-
static int mptfc_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt);
100+
static enum scsi_qc_status mptfc_qcmd(struct Scsi_Host *shost,
101+
struct scsi_cmnd *SCpnt);
101102
static void mptfc_target_destroy(struct scsi_target *starget);
102103
static void mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout);
103104
static void mptfc_remove(struct pci_dev *pdev);
@@ -676,8 +677,8 @@ mptfc_sdev_init(struct scsi_device *sdev)
676677
return 0;
677678
}
678679

679-
static int
680-
mptfc_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt)
680+
static enum scsi_qc_status mptfc_qcmd(struct Scsi_Host *shost,
681+
struct scsi_cmnd *SCpnt)
681682
{
682683
struct mptfc_rport_info *ri;
683684
struct fc_rport *rport = starget_to_rport(scsi_target(SCpnt->device));

drivers/message/fusion/mptsas.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,8 +1920,8 @@ mptsas_sdev_init(struct scsi_device *sdev)
19201920
return 0;
19211921
}
19221922

1923-
static int
1924-
mptsas_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt)
1923+
static enum scsi_qc_status mptsas_qcmd(struct Scsi_Host *shost,
1924+
struct scsi_cmnd *SCpnt)
19251925
{
19261926
MPT_SCSI_HOST *hd;
19271927
MPT_ADAPTER *ioc;

drivers/message/fusion/mptscsih.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,8 +1309,7 @@ int mptscsih_show_info(struct seq_file *m, struct Scsi_Host *host)
13091309
*
13101310
* Returns 0. (rtn value discarded by linux scsi mid-layer)
13111311
*/
1312-
int
1313-
mptscsih_qcmd(struct scsi_cmnd *SCpnt)
1312+
enum scsi_qc_status mptscsih_qcmd(struct scsi_cmnd *SCpnt)
13141313
{
13151314
MPT_SCSI_HOST *hd;
13161315
MPT_FRAME_HDR *mf;

drivers/message/fusion/mptscsih.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ extern int mptscsih_resume(struct pci_dev *pdev);
113113
#endif
114114
extern int mptscsih_show_info(struct seq_file *, struct Scsi_Host *);
115115
extern const char * mptscsih_info(struct Scsi_Host *SChost);
116-
extern int mptscsih_qcmd(struct scsi_cmnd *SCpnt);
116+
extern enum scsi_qc_status mptscsih_qcmd(struct scsi_cmnd *SCpnt);
117117
extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel,
118118
u8 id, u64 lun, int ctx2abort, ulong timeout);
119119
extern void mptscsih_sdev_destroy(struct scsi_device *device);

drivers/message/fusion/mptspi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,8 +774,8 @@ static int mptspi_sdev_configure(struct scsi_device *sdev,
774774
return 0;
775775
}
776776

777-
static int
778-
mptspi_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt)
777+
static enum scsi_qc_status mptspi_qcmd(struct Scsi_Host *shost,
778+
struct scsi_cmnd *SCpnt)
779779
{
780780
struct _MPT_SCSI_HOST *hd = shost_priv(shost);
781781
VirtDevice *vdevice = SCpnt->device->hostdata;

0 commit comments

Comments
 (0)