diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2008-04-30 09:23:12 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2008-04-30 09:23:12 +0000 |
commit | 327f845adf7a0d831a235f370ef2eb1636abaab6 (patch) | |
tree | f89a6f847af69f65c644bbae4da10d7a383d2cdc /apps | |
parent | bce419d89062e842b65353f942cb6624d861a2aa (diff) |
remove the 2nd last evil use of ata_disk_is_active() in apps/
the last abuse is in battery bench
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17292 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/playlist.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index 756680c336..c3072ddfd2 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -70,6 +70,7 @@ #include <string.h> #include <ctype.h> #include "playlist.h" +#include "ata_idle_notify.h" #include "file.h" #include "action.h" #include "dir.h" @@ -1255,6 +1256,23 @@ static int compare(const void* p1, const void* p2) * without affecting playlist load up performance. This thread also flushes * any pending control commands when the disk spins up. */ +static bool playlist_flush_callback(void) +{ + struct playlist_info *playlist; + playlist = ¤t_playlist; + if (playlist->control_fd >= 0) + { + if (playlist->num_cached > 0) + { + mutex_lock(&playlist->control_mutex); + flush_cached_control(playlist); + mutex_unlock(&playlist->control_mutex); + } + sync_control(playlist, true); + } + return true; +} + static void playlist_thread(void) { struct queue_event ev; @@ -1288,21 +1306,10 @@ static void playlist_thread(void) timeout or 5s, whichever is less */ case SYS_TIMEOUT: playlist = ¤t_playlist; - - if (playlist->control_fd >= 0 -# ifndef SIMULATOR - && ata_disk_is_active() -# endif - ) + if (playlist->control_fd >= 0) { if (playlist->num_cached > 0) - { - mutex_lock(&playlist->control_mutex); - flush_cached_control(playlist); - mutex_unlock(&playlist->control_mutex); - } - - sync_control(playlist, true); + register_ata_idle_func(playlist_flush_callback); } if (!dirty_pointers) |