From fb6f7c8d8a19e5543d5b4d44c58e2c4e5a82bb12 Mon Sep 17 00:00:00 2001 From: Johannes Thumshirn Date: Thu, 17 Nov 2016 10:31:23 +0100 Subject: 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 Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen --- block/bsg-lib.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'block') 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); -- cgit v1.2.3