]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/ide-cd.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[linux-2.6-omap-h63xx.git] / drivers / ide / ide-cd.c
index 5e42c19a03e3b7f9e2eec932a929660cb513730d..c8d0e8715997475abe51e683ee5b5aff2f44109c 100644 (file)
@@ -670,8 +670,8 @@ static void cdrom_buffer_sectors (ide_drive_t *drive, unsigned long sector,
  * and attempt to recover if there are problems.  Returns  0 if everything's
  * ok; nonzero if the request has been terminated.
  */
-static
-int ide_cd_check_ireason(ide_drive_t *drive, int len, int ireason, int rw)
+static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq,
+                               int len, int ireason, int rw)
 {
        /*
         * ireason == 0: the drive wants to receive data from us
@@ -701,6 +701,9 @@ int ide_cd_check_ireason(ide_drive_t *drive, int len, int ireason, int rw)
                                drive->name, __FUNCTION__, ireason);
        }
 
+       if (rq->cmd_type == REQ_TYPE_ATA_PC)
+               rq->cmd_flags |= REQ_FAILED;
+
        cdrom_end_request(drive, 0);
        return -1;
 }
@@ -1071,11 +1074,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
        /*
         * check which way to transfer data
         */
-       if (blk_fs_request(rq) || blk_pc_request(rq)) {
-               if (ide_cd_check_ireason(drive, len, ireason, write))
-                       return ide_stopped;
+       if (ide_cd_check_ireason(drive, rq, len, ireason, write))
+               return ide_stopped;
 
-               if (blk_fs_request(rq) && write == 0) {
+       if (blk_fs_request(rq)) {
+               if (write == 0) {
                        int nskip;
 
                        if (ide_cd_check_transfer_size(drive, len)) {
@@ -1101,16 +1104,9 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
        if (ireason == 0) {
                write = 1;
                xferfunc = HWIF(drive)->atapi_output_bytes;
-       } else if (ireason == 2 || (ireason == 1 &&
-                  (blk_fs_request(rq) || blk_pc_request(rq)))) {
+       } else {
                write = 0;
                xferfunc = HWIF(drive)->atapi_input_bytes;
-       } else {
-               printk(KERN_ERR "%s: %s: The drive "
-                               "appears confused (ireason = 0x%02x). "
-                               "Trying to recover by ending request.\n",
-                               drive->name, __FUNCTION__, ireason);
-               goto end_request;
        }
 
        /*
@@ -1182,11 +1178,10 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
                        else
                                rq->data += blen;
                }
+               if (!write && blk_sense_request(rq))
+                       rq->sense_len += blen;
        }
 
-       if (write && blk_sense_request(rq))
-               rq->sense_len += thislen;
-
        /*
         * pad, if necessary
         */
@@ -1207,9 +1202,13 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
 end_request:
        if (blk_pc_request(rq)) {
                unsigned long flags;
+               unsigned int dlen = rq->data_len;
+
+               if (dma)
+                       rq->data_len = 0;
 
                spin_lock_irqsave(&ide_lock, flags);
-               if (__blk_end_request(rq, 0, rq->data_len))
+               if (__blk_end_request(rq, 0, dlen))
                        BUG();
                HWGROUP(drive)->rq = NULL;
                spin_unlock_irqrestore(&ide_lock, flags);
@@ -1555,7 +1554,7 @@ int ide_cd_read_toc(ide_drive_t *drive, struct request_sense *sense)
        if (stat)
                return stat;
 
-       toc->hdr.toc_length = ntohs (toc->hdr.toc_length);
+       toc->hdr.toc_length = be16_to_cpu(toc->hdr.toc_length);
 
        if (info->cd_flags & IDE_CD_FLAG_TOCTRACKS_AS_BCD) {
                toc->hdr.first_track = BCD2BIN(toc->hdr.first_track);
@@ -1927,6 +1926,7 @@ static const struct cd_list_entry ide_cd_quirks_list[] = {
        { "MATSHITADVD-ROM SR-8186", NULL,   IDE_CD_FLAG_PLAY_AUDIO_OK      },
        { "MATSHITADVD-ROM SR-8176", NULL,   IDE_CD_FLAG_PLAY_AUDIO_OK      },
        { "MATSHITADVD-ROM SR-8174", NULL,   IDE_CD_FLAG_PLAY_AUDIO_OK      },
+       { "Optiarc DVD RW AD-5200A", NULL,   IDE_CD_FLAG_PLAY_AUDIO_OK      },
        { NULL, NULL, 0 }
 };