Don't call perform_sleep() while already sleeping

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1988 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2002-08-26 22:05:47 +00:00
parent 457b8a0a67
commit f0599be133

View file

@ -163,6 +163,7 @@ int ata_read_sectors(unsigned long start,
return -1; return -1;
} }
#endif #endif
sleeping = false;
} }
#endif #endif
mutex_lock(&ata_mtx); mutex_lock(&ata_mtx);
@ -239,6 +240,7 @@ int ata_write_sectors(unsigned long start,
last_disk_activity = current_tick; last_disk_activity = current_tick;
#ifndef USE_STANDBY #ifndef USE_STANDBY
if ( sleeping ) {
#ifdef USE_POWEROFF #ifdef USE_POWEROFF
if (ata_power_on()) { if (ata_power_on()) {
return -1; return -1;
@ -248,6 +250,8 @@ int ata_write_sectors(unsigned long start,
return -1; return -1;
} }
#endif #endif
sleeping = false;
}
#endif #endif
mutex_lock(&ata_mtx); mutex_lock(&ata_mtx);
@ -408,6 +412,7 @@ static void ata_thread(void)
while (1) { while (1) {
while ( queue_empty( &ata_queue ) ) { while ( queue_empty( &ata_queue ) ) {
if ( sleep_timeout && if ( sleep_timeout &&
!sleeping &&
TIME_AFTER( current_tick, TIME_AFTER( current_tick,
last_user_activity + sleep_timeout ) && last_user_activity + sleep_timeout ) &&
TIME_AFTER( current_tick, TIME_AFTER( current_tick,