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
This commit is contained in:
parent
bce419d890
commit
327f845adf
2 changed files with 24 additions and 13 deletions
|
@ -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)
|
||||
|
|
|
@ -40,6 +40,10 @@ extern void ata_enable(bool on);
|
|||
extern void ata_spindown(int seconds);
|
||||
extern void ata_sleep(void);
|
||||
extern void ata_sleepnow(void);
|
||||
/* NOTE: DO NOT use this to poll for disk activity.
|
||||
If you are waiting for the disk to become active before
|
||||
doing something use ata_idle_notify.h
|
||||
*/
|
||||
extern bool ata_disk_is_active(void);
|
||||
extern int ata_hard_reset(void);
|
||||
extern int ata_soft_reset(void);
|
||||
|
|
Loading…
Reference in a new issue