From 398c8027104089f3a36717f18ad3e965729f0db7 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Tue, 7 Nov 2006 13:14:52 +0000 Subject: dont spin up the disk to call the callbacks. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11458 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/ata.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 249cb39..0a03fd2 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -1368,24 +1368,26 @@ static void ata_thread(void) while (1) { while ( queue_empty( &ata_queue ) ) { - if ( !spinup && sleep_timeout && !sleeping && - TIME_AFTER( current_tick, - last_user_activity + sleep_timeout ) && - TIME_AFTER( current_tick, - last_disk_activity + sleep_timeout ) ) + if (!spinup && !sleeping) { - if (!call_ata_idle_notifys()) + if ( sleep_timeout && + TIME_AFTER( current_tick, + last_user_activity + sleep_timeout ) && + TIME_AFTER( current_tick, + last_disk_activity + sleep_timeout ) ) { - ata_perform_sleep(); - last_sleep = current_tick; + if (!call_ata_idle_notifys()) + { + ata_perform_sleep(); + last_sleep = current_tick; + } + } + else if (TIME_AFTER(current_tick, last_callback_run+(HZ*5))) + { + last_callback_run = current_tick; + call_ata_idle_notifys(); } } - else if (TIME_AFTER(current_tick, last_callback_run+(HZ*5))) - { - last_callback_run = current_tick; - call_ata_idle_notifys(); - } - #ifdef HAVE_ATA_POWER_OFF if ( !spinup && sleeping && poweroff_timeout && !poweroff && TIME_AFTER( current_tick, last_sleep + poweroff_timeout )) -- cgit v1.1