diff options
-rw-r--r-- | drivers/scsi/scsi_lib.c | 49 | ||||
-rw-r--r-- | include/scsi/scsi_request.h | 3 |
2 files changed, 0 insertions, 52 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index e40c8b66da40..4afef5cdcb17 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -254,55 +254,6 @@ void scsi_do_req(struct scsi_request *sreq, const void *cmnd, | |||
254 | } | 254 | } |
255 | EXPORT_SYMBOL(scsi_do_req); | 255 | EXPORT_SYMBOL(scsi_do_req); |
256 | 256 | ||
257 | /* This is the end routine we get to if a command was never attached | ||
258 | * to the request. Simply complete the request without changing | ||
259 | * rq_status; this will cause a DRIVER_ERROR. */ | ||
260 | static void scsi_wait_req_end_io(struct request *req) | ||
261 | { | ||
262 | BUG_ON(!req->waiting); | ||
263 | |||
264 | complete(req->waiting); | ||
265 | } | ||
266 | |||
267 | void scsi_wait_req(struct scsi_request *sreq, const void *cmnd, void *buffer, | ||
268 | unsigned bufflen, int timeout, int retries) | ||
269 | { | ||
270 | DECLARE_COMPLETION(wait); | ||
271 | int write = (sreq->sr_data_direction == DMA_TO_DEVICE); | ||
272 | struct request *req; | ||
273 | |||
274 | req = blk_get_request(sreq->sr_device->request_queue, write, | ||
275 | __GFP_WAIT); | ||
276 | if (bufflen && blk_rq_map_kern(sreq->sr_device->request_queue, req, | ||
277 | buffer, bufflen, __GFP_WAIT)) { | ||
278 | sreq->sr_result = DRIVER_ERROR << 24; | ||
279 | blk_put_request(req); | ||
280 | return; | ||
281 | } | ||
282 | |||
283 | req->flags |= REQ_NOMERGE; | ||
284 | req->waiting = &wait; | ||
285 | req->end_io = scsi_wait_req_end_io; | ||
286 | req->cmd_len = COMMAND_SIZE(((u8 *)cmnd)[0]); | ||
287 | req->sense = sreq->sr_sense_buffer; | ||
288 | req->sense_len = 0; | ||
289 | memcpy(req->cmd, cmnd, req->cmd_len); | ||
290 | req->timeout = timeout; | ||
291 | req->flags |= REQ_BLOCK_PC; | ||
292 | req->rq_disk = NULL; | ||
293 | blk_insert_request(sreq->sr_device->request_queue, req, | ||
294 | sreq->sr_data_direction == DMA_TO_DEVICE, NULL); | ||
295 | wait_for_completion(&wait); | ||
296 | sreq->sr_request->waiting = NULL; | ||
297 | sreq->sr_result = req->errors; | ||
298 | if (req->errors) | ||
299 | sreq->sr_result |= (DRIVER_ERROR << 24); | ||
300 | |||
301 | blk_put_request(req); | ||
302 | } | ||
303 | |||
304 | EXPORT_SYMBOL(scsi_wait_req); | ||
305 | |||
306 | /** | 257 | /** |
307 | * scsi_execute - insert request and wait for the result | 258 | * scsi_execute - insert request and wait for the result |
308 | * @sdev: scsi device | 259 | * @sdev: scsi device |
diff --git a/include/scsi/scsi_request.h b/include/scsi/scsi_request.h index 2539debb7993..98d69fdb851c 100644 --- a/include/scsi/scsi_request.h +++ b/include/scsi/scsi_request.h | |||
@@ -47,9 +47,6 @@ struct scsi_request { | |||
47 | 47 | ||
48 | extern struct scsi_request *scsi_allocate_request(struct scsi_device *, gfp_t); | 48 | extern struct scsi_request *scsi_allocate_request(struct scsi_device *, gfp_t); |
49 | extern void scsi_release_request(struct scsi_request *); | 49 | extern void scsi_release_request(struct scsi_request *); |
50 | extern void scsi_wait_req(struct scsi_request *, const void *cmnd, | ||
51 | void *buffer, unsigned bufflen, | ||
52 | int timeout, int retries); | ||
53 | extern void scsi_do_req(struct scsi_request *, const void *cmnd, | 50 | extern void scsi_do_req(struct scsi_request *, const void *cmnd, |
54 | void *buffer, unsigned bufflen, | 51 | void *buffer, unsigned bufflen, |
55 | void (*done) (struct scsi_cmnd *), | 52 | void (*done) (struct scsi_cmnd *), |