summaryrefslogtreecommitdiff
path: root/drivers/scsi/scsi_transport_fc.c
diff options
context:
space:
mode:
authorJohannes Thumshirn <jthumshirn@suse.de>2016-11-17 10:31:13 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2016-11-17 20:15:25 -0500
commit1abaede71560fa98b97d8e6b172a14e6383f633d (patch)
tree8de47872faf9e26b8a16cbcfea6de5c6e207c724 /drivers/scsi/scsi_transport_fc.c
parent01e0e15c8b3b32e006e5cccac10c8b377ac3d803 (diff)
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>
Diffstat (limited to 'drivers/scsi/scsi_transport_fc.c')
-rw-r--r--drivers/scsi/scsi_transport_fc.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index b23f05f765f5..9f20b05f0023 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -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;
}