scsi: fc: Export fc_bsg_jobdone and use it in FC drivers
authorJohannes Thumshirn <jthumshirn@suse.de>
Thu, 17 Nov 2016 09:31:13 +0000 (10:31 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 18 Nov 2016 01:15:25 +0000 (20:15 -0500)
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>
drivers/s390/scsi/zfcp_fc.c
drivers/scsi/bfa/bfad_bsg.c
drivers/scsi/ibmvscsi/ibmvfc.c
drivers/scsi/libfc/fc_lport.c
drivers/scsi/lpfc/lpfc_bsg.c
drivers/scsi/qla2xxx/qla_bsg.c
drivers/scsi/scsi_transport_fc.c
include/scsi/scsi_transport_fc.h

index 4c4023fc6ad84593ecb1f617f7eb821da7c0db08..87f6330df300688eb28219a1b3f5b5d3fbf3d3c7 100644 (file)
@@ -892,7 +892,7 @@ static void zfcp_fc_ct_els_job_handler(void *data)
        jr->reply_payload_rcv_len = job->reply_payload.payload_len;
        jr->reply_data.ctels_reply.status = FC_CTELS_STATUS_OK;
        jr->result = zfcp_ct_els->status ? -EIO : 0;
-       job->job_done(job);
+       fc_bsg_jobdone(job, jr->result, jr->reply_payload_rcv_len);
 }
 
 static struct zfcp_fc_wka_port *zfcp_fc_job_wka_port(struct fc_bsg_job *job)
index 48366d8ad0d901b3b670a2ed9d924bc626dc0548..e49a6c813ca9c3fb440ea69166fadcb92e5cbe66 100644 (file)
@@ -3180,7 +3180,8 @@ bfad_im_bsg_vendor_request(struct fc_bsg_job *job)
        bsg_reply->reply_payload_rcv_len = job->reply_payload.payload_len;
        bsg_reply->result = rc;
 
-       job->job_done(job);
+       fc_bsg_jobdone(job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
        return rc;
 error:
        /* free the command buffer */
@@ -3556,7 +3557,8 @@ out:
        bsg_reply->result = rc;
 
        if (rc == BFA_STATUS_OK)
-               job->job_done(job);
+               fc_bsg_jobdone(job, bsg_reply->result,
+                              bsg_reply->reply_payload_rcv_len);
 
        return rc;
 }
index 7c17a7e73eb9da2edeeae1c9cc1dea87ea18fd5a..607036174a99b58745f2ea29a55fe4745222797d 100644 (file)
@@ -1945,7 +1945,8 @@ static int ibmvfc_bsg_request(struct fc_bsg_job *job)
        ibmvfc_free_event(evt);
        spin_unlock_irqrestore(vhost->host->host_lock, flags);
        bsg_reply->result = rc;
-       job->job_done(job);
+       fc_bsg_jobdone(job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
        rc = 0;
 out:
        dma_unmap_sg(vhost->dev, job->request_payload.sg_list,
index 2de6093b3c04f590ffa436e7afe3f3a5f7a1365d..8ea6e9322ad1fc1cfeb44dda807685d5c0bcd7fd 100644 (file)
@@ -1913,7 +1913,8 @@ static void fc_lport_bsg_resp(struct fc_seq *sp, struct fc_frame *fp,
                        -ECONNABORTED : -ETIMEDOUT;
                job->reply_len = sizeof(uint32_t);
                job->state_flags |= FC_RQST_STATE_DONE;
-               job->job_done(job);
+               fc_bsg_jobdone(job, bsg_reply->result,
+                              bsg_reply->reply_payload_rcv_len);
                kfree(info);
                return;
        }
@@ -1948,7 +1949,8 @@ static void fc_lport_bsg_resp(struct fc_seq *sp, struct fc_frame *fp,
                                job->reply_payload.payload_len;
                bsg_reply->result = 0;
                job->state_flags |= FC_RQST_STATE_DONE;
-               job->job_done(job);
+               fc_bsg_jobdone(job, bsg_reply->result,
+                              bsg_reply->reply_payload_rcv_len);
                kfree(info);
        }
        fc_frame_free(fp);
index f09a32501f698dabe38c4fdac37d71833309d2d8..46f0b8ff1e00b94d818616ccf2d566f1e2bb5584 100644 (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;
 }
 
index 40f7c1081e8d9b9b41b8ef3b95d66a1349178c1f..9293d5a279f7ff9f6383480efd2f5bcb57ccecaa 100644 (file)
@@ -20,7 +20,8 @@ qla2x00_bsg_job_done(void *data, void *ptr, int res)
        struct fc_bsg_reply *bsg_reply = bsg_job->reply;
 
        bsg_reply->result = res;
-       bsg_job->job_done(bsg_job);
+       fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
        sp->free(vha, sp);
 }
 
@@ -242,7 +243,8 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job)
        }
 exit_fcp_prio_cfg:
        if (!ret)
-               bsg_job->job_done(bsg_job);
+               fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                              bsg_reply->reply_payload_rcv_len);
        return ret;
 }
 
@@ -939,7 +941,8 @@ done_unmap_req_sg:
            bsg_job->request_payload.sg_list,
            bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
        if (!rval)
-               bsg_job->job_done(bsg_job);
+               fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                              bsg_reply->reply_payload_rcv_len);
        return rval;
 }
 
@@ -972,7 +975,8 @@ qla84xx_reset(struct fc_bsg_job *bsg_job)
                ql_dbg(ql_dbg_user, vha, 0x7031,
                    "Vendor request 84xx reset completed.\n");
                bsg_reply->result = DID_OK;
-               bsg_job->job_done(bsg_job);
+               fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                              bsg_reply->reply_payload_rcv_len);
        }
 
        return rval;
@@ -1085,7 +1089,8 @@ done_unmap_sg:
                bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
 
        if (!rval)
-               bsg_job->job_done(bsg_job);
+               fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                              bsg_reply->reply_payload_rcv_len);
        return rval;
 }
 
@@ -1282,7 +1287,8 @@ exit_mgmt:
        dma_pool_free(ha->s_dma_pool, mn, mn_dma);
 
        if (!rval)
-               bsg_job->job_done(bsg_job);
+               fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                              bsg_reply->reply_payload_rcv_len);
        return rval;
 }
 
@@ -1368,7 +1374,8 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job)
                }
 
                bsg_reply->result = DID_OK;
-               bsg_job->job_done(bsg_job);
+               fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                              bsg_reply->reply_payload_rcv_len);
        }
 
        return rval;
@@ -1476,7 +1483,8 @@ qla2x00_read_optrom(struct fc_bsg_job *bsg_job)
        ha->optrom_buffer = NULL;
        ha->optrom_state = QLA_SWAITING;
        mutex_unlock(&ha->optrom_mutex);
-       bsg_job->job_done(bsg_job);
+       fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
        return rval;
 }
 
@@ -1511,7 +1519,8 @@ qla2x00_update_optrom(struct fc_bsg_job *bsg_job)
        ha->optrom_buffer = NULL;
        ha->optrom_state = QLA_SWAITING;
        mutex_unlock(&ha->optrom_mutex);
-       bsg_job->job_done(bsg_job);
+       fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
        return rval;
 }
 
@@ -1561,7 +1570,8 @@ dealloc:
 done:
        bsg_job->reply_len = sizeof(struct fc_bsg_reply);
        bsg_reply->result = DID_OK << 16;
-       bsg_job->job_done(bsg_job);
+       fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
 
        return 0;
 }
@@ -1610,7 +1620,8 @@ done:
        bsg_job->reply_len = sizeof(struct fc_bsg_reply);
        bsg_reply->reply_payload_rcv_len = sizeof(*sr);
        bsg_reply->result = DID_OK << 16;
-       bsg_job->job_done(bsg_job);
+       fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
 
        return 0;
 }
@@ -1655,7 +1666,8 @@ dealloc:
 done:
        bsg_job->reply_len = sizeof(struct fc_bsg_reply);
        bsg_reply->result = DID_OK << 16;
-       bsg_job->job_done(bsg_job);
+       fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
 
        return 0;
 }
@@ -1699,7 +1711,8 @@ dealloc:
 done:
        bsg_job->reply_len = sizeof(struct fc_bsg_reply);
        bsg_reply->result = DID_OK << 16;
-       bsg_job->job_done(bsg_job);
+       fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
 
        return 0;
 }
@@ -1747,7 +1760,8 @@ done:
        bsg_job->reply_len = sizeof(struct fc_bsg_reply);
        bsg_reply->reply_payload_rcv_len = sizeof(*i2c);
        bsg_reply->result = DID_OK << 16;
-       bsg_job->job_done(bsg_job);
+       fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
 
        return 0;
 }
@@ -1925,7 +1939,8 @@ done:
        bsg_job->reply_len = sizeof(struct fc_bsg_reply);
        bsg_reply->reply_payload_rcv_len = 0;
        bsg_reply->result = (DID_OK) << 16;
-       bsg_job->job_done(bsg_job);
+       fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
        /* Always return success, vendor rsp carries correct status */
        return 0;
 }
@@ -2090,7 +2105,8 @@ qla26xx_serdes_op(struct fc_bsg_job *bsg_job)
 
        bsg_job->reply_len = sizeof(struct fc_bsg_reply);
        bsg_reply->result = DID_OK << 16;
-       bsg_job->job_done(bsg_job);
+       fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
        return 0;
 }
 
@@ -2131,7 +2147,8 @@ qla8044_serdes_op(struct fc_bsg_job *bsg_job)
 
        bsg_job->reply_len = sizeof(struct fc_bsg_reply);
        bsg_reply->result = DID_OK << 16;
-       bsg_job->job_done(bsg_job);
+       fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
        return 0;
 }
 
@@ -2162,7 +2179,8 @@ qla27xx_get_flash_upd_cap(struct fc_bsg_job *bsg_job)
 
        bsg_job->reply_len = sizeof(struct fc_bsg_reply);
        bsg_reply->result = DID_OK << 16;
-       bsg_job->job_done(bsg_job);
+       fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
        return 0;
 }
 
@@ -2207,7 +2225,8 @@ qla27xx_set_flash_upd_cap(struct fc_bsg_job *bsg_job)
 
        bsg_job->reply_len = sizeof(struct fc_bsg_reply);
        bsg_reply->result = DID_OK << 16;
-       bsg_job->job_done(bsg_job);
+       fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
        return 0;
 }
 
@@ -2265,7 +2284,8 @@ done:
 
        bsg_job->reply_len = sizeof(struct fc_bsg_reply);
        bsg_reply->result = DID_OK << 16;
-       bsg_job->job_done(bsg_job);
+       fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
        return 0;
 }
 
@@ -2321,7 +2341,8 @@ qla2x00_get_priv_stats(struct fc_bsg_job *bsg_job)
 
        bsg_job->reply_len = sizeof(*bsg_reply);
        bsg_reply->result = DID_OK << 16;
-       bsg_job->job_done(bsg_job);
+       fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
 
        dma_free_coherent(&ha->pdev->dev, sizeof(*stats),
                stats, stats_dma);
@@ -2364,7 +2385,8 @@ qla2x00_do_dport_diagnostics(struct fc_bsg_job *bsg_job)
 
        bsg_job->reply_len = sizeof(*bsg_reply);
        bsg_reply->result = DID_OK << 16;
-       bsg_job->job_done(bsg_job);
+       fc_bsg_jobdone(bsg_job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
 
        kfree(dd);
 
index b23f05f765f52098c53c48573ecf10ee207faaed..9f20b05f00237901ccb803204ab7bfa8ccc913be 100644 (file)
@@ -3582,16 +3582,17 @@ fc_destroy_bsgjob(struct fc_bsg_job *job)
  * fc_bsg_jobdone - completion routine for bsg requests that the LLD has
  *                  completed
  * @job:       fc_bsg_job that is complete
+ * @result:    job reply result
+ * @reply_payload_rcv_len: length of payload received
  */
-static void
-fc_bsg_jobdone(struct fc_bsg_job *job)
+void fc_bsg_jobdone(struct fc_bsg_job *job, int result,
+                   unsigned int reply_payload_rcv_len)
 {
        struct request *req = job->req;
        struct request *rsp = req->next_rq;
-       struct fc_bsg_reply *bsg_reply = job->reply;
        int err;
 
-       err = job->req->errors = bsg_reply->result;
+       err = job->req->errors = result;
 
        if (err < 0)
                /* we're only returning the result field in the reply */
@@ -3603,14 +3604,14 @@ fc_bsg_jobdone(struct fc_bsg_job *job)
        req->resid_len = 0;
 
        if (rsp) {
-               WARN_ON(bsg_reply->reply_payload_rcv_len > rsp->resid_len);
+               WARN_ON(reply_payload_rcv_len > rsp->resid_len);
 
                /* set reply (bidi) residual */
-               rsp->resid_len -= min(bsg_reply->reply_payload_rcv_len,
-                                     rsp->resid_len);
+               rsp->resid_len -= min(reply_payload_rcv_len, rsp->resid_len);
        }
        blk_complete_request(req);
 }
+EXPORT_SYMBOL_GPL(fc_bsg_jobdone);
 
 /**
  * fc_bsg_softirq_done - softirq done routine for destroying the bsg requests
@@ -3742,7 +3743,6 @@ fc_req_to_bsgjob(struct Scsi_Host *shost, struct fc_rport *rport,
                if (ret)
                        goto failjob_rls_rqst_payload;
        }
-       job->job_done = fc_bsg_jobdone;
        if (rport)
                job->dev = &rport->dev;
        else
@@ -3846,7 +3846,8 @@ fail_host_msg:
        bsg_reply->reply_payload_rcv_len = 0;
        bsg_reply->result = ret;
        job->reply_len = sizeof(uint32_t);
-       fc_bsg_jobdone(job);
+       fc_bsg_jobdone(job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
        return FC_DISPATCH_UNLOCKED;
 }
 
@@ -3923,7 +3924,8 @@ fail_rport_msg:
        bsg_reply->reply_payload_rcv_len = 0;
        bsg_reply->result = ret;
        job->reply_len = sizeof(uint32_t);
-       fc_bsg_jobdone(job);
+       fc_bsg_jobdone(job, bsg_reply->result,
+                      bsg_reply->reply_payload_rcv_len);
        return FC_DISPATCH_UNLOCKED;
 }
 
@@ -3983,7 +3985,8 @@ fc_bsg_request_handler(struct request_queue *q, struct Scsi_Host *shost,
                        bsg_reply->reply_payload_rcv_len = 0;
                        bsg_reply->result = -ENOMSG;
                        job->reply_len = sizeof(uint32_t);
-                       fc_bsg_jobdone(job);
+                       fc_bsg_jobdone(job, bsg_reply->result,
+                                      bsg_reply->reply_payload_rcv_len);
                        spin_lock_irq(q->queue_lock);
                        continue;
                }
index 921b097f039b9d60312b14c66697b98eac372302..eca8ed787b8ab5dd6d95d7a911b004043e89297c 100644 (file)
@@ -637,7 +637,6 @@ struct fc_bsg_job {
        spinlock_t job_lock;
        unsigned int state_flags;
        unsigned int ref_cnt;
-       void (*job_done)(struct fc_bsg_job *);
 
        struct fc_bsg_request *request;
        struct fc_bsg_reply *reply;
@@ -842,5 +841,7 @@ struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel,
                struct fc_vport_identifiers *);
 int fc_vport_terminate(struct fc_vport *vport);
 int fc_block_scsi_eh(struct scsi_cmnd *cmnd);
+void fc_bsg_jobdone(struct fc_bsg_job *job, int result,
+                   unsigned int reply_payload_rcv_len);
 
 #endif /* SCSI_TRANSPORT_FC_H */