]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/ide-taskfile.c
ide-cd: fix error messages in cdrom_write_intr()
[linux-2.6-omap-h63xx.git] / drivers / ide / ide-taskfile.c
index 2a3c8d498343ff417f398d1fb4b93e8678dbf82f..2b60f1b0437e9aa790d446369ac285243bd6719f 100644 (file)
@@ -8,23 +8,6 @@
  *  Copyright (C) 2003-2004    Bartlomiej Zolnierkiewicz
  *
  *  The big the bad and the ugly.
- *
- *  Problems to be fixed because of BH interface or the lack therefore.
- *
- *  Fill me in stupid !!!
- *
- *  HOST:
- *     General refers to the Controller and Driver "pair".
- *  DATA HANDLER:
- *     Under the context of Linux it generally refers to an interrupt handler.
- *     However, it correctly describes the 'HOST'
- *  DATA BLOCK:
- *     The amount of data needed to be transfered as predefined in the
- *     setup of the device.
- *  STORAGE ATOMIC:
- *     The 'DATA BLOCK' associated to the 'DATA HANDLER', and can be as
- *     small as a single sector or as large as the entire command block
- *     request.
  */
 
 #include <linux/module.h>
@@ -278,7 +261,7 @@ static void ide_pio_sector(ide_drive_t *drive, unsigned int write)
                hwif->cursg = sg;
        }
 
-       page = cursg->page;
+       page = sg_page(cursg);
        offset = cursg->offset + hwif->cursg_ofs * SECTOR_SIZE;
 
        /* get the current page and offset */
@@ -488,6 +471,7 @@ static int ide_diag_taskfile(ide_drive_t *drive, ide_task_t *args, unsigned long
        struct request rq;
 
        memset(&rq, 0, sizeof(rq));
+       rq.ref_count = 1;
        rq.cmd_type = REQ_TYPE_ATA_TASKFILE;
        rq.buffer = buf;
 
@@ -528,6 +512,7 @@ int ide_raw_taskfile (ide_drive_t *drive, ide_task_t *args, u8 *buf)
 
 EXPORT_SYMBOL(ide_raw_taskfile);
 
+#ifdef CONFIG_IDE_TASK_IOCTL
 int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
 {
        ide_task_request_t      *req_task;
@@ -677,6 +662,7 @@ abort:
 
        return err;
 }
+#endif
 
 int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf)
 {
@@ -695,9 +681,6 @@ int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors,
        return ide_do_drive_cmd(drive, &rq, ide_wait);
 }
 
-/*
- * FIXME : this needs to map into at taskfile. <andre@linux-ide.org>
- */
 int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
 {
        int err = 0;
@@ -761,9 +744,6 @@ static int ide_wait_cmd_task(ide_drive_t *drive, u8 *buf)
        return ide_do_drive_cmd(drive, &rq, ide_wait);
 }
 
-/*
- * FIXME : this needs to map into at taskfile. <andre@linux-ide.org>
- */
 int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
 {
        void __user *p = (void __user *)arg;
@@ -860,9 +840,14 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task)
                case TASKFILE_OUT_DMA:
                case TASKFILE_IN_DMAQ:
                case TASKFILE_IN_DMA:
-                       hwif->dma_setup(drive);
-                       hwif->dma_exec_cmd(drive, taskfile->command);
-                       hwif->dma_start(drive);
+                       if (!drive->using_dma)
+                               break;
+
+                       if (!hwif->dma_setup(drive)) {
+                               hwif->dma_exec_cmd(drive, taskfile->command);
+                               hwif->dma_start(drive);
+                               return ide_started;
+                       }
                        break;
 
                default:
@@ -876,7 +861,8 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task)
                                return task->prehandler(drive, task->rq);
                        }
                        ide_execute_command(drive, taskfile->command, task->handler, WAIT_WORSTCASE, NULL);
+                       return ide_started;
        }
 
-       return ide_started;
+       return ide_stopped;
 }