WorkStruct: Typedef the work function prototype
Define a type for the work function prototype. It's not only kept in the work_struct struct, it's also passed as an argument to several functions. This makes it easier to change it. Signed-Off-By: David Howells <dhowells@redhat.com>
This commit is contained in:
parent
52bad64d95
commit
6bb49e5965
@ -996,7 +996,7 @@ static DECLARE_WORK(floppy_work, NULL, NULL);
|
|||||||
|
|
||||||
static void schedule_bh(void (*handler) (void))
|
static void schedule_bh(void (*handler) (void))
|
||||||
{
|
{
|
||||||
PREPARE_WORK(&floppy_work, (void (*)(void *))handler, NULL);
|
PREPARE_WORK(&floppy_work, (work_func_t)handler, NULL);
|
||||||
schedule_work(&floppy_work);
|
schedule_work(&floppy_work);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1008,7 +1008,7 @@ static void cancel_activity(void)
|
|||||||
|
|
||||||
spin_lock_irqsave(&floppy_lock, flags);
|
spin_lock_irqsave(&floppy_lock, flags);
|
||||||
do_floppy = NULL;
|
do_floppy = NULL;
|
||||||
PREPARE_WORK(&floppy_work, (void *)empty, NULL);
|
PREPARE_WORK(&floppy_work, (work_func_t)empty, NULL);
|
||||||
del_timer(&fd_timer);
|
del_timer(&fd_timer);
|
||||||
spin_unlock_irqrestore(&floppy_lock, flags);
|
spin_unlock_irqrestore(&floppy_lock, flags);
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,12 @@
|
|||||||
|
|
||||||
struct workqueue_struct;
|
struct workqueue_struct;
|
||||||
|
|
||||||
|
typedef void (*work_func_t)(void *data);
|
||||||
|
|
||||||
struct work_struct {
|
struct work_struct {
|
||||||
unsigned long pending;
|
unsigned long pending;
|
||||||
struct list_head entry;
|
struct list_head entry;
|
||||||
void (*func)(void *);
|
work_func_t func;
|
||||||
void *data;
|
void *data;
|
||||||
void *wq_data;
|
void *wq_data;
|
||||||
};
|
};
|
||||||
@ -91,7 +93,7 @@ extern int FASTCALL(schedule_work(struct work_struct *work));
|
|||||||
extern int FASTCALL(schedule_delayed_work(struct delayed_work *work, unsigned long delay));
|
extern int FASTCALL(schedule_delayed_work(struct delayed_work *work, unsigned long delay));
|
||||||
|
|
||||||
extern int schedule_delayed_work_on(int cpu, struct delayed_work *work, unsigned long delay);
|
extern int schedule_delayed_work_on(int cpu, struct delayed_work *work, unsigned long delay);
|
||||||
extern int schedule_on_each_cpu(void (*func)(void *info), void *info);
|
extern int schedule_on_each_cpu(work_func_t func, void *info);
|
||||||
extern void flush_scheduled_work(void);
|
extern void flush_scheduled_work(void);
|
||||||
extern int current_is_keventd(void);
|
extern int current_is_keventd(void);
|
||||||
extern int keventd_up(void);
|
extern int keventd_up(void);
|
||||||
@ -100,8 +102,7 @@ extern void init_workqueues(void);
|
|||||||
void cancel_rearming_delayed_work(struct delayed_work *work);
|
void cancel_rearming_delayed_work(struct delayed_work *work);
|
||||||
void cancel_rearming_delayed_workqueue(struct workqueue_struct *,
|
void cancel_rearming_delayed_workqueue(struct workqueue_struct *,
|
||||||
struct delayed_work *);
|
struct delayed_work *);
|
||||||
int execute_in_process_context(void (*fn)(void *), void *,
|
int execute_in_process_context(work_func_t fn, void *, struct execute_work *);
|
||||||
struct execute_work *);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Kill off a pending schedule_delayed_work(). Note that the work callback
|
* Kill off a pending schedule_delayed_work(). Note that the work callback
|
||||||
|
@ -217,7 +217,7 @@ static void run_workqueue(struct cpu_workqueue_struct *cwq)
|
|||||||
while (!list_empty(&cwq->worklist)) {
|
while (!list_empty(&cwq->worklist)) {
|
||||||
struct work_struct *work = list_entry(cwq->worklist.next,
|
struct work_struct *work = list_entry(cwq->worklist.next,
|
||||||
struct work_struct, entry);
|
struct work_struct, entry);
|
||||||
void (*f) (void *) = work->func;
|
work_func_t f = work->func;
|
||||||
void *data = work->data;
|
void *data = work->data;
|
||||||
|
|
||||||
list_del_init(cwq->worklist.next);
|
list_del_init(cwq->worklist.next);
|
||||||
@ -513,7 +513,7 @@ EXPORT_SYMBOL(schedule_delayed_work_on);
|
|||||||
*
|
*
|
||||||
* schedule_on_each_cpu() is very slow.
|
* schedule_on_each_cpu() is very slow.
|
||||||
*/
|
*/
|
||||||
int schedule_on_each_cpu(void (*func)(void *info), void *info)
|
int schedule_on_each_cpu(work_func_t func, void *info)
|
||||||
{
|
{
|
||||||
int cpu;
|
int cpu;
|
||||||
struct work_struct *works;
|
struct work_struct *works;
|
||||||
@ -578,7 +578,7 @@ EXPORT_SYMBOL(cancel_rearming_delayed_work);
|
|||||||
* Returns: 0 - function was executed
|
* Returns: 0 - function was executed
|
||||||
* 1 - function was scheduled for execution
|
* 1 - function was scheduled for execution
|
||||||
*/
|
*/
|
||||||
int execute_in_process_context(void (*fn)(void *data), void *data,
|
int execute_in_process_context(work_func_t fn, void *data,
|
||||||
struct execute_work *ew)
|
struct execute_work *ew)
|
||||||
{
|
{
|
||||||
if (!in_interrupt()) {
|
if (!in_interrupt()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user