qla2x00t-32gbit: Enable type checking for the SRB free and done callback functions

Since all pointers passed to the srb_t.done() and srb_t.free() functions
have type srb_t, change the type of the first argument of these functions
from void * into struct srb *. This allows the compiler to verify the
argument types for these functions. This patch does not change any
functionality.

[ commit 6c18a43e3c82b0b67531a1cdec7ba31540fe6424 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8544 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2019-08-25 02:33:13 +00:00
parent dc61adfa3a
commit 41d4d6316b
13 changed files with 54 additions and 101 deletions
+2 -6
View File
@@ -33,10 +33,8 @@ static inline void bsg_job_done_backport(struct fc_bsg_job *job, int result,
#endif
/* BSG support for ELS/CT pass through */
void
qla2x00_bsg_job_done(void *ptr, int res)
void qla2x00_bsg_job_done(srb_t *sp, int res)
{
srb_t *sp = ptr;
#ifndef NEW_LIBFC_API
struct fc_bsg_job *bsg_job = sp->u.bsg_job;
#else
@@ -50,10 +48,8 @@ qla2x00_bsg_job_done(void *ptr, int res)
sp->free(sp);
}
void
qla2x00_bsg_sp_free(void *ptr)
void qla2x00_bsg_sp_free(srb_t *sp)
{
srb_t *sp = ptr;
struct qla_hw_data *ha = sp->vha->hw;
#ifndef NEW_LIBFC_API
struct fc_bsg_job *bsg_job = sp->u.bsg_job;
+12 -2
View File
@@ -632,8 +632,18 @@ typedef struct srb {
#endif
struct srb_cmd scmd;
} u;
void (*done)(void *, int);
void (*free)(void *);
/*
* Report completion status @res and call sp_put(@sp). @res is
* an NVMe status code, a SCSI result (e.g. DID_OK << 16) or a
* QLA_* status value.
*/
void (*done)(struct srb *sp, int res);
/* Stop the timer and free @sp. Only used by the FCP code. */
void (*free)(struct srb *sp);
/*
* Call nvme_private->fd->done() and free @sp. Only used by the NVMe
* code.
*/
void (*put_fn)(struct kref *kref);
} srb_t;
+7 -7
View File
@@ -219,9 +219,9 @@ extern int qla2x00_post_uevent_work(struct scsi_qla_host *, u32);
extern int qla2x00_post_uevent_work(struct scsi_qla_host *, u32);
extern void qla2x00_disable_board_on_pci_error(struct work_struct *);
extern void qla2x00_sp_compl(void *, int);
extern void qla2xxx_qpair_sp_free_dma(void *);
extern void qla2xxx_qpair_sp_compl(void *, int);
extern void qla2x00_sp_compl(srb_t *sp, int);
extern void qla2xxx_qpair_sp_free_dma(srb_t *sp);
extern void qla2xxx_qpair_sp_compl(srb_t *sp, int);
extern void qla24xx_sched_upd_fcport(fc_port_t *);
void qla2x00_handle_login_done_event(struct scsi_qla_host *, fc_port_t *,
uint16_t *);
@@ -250,7 +250,7 @@ extern void qla2x00_do_dpc_all_vps(scsi_qla_host_t *);
extern int qla24xx_vport_create_req_sanity_check(struct fc_vport *);
extern scsi_qla_host_t *qla24xx_create_vhost(struct fc_vport *);
extern void qla2x00_sp_free_dma(void *);
extern void qla2x00_sp_free_dma(srb_t *sp);
extern char *qla2x00_get_fw_version_str(struct scsi_qla_host *, char *);
extern void qla2x00_mark_device_lost(scsi_qla_host_t *, fc_port_t *, int, int);
@@ -796,10 +796,10 @@ extern int qla82xx_restart_isp(scsi_qla_host_t *);
/* IOCB related functions */
extern int qla82xx_start_scsi(srb_t *);
extern void qla2x00_sp_free(void *);
extern void qla2x00_sp_free(srb_t *sp);
extern void qla2x00_sp_timeout(struct timer_list *);
extern void qla2x00_bsg_job_done(void *, int);
extern void qla2x00_bsg_sp_free(void *);
extern void qla2x00_bsg_job_done(srb_t *sp, int);
extern void qla2x00_bsg_sp_free(srb_t *sp);
extern void qla2x00_start_iocbs(struct scsi_qla_host *, struct req_que *);
/* Interrupt related */
+7 -14
View File
@@ -499,9 +499,8 @@ qla2x00_gnn_id(scsi_qla_host_t *vha, sw_info_t *list)
return (rval);
}
static void qla2x00_async_sns_sp_done(void *s, int rc)
static void qla2x00_async_sns_sp_done(srb_t *sp, int rc)
{
struct srb *sp = s;
struct scsi_qla_host *vha = sp->vha;
struct ct_sns_pkt *ct_sns;
struct qla_work_evt *e;
@@ -2989,9 +2988,8 @@ void qla24xx_handle_gpsc_event(scsi_qla_host_t *vha, struct event_arg *ea)
qla_post_iidma_work(vha, fcport);
}
static void qla24xx_async_gpsc_sp_done(void *s, int res)
static void qla24xx_async_gpsc_sp_done(srb_t *sp, int res)
{
struct srb *sp = s;
struct scsi_qla_host *vha = sp->vha;
struct qla_hw_data *ha = vha->hw;
fc_port_t *fcport = sp->fcport;
@@ -3247,9 +3245,8 @@ void qla24xx_handle_gpnid_event(scsi_qla_host_t *vha, struct event_arg *ea)
}
}
static void qla2x00_async_gpnid_sp_done(void *s, int res)
static void qla2x00_async_gpnid_sp_done(srb_t *sp, int res)
{
struct srb *sp = s;
struct scsi_qla_host *vha = sp->vha;
struct ct_sns_req *ct_req =
(struct ct_sns_req *)sp->u.iocb_cmd.u.ctarg.req;
@@ -3440,9 +3437,8 @@ void qla24xx_handle_gffid_event(scsi_qla_host_t *vha, struct event_arg *ea)
qla24xx_post_gnl_work(vha, fcport);
}
void qla24xx_async_gffid_sp_done(void *s, int res)
void qla24xx_async_gffid_sp_done(srb_t *sp, int res)
{
struct srb *sp = s;
struct scsi_qla_host *vha = sp->vha;
fc_port_t *fcport = sp->fcport;
struct ct_sns_rsp *ct_rsp;
@@ -3866,9 +3862,8 @@ static void qla2x00_find_free_fcp_nvme_slot(struct scsi_qla_host *vha,
}
}
static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res)
static void qla2x00_async_gpnft_gnnft_sp_done(srb_t *sp, int res)
{
struct srb *sp = s;
struct scsi_qla_host *vha = sp->vha;
struct ct_sns_req *ct_req =
(struct ct_sns_req *)sp->u.iocb_cmd.u.ctarg.req;
@@ -4245,9 +4240,8 @@ void qla24xx_handle_gnnid_event(scsi_qla_host_t *vha, struct event_arg *ea)
qla24xx_post_gnl_work(vha, ea->fcport);
}
static void qla2x00_async_gnnid_sp_done(void *s, int res)
static void qla2x00_async_gnnid_sp_done(srb_t *sp, int res)
{
struct srb *sp = s;
struct scsi_qla_host *vha = sp->vha;
fc_port_t *fcport = sp->fcport;
u8 *node_name = fcport->ct_desc.ct_sns->p.rsp.rsp.gnn_id.node_name;
@@ -4379,9 +4373,8 @@ void qla24xx_handle_gfpnid_event(scsi_qla_host_t *vha, struct event_arg *ea)
qla24xx_post_gpsc_work(vha, fcport);
}
static void qla2x00_async_gfpnid_sp_done(void *s, int res)
static void qla2x00_async_gfpnid_sp_done(srb_t *sp, int res)
{
struct srb *sp = s;
struct scsi_qla_host *vha = sp->vha;
fc_port_t *fcport = sp->fcport;
u8 *fpn = fcport->ct_desc.ct_sns->p.rsp.rsp.gfpn_id.port_name;
+10 -30
View File
@@ -62,10 +62,8 @@ qla2x00_sp_timeout(struct timer_list *t)
iocb->timeout(sp);
}
void
qla2x00_sp_free(void *ptr)
void qla2x00_sp_free(srb_t *sp)
{
srb_t *sp = ptr;
struct srb_iocb *iocb = &sp->u.iocb_cmd;
del_timer(&iocb->timer);
@@ -116,9 +114,8 @@ static void qla24xx_abort_iocb_timeout(void *data)
sp->done(sp, QLA_OS_TIMER_EXPIRED);
}
static void qla24xx_abort_sp_done(void *ptr, int res)
static void qla24xx_abort_sp_done(srb_t *sp, int res)
{
srb_t *sp = ptr;
struct srb_iocb *abt = &sp->u.iocb_cmd;
del_timer(&sp->u.iocb_cmd.timer);
@@ -246,10 +243,8 @@ qla2x00_async_iocb_timeout(void *data)
}
}
static void
qla2x00_async_login_sp_done(void *ptr, int res)
static void qla2x00_async_login_sp_done(srb_t *sp, int res)
{
srb_t *sp = ptr;
struct scsi_qla_host *vha = sp->vha;
struct srb_iocb *lio = &sp->u.iocb_cmd;
struct event_arg ea;
@@ -356,11 +351,8 @@ done:
return rval;
}
static void
qla2x00_async_logout_sp_done(void *ptr, int res)
static void qla2x00_async_logout_sp_done(srb_t *sp, int res)
{
srb_t *sp = ptr;
sp->fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE);
sp->fcport->login_gen++;
qlt_logo_completion_handler(sp->fcport, res);
@@ -420,10 +412,8 @@ qla2x00_async_prlo_done(struct scsi_qla_host *vha, fc_port_t *fcport,
qlt_logo_completion_handler(fcport, data[0]);
}
static void
qla2x00_async_prlo_sp_done(void *s, int res)
static void qla2x00_async_prlo_sp_done(srb_t *sp, int res)
{
srb_t *sp = (srb_t *)s;
struct srb_iocb *lio = &sp->u.iocb_cmd;
struct scsi_qla_host *vha = sp->vha;
@@ -526,10 +516,8 @@ static int qla_post_els_plogi_work(struct scsi_qla_host *vha, fc_port_t *fcport)
return qla2x00_post_work(vha, e);
}
static void
qla2x00_async_adisc_sp_done(void *ptr, int res)
static void qla2x00_async_adisc_sp_done(srb_t *sp, int res)
{
srb_t *sp = ptr;
struct scsi_qla_host *vha = sp->vha;
struct event_arg ea;
struct srb_iocb *lio = &sp->u.iocb_cmd;
@@ -934,10 +922,8 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha,
}
} /* gnl_event */
static void
qla24xx_async_gnl_sp_done(void *s, int res)
static void qla24xx_async_gnl_sp_done(srb_t *sp, int res)
{
struct srb *sp = s;
struct scsi_qla_host *vha = sp->vha;
unsigned long flags;
struct fc_port *fcport = NULL, *tf;
@@ -1123,10 +1109,8 @@ int qla24xx_post_gnl_work(struct scsi_qla_host *vha, fc_port_t *fcport)
return qla2x00_post_work(vha, e);
}
static
void qla24xx_async_gpdb_sp_done(void *s, int res)
static void qla24xx_async_gpdb_sp_done(srb_t *sp, int res)
{
struct srb *sp = s;
struct scsi_qla_host *vha = sp->vha;
struct qla_hw_data *ha = vha->hw;
fc_port_t *fcport = sp->fcport;
@@ -1170,10 +1154,8 @@ static int qla24xx_post_prli_work(struct scsi_qla_host *vha, fc_port_t *fcport)
return qla2x00_post_work(vha, e);
}
static void
qla2x00_async_prli_sp_done(void *ptr, int res)
static void qla2x00_async_prli_sp_done(srb_t *sp, int res)
{
srb_t *sp = ptr;
struct scsi_qla_host *vha = sp->vha;
struct srb_iocb *lio = &sp->u.iocb_cmd;
struct event_arg ea;
@@ -1809,10 +1791,8 @@ qla2x00_tmf_iocb_timeout(void *data)
complete(&tmf->u.tmf.comp);
}
static void
qla2x00_tmf_sp_done(void *ptr, int res)
static void qla2x00_tmf_sp_done(srb_t *sp, int res)
{
srb_t *sp = ptr;
struct srb_iocb *tmf = &sp->u.iocb_cmd;
complete(&tmf->u.tmf.comp);
+3 -9
View File
@@ -2550,10 +2550,8 @@ void qla2x00_init_timer(srb_t *sp, unsigned long tmo)
sp->start_timer = 1;
}
static void
qla2x00_els_dcmd_sp_free(void *data)
static void qla2x00_els_dcmd_sp_free(srb_t *sp)
{
srb_t *sp = data;
struct srb_iocb *elsio = &sp->u.iocb_cmd;
kfree(sp->fcport);
@@ -2583,10 +2581,8 @@ qla2x00_els_dcmd_iocb_timeout(void *data)
complete(&lio->u.els_logo.comp);
}
static void
qla2x00_els_dcmd_sp_done(void *ptr, int res)
static void qla2x00_els_dcmd_sp_done(srb_t *sp, int res)
{
srb_t *sp = ptr;
fc_port_t *fcport = sp->fcport;
struct srb_iocb *lio = &sp->u.iocb_cmd;
struct scsi_qla_host *vha = sp->vha;
@@ -2779,10 +2775,8 @@ void qla2x00_els_dcmd2_free(scsi_qla_host_t *vha, struct els_plogi *els_plogi)
els_plogi->els_resp_pyld_dma);
}
static void
qla2x00_els_dcmd2_sp_done(void *ptr, int res)
static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res)
{
srb_t *sp = ptr;
fc_port_t *fcport = sp->fcport;
struct srb_iocb *lio = &sp->u.iocb_cmd;
struct scsi_qla_host *vha = sp->vha;
+1 -3
View File
@@ -6214,10 +6214,8 @@ qla26xx_dport_diagnostics(scsi_qla_host_t *vha,
return rval;
}
static void qla2x00_async_mb_sp_done(void *s, int res)
static void qla2x00_async_mb_sp_done(srb_t *sp, int res)
{
struct srb *sp = s;
sp->u.iocb_cmd.u.mbx.rc = res;
complete(&sp->u.iocb_cmd.u.mbx.comp);
+1 -3
View File
@@ -901,10 +901,8 @@ failed:
return 0;
}
static void qla_ctrlvp_sp_done(void *s, int res)
static void qla_ctrlvp_sp_done(srb_t *sp, int res)
{
struct srb *sp = s;
if (sp->comp)
complete(sp->comp);
/* don't free sp here. Let the caller do the free */
+1 -3
View File
@@ -1797,10 +1797,8 @@ qla2x00_fxdisc_iocb_timeout(void *data)
complete(&lio->u.fxiocb.fxiocb_comp);
}
static void
qla2x00_fxdisc_sp_done(void *ptr, int res)
static void qla2x00_fxdisc_sp_done(srb_t *sp, int res)
{
srb_t *sp = ptr;
struct srb_iocb *lio = &sp->u.iocb_cmd;
complete(&lio->u.fxiocb.fxiocb_comp);
+4 -7
View File
@@ -191,10 +191,9 @@ static void qla_nvme_ls_complete(struct work_struct *work)
kref_put(&priv->sp->cmd_kref, qla_nvme_release_ls_cmd_kref);
}
static void qla_nvme_sp_ls_done(void *ptr, int res)
static void qla_nvme_sp_ls_done(srb_t *sp, int res)
{
srb_t *sp = ptr;
struct nvme_private *priv;
struct nvme_private *priv = sp->priv;
if (WARN_ON_ONCE(kref_read(&sp->cmd_kref) == 0))
return;
@@ -202,17 +201,15 @@ static void qla_nvme_sp_ls_done(void *ptr, int res)
if (res)
res = -EINVAL;
priv = (struct nvme_private *)sp->priv;
priv->comp_status = res;
INIT_WORK(&priv->ls_work, qla_nvme_ls_complete);
schedule_work(&priv->ls_work);
}
/* it assumed that QPair lock is held. */
static void qla_nvme_sp_done(void *ptr, int res)
static void qla_nvme_sp_done(srb_t *sp, int res)
{
srb_t *sp = ptr;
struct nvme_private *priv = (struct nvme_private *)sp->priv;
struct nvme_private *priv = sp->priv;
priv->comp_status = res;
kref_put(&sp->cmd_kref, qla_nvme_release_fcp_cmd_kref);
+1 -2
View File
@@ -164,6 +164,5 @@ static inline void qla_nvme_delete(struct scsi_qla_host *vha)
void qla24xx_nvme_ls4_iocb(struct scsi_qla_host *, struct pt_ls4_request *,
struct req_que *);
void qla24xx_async_gffid_sp_done(void *, int);
void qla24xx_async_gffid_sp_done(struct srb *sp, int);
#endif
+4 -12
View File
@@ -672,10 +672,8 @@ qla24xx_fw_version_str(struct scsi_qla_host *vha, char *str, size_t size)
return str;
}
void
qla2x00_sp_free_dma(void *ptr)
void qla2x00_sp_free_dma(srb_t *sp)
{
srb_t *sp = ptr;
struct qla_hw_data *ha = sp->vha->hw;
struct scsi_cmnd *cmd = GET_CMD_SP(sp);
void *ctx = GET_CMD_CTX_SP(sp);
@@ -719,10 +717,8 @@ qla2x00_sp_free_dma(void *ptr)
}
}
void
qla2x00_sp_compl(void *ptr, int res)
void qla2x00_sp_compl(srb_t *sp, int res)
{
srb_t *sp = ptr;
struct scsi_cmnd *cmd = GET_CMD_SP(sp);
struct completion *comp = sp->comp;
@@ -740,10 +736,8 @@ qla2x00_sp_compl(void *ptr, int res)
qla2x00_rel_sp(sp);
}
void
qla2xxx_qpair_sp_free_dma(void *ptr)
void qla2xxx_qpair_sp_free_dma(srb_t *sp)
{
srb_t *sp = (srb_t *)ptr;
struct scsi_cmnd *cmd = GET_CMD_SP(sp);
struct qla_hw_data *ha = sp->fcport->vha->hw;
void *ctx = GET_CMD_CTX_SP(sp);
@@ -824,10 +818,8 @@ qla2xxx_qpair_sp_free_dma(void *ptr)
}
}
void
qla2xxx_qpair_sp_compl(void *ptr, int res)
void qla2xxx_qpair_sp_compl(srb_t *sp, int res)
{
srb_t *sp = ptr;
struct scsi_cmnd *cmd = GET_CMD_SP(sp);
struct completion *comp = sp->comp;
+1 -3
View File
@@ -572,10 +572,8 @@ static int qla24xx_post_nack_work(struct scsi_qla_host *vha, fc_port_t *fcport,
return qla2x00_post_work(vha, e);
}
static
void qla2x00_async_nack_sp_done(void *s, int res)
static void qla2x00_async_nack_sp_done(srb_t *sp, int res)
{
struct srb *sp = (struct srb *)s;
struct scsi_qla_host *vha = sp->vha;
unsigned long flags;