scsi: fc: Export fc_bsg_jobdone and use it in FC drivers

Export fc_bsg_jobdone so drivers can use it directly instead of doing
the round-trip via struct fc_bsg_job::job_done() and use it in the
LLDDs.  That way we can also unify the interfaces of fc_bsg_jobdone and
bsg_job_done.

As we've converted all LLDDs over to use fc_bsg_jobdone() directly, we
can remove the function pointer from struct fc_bsg_job as well.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Johannes Thumshirn
2016-11-17 10:31:13 +01:00
committed by Martin K. Petersen
parent 01e0e15c8b
commit 1abaede715
8 changed files with 119 additions and 63 deletions

View File

@@ -371,7 +371,8 @@ lpfc_bsg_send_mgmt_cmd_cmp(struct lpfc_hba *phba,
if (job) {
bsg_reply->result = rc;
job->job_done(job);
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
}
return;
}
@@ -644,7 +645,8 @@ lpfc_bsg_rport_els_cmp(struct lpfc_hba *phba,
if (job) {
bsg_reply->result = rc;
job->job_done(job);
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
}
return;
}
@@ -1136,7 +1138,8 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
job->dd_data = NULL;
/* complete the job back to userspace */
spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
job->job_done(job);
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
spin_lock_irqsave(&phba->ct_ev_lock, flags);
}
}
@@ -1361,7 +1364,8 @@ lpfc_bsg_hba_get_event(struct fc_bsg_job *job)
spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
job->dd_data = NULL;
bsg_reply->result = 0;
job->job_done(job);
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
return 0;
job_error:
@@ -1458,7 +1462,8 @@ lpfc_issue_ct_rsp_cmp(struct lpfc_hba *phba,
if (job) {
bsg_reply->result = rc;
job->job_done(job);
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
}
return;
}
@@ -1886,7 +1891,8 @@ job_error:
bsg_reply->result = rc;
/* complete the job back to userspace if no error */
if (rc == 0)
job->job_done(job);
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
return rc;
}
@@ -2175,7 +2181,8 @@ job_error:
bsg_reply->result = rc;
/* complete the job back to userspace if no error */
if (rc == 0)
job->job_done(job);
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
return rc;
}
@@ -2289,7 +2296,8 @@ loopback_mode_end_exit:
bsg_reply->result = rc;
/* complete the job back to userspace if no error */
if (rc == 0)
job->job_done(job);
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
return rc;
}
@@ -2441,7 +2449,8 @@ job_error:
bsg_reply->result = rc;
/* complete the job back to userspace if no error */
if (rc == 0)
job->job_done(job);
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
return rc;
}
@@ -3301,7 +3310,8 @@ loopback_test_exit:
job->dd_data = NULL;
/* complete the job back to userspace if no error */
if (rc == IOCB_SUCCESS)
job->job_done(job);
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
return rc;
}
@@ -3344,7 +3354,8 @@ lpfc_bsg_get_dfc_rev(struct fc_bsg_job *job)
job_error:
bsg_reply->result = rc;
if (rc == 0)
job->job_done(job);
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
return rc;
}
@@ -3409,7 +3420,8 @@ lpfc_bsg_issue_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
if (job) {
bsg_reply->result = 0;
job->job_done(job);
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
}
return;
}
@@ -3635,6 +3647,7 @@ static void
lpfc_bsg_issue_read_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
{
struct fc_bsg_job *job;
struct fc_bsg_reply *bsg_reply;
job = lpfc_bsg_issue_mbox_ext_handle_job(phba, pmboxq);
@@ -3654,9 +3667,11 @@ lpfc_bsg_issue_read_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
mempool_free(pmboxq, phba->mbox_mem_pool);
/* if the job is still active, call job done */
if (job)
job->job_done(job);
if (job) {
bsg_reply = job->reply;
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
}
return;
}
@@ -3672,6 +3687,7 @@ static void
lpfc_bsg_issue_write_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
{
struct fc_bsg_job *job;
struct fc_bsg_reply *bsg_reply;
job = lpfc_bsg_issue_mbox_ext_handle_job(phba, pmboxq);
@@ -3689,8 +3705,11 @@ lpfc_bsg_issue_write_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
lpfc_bsg_mbox_ext_session_reset(phba);
/* if the job is still active, call job done */
if (job)
job->job_done(job);
if (job) {
bsg_reply = job->reply;
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
}
return;
}
@@ -4131,7 +4150,8 @@ lpfc_bsg_sli_cfg_write_cmd_ext(struct lpfc_hba *phba, struct fc_bsg_job *job,
/* wait for additoinal external buffers */
bsg_reply->result = 0;
job->job_done(job);
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
return SLI_CONFIG_HANDLED;
job_error:
@@ -4357,7 +4377,8 @@ lpfc_bsg_read_ebuf_get(struct lpfc_hba *phba, struct fc_bsg_job *job)
}
bsg_reply->result = 0;
job->job_done(job);
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
return SLI_CONFIG_HANDLED;
}
@@ -4473,7 +4494,8 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct fc_bsg_job *job,
/* wait for additoinal external buffers */
bsg_reply->result = 0;
job->job_done(job);
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
return SLI_CONFIG_HANDLED;
job_error:
@@ -4941,7 +4963,8 @@ lpfc_bsg_mbox_cmd(struct fc_bsg_job *job)
/* job done */
bsg_reply->result = 0;
job->dd_data = NULL;
job->job_done(job);
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
} else if (rc == 1)
/* job submitted, will complete later*/
rc = 0; /* return zero, no error */
@@ -5051,7 +5074,8 @@ lpfc_bsg_menlo_cmd_cmp(struct lpfc_hba *phba,
if (job) {
bsg_reply->result = rc;
job->job_done(job);
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
}
return;
@@ -5269,7 +5293,8 @@ lpfc_forced_link_speed(struct fc_bsg_job *job)
job_error:
bsg_reply->result = rc;
if (rc == 0)
job->job_done(job);
fc_bsg_jobdone(job, bsg_reply->result,
bsg_reply->reply_payload_rcv_len);
return rc;
}