Skip to contentSkip to conversation

amd74xx/via82cxxx: check ide_config_drive_speed() return value

PATCH In review Bartlomiej Zolnierkiewicz 2 participants 3 messages Jul 26, 2007 – Jul 29, 2007 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 amd74xx/via82cxxx: check ide_config_drive_speed() return value

* 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.

---
 drivers/ide/pci/amd74xx.c   |   10 +++-------
 drivers/ide/pci/via82cxxx.c |   10 +++-------
 2 files changed, 6 insertions(+), 14 deletions(-)
drivers/ide/pci/amd74xx.c +3 -7
Index: b/drivers/ide/pci/amd74xx.c
===================================================================
@@ -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 *dr
 	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 *dr
 
 	amd_set_speed(HWIF(drive)->pci_dev, drive->dn, &t);
 
-	if (!drive->init_speed)	
-		drive->init_speed = speed;
-	drive->current_speed = speed;
-
 	return 0;
 }
 
drivers/ide/pci/via82cxxx.c +3 -7
Index: b/drivers/ide/pci/via82cxxx.c
===================================================================
@@ -1,6 +1,6 @@
 /*
  *
- * Version 3.47
+ * Version 3.48
  *
  * VIA IDE driver for Linux. Supported southbridges:
  *
@@ -164,8 +164,8 @@ static int via_set_drive(ide_drive_t *dr
 	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;
 
@@ -186,10 +186,6 @@ static int via_set_drive(ide_drive_t *dr
 
 	via_set_speed(HWIF(drive), drive->dn, &t);
 
-	if (!drive->init_speed)
-		drive->init_speed = speed;
-	drive->current_speed = speed;
-
 	return 0;
 }
 
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Bartlomiej Zolnierkiewicz

* 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.

MBR, Sergei

PS: There's no need to notify about Acked-by: addition I think -- would save everyone a keystroke or two... ;-)

#2 lore raw

Hi,

Quoted 9 lines · Sergei Shtylyov
Quoted 6 lines · Bartlomiej Zolnierkiewicz

* 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.

Quoted 8 lines
Quoted 1 line

* Bump driver version.

MBR, Sergei

PS: There's no need to notify about Acked-by: addition I think -- would save everyone a keystroke or two... ;-)

OK, just assume that they are added and complain in PM if they are not. :)

Bart