palm_bk3710: use ->pio_mode value to determine pair device speed
[safe/jmp/linux-2.6] / drivers / ide / ide-ioctls.c
index 82f252c..6e7ae2b 100644 (file)
@@ -64,7 +64,8 @@ static int ide_get_identity_ioctl(ide_drive_t *drive, unsigned int cmd,
                goto out;
        }
 
-       id = kmalloc(size, GFP_KERNEL);
+       /* ata_id_to_hd_driveid() relies on 'id' to be fully allocated. */
+       id = kmalloc(ATA_ID_WORDS * 2, GFP_KERNEL);
        if (id == NULL) {
                rc = -ENOMEM;
                goto out;
@@ -161,11 +162,13 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
        if (tf->command == ATA_CMD_SET_FEATURES &&
            tf->feature == SETFEATURES_XFER &&
            tf->nsect >= XFER_SW_DMA_0) {
-               xfer_rate = ide_find_dma_mode(drive, XFER_UDMA_6);
+               xfer_rate = ide_find_dma_mode(drive, tf->nsect);
                if (xfer_rate != tf->nsect) {
                        err = -EINVAL;
                        goto abort;
                }
+
+               cmd.tf_flags |= IDE_TFLAG_SET_XFER;
        }
 
        err = ide_raw_taskfile(drive, &cmd, buf, args[3]);
@@ -173,12 +176,6 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
        args[0] = tf->status;
        args[1] = tf->error;
        args[2] = tf->nsect;
-
-       if (!err && xfer_rate) {
-               /* active-retuning-calls future */
-               ide_set_xfer_rate(drive, xfer_rate);
-               ide_driveid_update(drive);
-       }
 abort:
        if (copy_to_user((void __user *)arg, &args, 4))
                err = -EFAULT;