Skip to content

Commit 0db3f51

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: Change the return type of the .queuecommand() callback
In clang version 21.1 and later the -Wimplicit-enum-enum-cast warning option has been introduced. This warning is enabled by default and can be used to catch .queuecommand() implementations that return another value than 0 or one of the SCSI_MLQUEUE_* constants. Hence this patch that changes the return type of the .queuecommand() implementations from 'int' into 'enum scsi_qc_status'. No functionality has been changed. Cc: Damien Le Moal <dlemoal@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://patch.msgid.link/20260115210357.2501991-6-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 5612404 commit 0db3f51

104 files changed

Lines changed: 255 additions & 195 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)