Merge branch 'bp-remove-pc-buf' into for-next
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 13 Jun 2009 10:00:54 +0000 (12:00 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 13 Jun 2009 10:00:54 +0000 (12:00 +0200)
Conflicts:
drivers/ide/ide-tape.c

1  2 
drivers/ide/ide-atapi.c
drivers/ide/ide-cd.c
drivers/ide/ide-tape.c
include/linux/ide.h

@@@ -255,11 -254,9 +254,9 @@@ void ide_retry_pc(ide_drive_t *drive
        /* init pc from sense_rq */
        ide_init_pc(pc);
        memcpy(pc->c, sense_rq->cmd, 12);
-       pc->buf = bio_data(sense_rq->bio);      /* pointer to mapped address */
-       pc->req_xfer = blk_rq_bytes(sense_rq);
  
        if (drive->media == ide_tape)
 -              set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags);
 +              drive->atapi_flags |= IDE_AFLAG_IGNORE_DSC;
  
        /*
         * Push back the failed request and put request sense on top
Simple merge
@@@ -789,11 -762,36 +755,38 @@@ static int ide_tape_read_position(ide_d
  
        debug_log(DBG_PROCS, "Enter %s\n", __func__);
  
-       idetape_create_read_position_cmd(&pc);
-       if (ide_queue_pc_tail(drive, tape->disk, &pc))
+       /* prep cmd */
+       ide_init_pc(&pc);
+       pc.c[0] = READ_POSITION;
+       pc.req_xfer = 20;
+       if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer))
                return -1;
-       position = tape->first_frame;
-       return position;
+       if (!pc.error) {
+               debug_log(DBG_SENSE, "BOP - %s\n",
+                               (buf[0] & 0x80) ? "Yes" : "No");
+               debug_log(DBG_SENSE, "EOP - %s\n",
+                               (buf[0] & 0x40) ? "Yes" : "No");
+               if (buf[0] & 0x4) {
+                       printk(KERN_INFO "ide-tape: Block location is unknown"
+                                        "to the tape\n");
 -                      clear_bit(IDE_AFLAG_ADDRESS_VALID, &drive->atapi_flags);
++                      clear_bit(ilog2(IDE_AFLAG_ADDRESS_VALID),
++                                &drive->atapi_flags);
+                       return -1;
+               } else {
+                       debug_log(DBG_SENSE, "Block Location - %u\n",
+                                       be32_to_cpup((__be32 *)&buf[4]));
+                       tape->partition = buf[1];
+                       tape->first_frame = be32_to_cpup((__be32 *)&buf[4]);
 -                      set_bit(IDE_AFLAG_ADDRESS_VALID, &drive->atapi_flags);
++                      set_bit(ilog2(IDE_AFLAG_ADDRESS_VALID),
++                              &drive->atapi_flags);
+               }
+       }
+       return tape->first_frame;
  }
  
  static void idetape_create_locate_cmd(ide_drive_t *drive,
Simple merge