aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-atapi.c
diff options
context:
space:
mode:
authorBorislav Petkov <petkovbb@googlemail.com>2009-04-18 18:00:42 -0400
committerTejun Heo <tj@kernel.org>2009-04-18 18:00:42 -0400
commit6b544fcc8cd0a04eb42de9d1ecdd345e979d6ada (patch)
treef7c4d669de2c6ca01eecb97daf04dcef47faa916 /drivers/ide/ide-atapi.c
parent746d5e43274e9ea6cbd58818afc9239d41fb4e1e (diff)
ide-atapi: convert ide-{floppy,tape} to using preallocated sense buffer
Since we're issuing REQ_TYPE_SENSE now we need to allow those types of rqs in the ->do_request callbacks. As a future improvement, sense_len assignment might be unified across all ATAPI devices. Borislav to check with specs and test. As a result, get rid of ide_queue_pc_head() and drive->request_sense_rq. tj: * Init request sense ide_atapi_pc from sense request. In the longer timer, it would probably better to fold ide_create_request_sense_cmd() into its only current user - ide_floppy_get_format_progress(). * ide_retry_pc() no longer takes @disk. CC: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> CC: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ide/ide-atapi.c')
-rw-r--r--drivers/ide/ide-atapi.c48
1 files changed, 14 insertions, 34 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index c6e03485a63a..972c522516f8 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -80,34 +80,6 @@ void ide_init_pc(struct ide_atapi_pc *pc)
80EXPORT_SYMBOL_GPL(ide_init_pc); 80EXPORT_SYMBOL_GPL(ide_init_pc);
81 81
82/* 82/*
83 * Generate a new packet command request in front of the request queue, before
84 * the current request, so that it will be processed immediately, on the next
85 * pass through the driver.
86 */
87static void ide_queue_pc_head(ide_drive_t *drive, struct gendisk *disk,
88 struct ide_atapi_pc *pc, struct request *rq)
89{
90 blk_rq_init(NULL, rq);
91 rq->cmd_type = REQ_TYPE_SPECIAL;
92 rq->cmd_flags |= REQ_PREEMPT;
93 rq->special = (char *)pc;
94 rq->rq_disk = disk;
95
96 if (pc->req_xfer) {
97 rq->data = pc->buf;
98 rq->data_len = pc->req_xfer;
99 }
100
101 memcpy(rq->cmd, pc->c, 12);
102 if (drive->media == ide_tape)
103 rq->cmd[13] = REQ_IDETAPE_PC1;
104
105 drive->hwif->rq = NULL;
106
107 elv_add_request(drive->queue, rq, ELEVATOR_INSERT_FRONT, 0);
108}
109
110/*
111 * Add a special packet command request to the tail of the request queue, 83 * Add a special packet command request to the tail of the request queue,
112 * and wait for it to be serviced. 84 * and wait for it to be serviced.
113 */ 85 */
@@ -254,18 +226,26 @@ EXPORT_SYMBOL_GPL(ide_queue_sense_rq);
254 226
255/* 227/*
256 * Called when an error was detected during the last packet command. 228 * Called when an error was detected during the last packet command.
257 * We queue a request sense packet command in the head of the request list. 229 * We queue a request sense packet command at the head of the request
230 * queue.
258 */ 231 */
259void ide_retry_pc(ide_drive_t *drive, struct gendisk *disk) 232void ide_retry_pc(ide_drive_t *drive)
260{ 233{
261 struct request *rq = &drive->request_sense_rq; 234 struct request *sense_rq = &drive->sense_rq;
262 struct ide_atapi_pc *pc = &drive->request_sense_pc; 235 struct ide_atapi_pc *pc = &drive->request_sense_pc;
263 236
264 (void)ide_read_error(drive); 237 (void)ide_read_error(drive);
265 ide_create_request_sense_cmd(drive, pc); 238
239 /* init pc from sense_rq */
240 ide_init_pc(pc);
241 memcpy(pc->c, sense_rq->cmd, 12);
242 pc->buf = sense_rq->data;
243 pc->req_xfer = sense_rq->data_len;
244
266 if (drive->media == ide_tape) 245 if (drive->media == ide_tape)
267 set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags); 246 set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags);
268 ide_queue_pc_head(drive, disk, pc, rq); 247
248 ide_queue_sense_rq(drive, pc);
269} 249}
270EXPORT_SYMBOL_GPL(ide_retry_pc); 250EXPORT_SYMBOL_GPL(ide_retry_pc);
271 251
@@ -404,7 +384,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
404 debug_log("[cmd %x]: check condition\n", rq->cmd[0]); 384 debug_log("[cmd %x]: check condition\n", rq->cmd[0]);
405 385
406 /* Retry operation */ 386 /* Retry operation */
407 ide_retry_pc(drive, rq->rq_disk); 387 ide_retry_pc(drive);
408 388
409 /* queued, but not started */ 389 /* queued, but not started */
410 return ide_stopped; 390 return ide_stopped;