From 327f845adf7a0d831a235f370ef2eb1636abaab6 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Wed, 30 Apr 2008 09:23:12 +0000 Subject: 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 --- apps/playlist.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'apps') 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 #include #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) -- cgit v1.2.3