amd74xx/via82cxxx: check ide_config_drive_speed() return value
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 13 Oct 2007 15:47:51 +0000 (17:47 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 13 Oct 2007 15:47:51 +0000 (17:47 +0200)
* Check ide_config_drive_speed() return value.

* While at also call ide_config_drive_speed() if the transfer mode is
  XFER_PIO_SLOW (this case happens iff the transfer mode has already been
  set on the device by ide-proc.c::set_xfer_rate()) and remove redundant
  setting of ->{init,current}_speed.

* Bump driver version.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/pci/amd74xx.c
drivers/ide/pci/via82cxxx.c

index 513205e52ad2f0b6a9ff8e68974502ad5b47293c..71d2c670e97e797ee7381f9fed1e23e0822757e0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Version 2.22
+ * Version 2.23
  *
  * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04
  * IDE driver for Linux.
@@ -240,8 +240,8 @@ static int amd_set_drive(ide_drive_t *drive, const u8 speed)
        struct ide_timing t, p;
        int T, UT;
 
-       if (speed != XFER_PIO_SLOW)
-               ide_config_drive_speed(drive, speed);
+       if (ide_config_drive_speed(drive, speed))
+               return 1;
 
        T = 1000000000 / amd_clock;
        UT = (amd_config->udma_mask == ATA_UDMA2) ? T : (T / 2);
@@ -258,10 +258,6 @@ static int amd_set_drive(ide_drive_t *drive, const u8 speed)
 
        amd_set_speed(HWIF(drive)->pci_dev, drive->dn, &t);
 
-       if (!drive->init_speed) 
-               drive->init_speed = speed;
-       drive->current_speed = speed;
-
        return 0;
 }
 
index 378feb491ec46a7c394d42d9f99a3ea752f98fcf..ac094e51d2bf03ea0a99ff8f60c895b74b9ac93e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- * Version 3.48
+ * Version 3.49
  *
  * VIA IDE driver for Linux. Supported southbridges:
  *
@@ -165,8 +165,8 @@ static int via_set_drive(ide_drive_t *drive, const u8 speed)
        struct ide_timing t, p;
        unsigned int T, UT;
 
-       if (speed != XFER_PIO_SLOW)
-               ide_config_drive_speed(drive, speed);
+       if (ide_config_drive_speed(drive, speed))
+               return 1;
 
        T = 1000000000 / via_clock;
 
@@ -187,10 +187,6 @@ static int via_set_drive(ide_drive_t *drive, const u8 speed)
 
        via_set_speed(HWIF(drive), drive->dn, &t);
 
-       if (!drive->init_speed)
-               drive->init_speed = speed;
-       drive->current_speed = speed;
-
        return 0;
 }