Correct wrong usage of event callbacks all over the place. It's not supposed to return anything, and should take a data parameter.

Fixing it because correcting the event api prototypes causes many warnings.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23301 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-10-20 21:54:44 +00:00
parent 872852639f
commit 774bacc692
13 changed files with 51 additions and 50 deletions

View file

@ -25,12 +25,12 @@
#include "kernel.h"
#include "string.h"
void register_storage_idle_func(storage_idle_notify function)
void register_storage_idle_func(void (*function)(void *data))
{
#if USING_STORAGE_CALLBACK
add_event(DISK_EVENT_SPINUP, true, function);
#else
function(); /* just call the function now */
function(NULL); /* just call the function now */
/* this _may_ cause problems later if the calling function
sets a variable expecting the callback to unset it, because
the callback will be run before this function exits, so before the var is set */
@ -38,12 +38,12 @@ void register_storage_idle_func(storage_idle_notify function)
}
#if USING_STORAGE_CALLBACK
void unregister_storage_idle_func(storage_idle_notify func, bool run)
void unregister_storage_idle_func(void (*func)(void *data), bool run)
{
remove_event(DISK_EVENT_SPINUP, func);
if (run)
func();
func(NULL);
}
bool call_storage_idle_notifys(bool force)

View file

@ -33,7 +33,7 @@ struct sysevent {
static struct sysevent events[MAX_SYS_EVENTS];
bool add_event(unsigned short id, bool oneshot, void (*handler))
bool add_event(unsigned short id, bool oneshot, void (*handler)(void *data))
{
int i;
@ -60,7 +60,7 @@ bool add_event(unsigned short id, bool oneshot, void (*handler))
return false;
}
void remove_event(unsigned short id, void (*handler))
void remove_event(unsigned short id, void (*handler)(void *data))
{
int i;

View file

@ -48,11 +48,9 @@ enum {
&& (CONFIG_NAND == NAND_IFP7XX)) \
&& !defined(BOOTLOADER)
typedef bool (*storage_idle_notify)(void);
extern void register_storage_idle_func(storage_idle_notify function);
extern void register_storage_idle_func(void (*function)(void *data));
#if USING_STORAGE_CALLBACK
extern void unregister_storage_idle_func(storage_idle_notify function, bool run);
extern void unregister_storage_idle_func(void (*function)(void *data), bool run);
extern bool call_storage_idle_notifys(bool force);
#else
#define unregister_storage_idle_func(f,r)

View file

@ -38,8 +38,8 @@
#define EVENT_CLASS_BUFFERING 0x0400
#define EVENT_CLASS_GUI 0x0800
bool add_event(unsigned short id, bool oneshot, void (*handler));
void remove_event(unsigned short id, void (*handler));
bool add_event(unsigned short id, bool oneshot, void (*handler)(void *data));
void remove_event(unsigned short id, void (*handler)(void *data));
void send_event(unsigned short id, void *data);
#endif