summaryrefslogtreecommitdiffstats
path: root/block/bsg-lib.c
diff options
context:
space:
mode:
authorJohannes Thumshirn <jthumshirn@suse.de>2016-11-17 10:31:23 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2016-11-18 02:15:26 +0100
commitfb6f7c8d8a19e5543d5b4d44c58e2c4e5a82bb12 (patch)
tree7c7626dfd808b37d35d06c31c603f434ee252782 /block/bsg-lib.c
parentscsi: fc: use bsg_job_done (diff)
downloadlinux-fb6f7c8d8a19e5543d5b4d44c58e2c4e5a82bb12.tar.xz
linux-fb6f7c8d8a19e5543d5b4d44c58e2c4e5a82bb12.zip
block: add bsg_job_put() and bsg_job_get()
Add bsg_job_put() and bsg_job_get() so don't need to export bsg_destroy_job() any more. Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'block/bsg-lib.c')
-rw-r--r--block/bsg-lib.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/block/bsg-lib.c b/block/bsg-lib.c
index 6661f823db4c..803ec40ebd6d 100644
--- a/block/bsg-lib.c
+++ b/block/bsg-lib.c
@@ -32,7 +32,7 @@
* bsg_destroy_job - routine to teardown/delete a bsg job
* @job: bsg_job that is to be torn down
*/
-void bsg_destroy_job(struct kref *kref)
+static void bsg_destroy_job(struct kref *kref)
{
struct bsg_job *job = container_of(kref, struct bsg_job, kref);
struct request *rq = job->req;
@@ -45,7 +45,18 @@ void bsg_destroy_job(struct kref *kref)
kfree(job->reply_payload.sg_list);
kfree(job);
}
-EXPORT_SYMBOL_GPL(bsg_destroy_job);
+
+void bsg_job_put(struct bsg_job *job)
+{
+ kref_put(&job->kref, bsg_destroy_job);
+}
+EXPORT_SYMBOL_GPL(bsg_job_put);
+
+int bsg_job_get(struct bsg_job *job)
+{
+ return kref_get_unless_zero(&job->kref);
+}
+EXPORT_SYMBOL_GPL(bsg_job_get);
/**
* bsg_job_done - completion routine for bsg requests
@@ -89,7 +100,7 @@ void bsg_softirq_done(struct request *rq)
{
struct bsg_job *job = rq->special;
- kref_put(&job->kref, bsg_destroy_job);
+ bsg_job_put(job);
}
EXPORT_SYMBOL_GPL(bsg_softirq_done);