]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ide: add ide_queue_pc_head() helper
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 10 Oct 2008 20:39:37 +0000 (22:39 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 10 Oct 2008 20:39:37 +0000 (22:39 +0200)
* Move REQ_IDETAPE_* enums to <linux/ide.h>.

* Add ide_queue_pc_head() and convert ide-{floppy,tape}.c to use it
  instead of ide*_queue_pc_head().

* Remove no longer used ide*_queue_pc_head().

There should be no functional changes caused by this patch.

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-atapi.c
drivers/ide/ide-floppy.c
drivers/ide/ide-tape.c
include/linux/ide.h

index 8f0842ce77f57a485afd57bd7065060a8f51fdcd..da71bfce92e8b11abfcb0b147fa2030895a117f3 100644 (file)
@@ -119,6 +119,26 @@ void ide_init_pc(struct ide_atapi_pc *pc)
 }
 EXPORT_SYMBOL_GPL(ide_init_pc);
 
+/*
+ * Generate a new packet command request in front of the request queue, before
+ * the current request, so that it will be processed immediately, on the next
+ * pass through the driver.
+ */
+void ide_queue_pc_head(ide_drive_t *drive, struct gendisk *disk,
+                      struct ide_atapi_pc *pc, struct request *rq)
+{
+       blk_rq_init(NULL, rq);
+       rq->cmd_type = REQ_TYPE_SPECIAL;
+       rq->cmd_flags |= REQ_PREEMPT;
+       rq->buffer = (char *)pc;
+       rq->rq_disk = disk;
+       memcpy(rq->cmd, pc->c, 12);
+       if (drive->media == ide_tape)
+               rq->cmd[13] = REQ_IDETAPE_PC1;
+       ide_do_drive_cmd(drive, rq);
+}
+EXPORT_SYMBOL_GPL(ide_queue_pc_head);
+
 /* TODO: unify the code thus making some arguments go away */
 ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
        ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry,
index e04eaa49a8bf1508f461d4578770dbdac11eb6ee..ddce28e77a4e5485b1ba5a726920068dba17ff44 100644 (file)
@@ -212,25 +212,6 @@ static void idefloppy_update_buffers(ide_drive_t *drive,
                idefloppy_end_request(drive, 1, 0);
 }
 
-/*
- * Generate a new packet command request in front of the request queue, before
- * the current request so that it will be processed immediately, on the next
- * pass through the driver.
- */
-static void idefloppy_queue_pc_head(ide_drive_t *drive, struct ide_atapi_pc *pc,
-               struct request *rq)
-{
-       struct ide_floppy_obj *floppy = drive->driver_data;
-
-       blk_rq_init(NULL, rq);
-       rq->buffer = (char *) pc;
-       rq->cmd_type = REQ_TYPE_SPECIAL;
-       rq->cmd_flags |= REQ_PREEMPT;
-       rq->rq_disk = floppy->disk;
-       memcpy(rq->cmd, pc->c, 12);
-       ide_do_drive_cmd(drive, rq);
-}
-
 static void ide_floppy_callback(ide_drive_t *drive)
 {
        idefloppy_floppy_t *floppy = drive->driver_data;
@@ -288,7 +269,7 @@ static void idefloppy_retry_pc(ide_drive_t *drive)
 
        (void)ide_read_error(drive);
        idefloppy_create_request_sense_cmd(pc);
-       idefloppy_queue_pc_head(drive, pc, rq);
+       ide_queue_pc_head(drive, floppy->disk, pc, rq);
 }
 
 /* The usual interrupt handler called during a packet command. */
index 5c879fbcca87ef15ba97bbc9f9a254d38f9951ce..7103b98eb53a4d9a1ed803e2b92541922e01d100 100644 (file)
@@ -159,20 +159,6 @@ struct idetape_bh {
 #define IDETAPE_LU_RETENSION_MASK      2
 #define IDETAPE_LU_EOT_MASK            4
 
-/*
- * Special requests for our block device strategy routine.
- *
- * In order to service a character device command, we add special requests to
- * the tail of our block device request queue and wait for their completion.
- */
-
-enum {
-       REQ_IDETAPE_PC1         = (1 << 0), /* packet command (first stage) */
-       REQ_IDETAPE_PC2         = (1 << 1), /* packet command (second stage) */
-       REQ_IDETAPE_READ        = (1 << 2),
-       REQ_IDETAPE_WRITE       = (1 << 3),
-};
-
 /* Error codes returned in rq->errors to the higher part of the driver. */
 #define IDETAPE_ERROR_GENERAL          101
 #define IDETAPE_ERROR_FILEMARK         102
@@ -612,26 +598,6 @@ static void idetape_create_request_sense_cmd(struct ide_atapi_pc *pc)
        pc->req_xfer = 20;
 }
 
-/*
- * Generate a new packet command request in front of the request queue, before
- * the current request, so that it will be processed immediately, on the next
- * pass through the driver.
- */
-static void idetape_queue_pc_head(ide_drive_t *drive, struct ide_atapi_pc *pc,
-                                 struct request *rq)
-{
-       struct ide_tape_obj *tape = drive->driver_data;
-
-       blk_rq_init(NULL, rq);
-       rq->cmd_type = REQ_TYPE_SPECIAL;
-       rq->cmd_flags |= REQ_PREEMPT;
-       rq->buffer = (char *) pc;
-       rq->rq_disk = tape->disk;
-       memcpy(rq->cmd, pc->c, 12);
-       rq->cmd[13] = REQ_IDETAPE_PC1;
-       ide_do_drive_cmd(drive, rq);
-}
-
 /*
  *     idetape_retry_pc is called when an error was detected during the
  *     last packet command. We queue a request sense packet command in
@@ -646,7 +612,7 @@ static void idetape_retry_pc(ide_drive_t *drive)
        (void)ide_read_error(drive);
        idetape_create_request_sense_cmd(pc);
        set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags);
-       idetape_queue_pc_head(drive, pc, rq);
+       ide_queue_pc_head(drive, tape->disk, pc, rq);
 }
 
 /*
index bba2f73b99a072feadf9c2c65e01eb44b863f592..1bd49784e4da41b9573ba18fbd22aad09716a413 100644 (file)
@@ -1121,6 +1121,22 @@ int ide_check_atapi_device(ide_drive_t *, const char *);
 
 void ide_init_pc(struct ide_atapi_pc *);
 
+/*
+ * Special requests for ide-tape block device strategy routine.
+ *
+ * In order to service a character device command, we add special requests to
+ * the tail of our block device request queue and wait for their completion.
+ */
+enum {
+       REQ_IDETAPE_PC1         = (1 << 0), /* packet command (first stage) */
+       REQ_IDETAPE_PC2         = (1 << 1), /* packet command (second stage) */
+       REQ_IDETAPE_READ        = (1 << 2),
+       REQ_IDETAPE_WRITE       = (1 << 3),
+};
+
+void ide_queue_pc_head(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *,
+                      struct request *);
+
 ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
        ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry,
        void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *),