23 #include <linux/slab.h>
28 #include <linux/export.h>
35 static void bsg_destroy_job(
struct bsg_job *job)
53 unsigned int reply_payload_rcv_len)
62 job->
req->sense_len =
sizeof(
u32);
69 WARN_ON(reply_payload_rcv_len > rsp->resid_len);
72 rsp->resid_len -=
min(reply_payload_rcv_len, rsp->resid_len);
82 static void bsg_softirq_done(
struct request *
rq)
84 struct bsg_job *job = rq->special;
92 size_t sz = (
sizeof(
struct scatterlist) * req->nr_phys_segments);
94 BUG_ON(!req->nr_phys_segments);
126 job->
dd_data = (
void *)&job[1];
129 job->
reply = req->sense;
135 goto failjob_rls_job;
137 if (rsp && rsp->bio) {
140 goto failjob_rls_rqst_payload;
147 failjob_rls_rqst_payload:
178 struct device *dev = q->queuedata;
190 spin_unlock_irq(q->queue_lock);
192 ret = bsg_create_job(dev, req);
196 spin_lock_irq(q->queue_lock);
201 ret = q->bsg_job_fn(job);
202 spin_lock_irq(q->queue_lock);
207 spin_unlock_irq(q->queue_lock);
209 spin_lock_irq(q->queue_lock);
225 char *
name, bsg_job_fn *job_fn,
int dd_job_size)
230 q->bsg_job_size = dd_job_size;
231 q->bsg_job_fn = job_fn;
232 queue_flag_set_unlocked(QUEUE_FLAG_BIDI, q);
239 "initialize - register queue\n", dev->
kobj.name);