diff options
author | David Howells <dhowells@redhat.com> | 2006-11-22 09:54:45 -0500 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2006-11-22 09:54:45 -0500 |
commit | 6bb49e5965c1fc399b4d3cd2b5cf2da535b330c0 (patch) | |
tree | ebf48d3bb43c8dbf65d2653b8810973e69d3517e | |
parent | 52bad64d95bd89e08c49ec5a071fa6dcbe5a1a9c (diff) |
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>
-rw-r--r-- | drivers/block/floppy.c | 4 | ||||
-rw-r--r-- | include/linux/workqueue.h | 9 | ||||
-rw-r--r-- | kernel/workqueue.c | 6 |
3 files changed, 10 insertions, 9 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 9e6d3a87cbe3..5a14fac13b12 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -996,7 +996,7 @@ static DECLARE_WORK(floppy_work, NULL, NULL); | |||
996 | 996 | ||
997 | static void schedule_bh(void (*handler) (void)) | 997 | static void schedule_bh(void (*handler) (void)) |
998 | { | 998 | { |
999 | PREPARE_WORK(&floppy_work, (void (*)(void *))handler, NULL); | 999 | PREPARE_WORK(&floppy_work, (work_func_t)handler, NULL); |
1000 | schedule_work(&floppy_work); | 1000 | schedule_work(&floppy_work); |
1001 | } | 1001 | } |
1002 | 1002 | ||
@@ -1008,7 +1008,7 @@ static void cancel_activity(void) | |||
1008 | 1008 | ||
1009 | spin_lock_irqsave(&floppy_lock, flags); | 1009 | spin_lock_irqsave(&floppy_lock, flags); |
1010 | do_floppy = NULL; | 1010 | do_floppy = NULL; |
1011 | PREPARE_WORK(&floppy_work, (void *)empty, NULL); | 1011 | PREPARE_WORK(&floppy_work, (work_func_t)empty, NULL); |
1012 | del_timer(&fd_timer); | 1012 | del_timer(&fd_timer); |
1013 | spin_unlock_irqrestore(&floppy_lock, flags); | 1013 | spin_unlock_irqrestore(&floppy_lock, flags); |
1014 | } | 1014 | } |
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 9faaccae570e..cef40b22ff9a 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -11,10 +11,12 @@ | |||
11 | 11 | ||
12 | struct workqueue_struct; | 12 | struct workqueue_struct; |
13 | 13 | ||
14 | typedef void (*work_func_t)(void *data); | ||
15 | |||
14 | struct work_struct { | 16 | struct work_struct { |
15 | unsigned long pending; | 17 | unsigned long pending; |
16 | struct list_head entry; | 18 | struct list_head entry; |
17 | void (*func)(void *); | 19 | work_func_t func; |
18 | void *data; | 20 | void *data; |
19 | void *wq_data; | 21 | void *wq_data; |
20 | }; | 22 | }; |
@@ -91,7 +93,7 @@ extern int FASTCALL(schedule_work(struct work_struct *work)); | |||
91 | extern int FASTCALL(schedule_delayed_work(struct delayed_work *work, unsigned long delay)); | 93 | extern int FASTCALL(schedule_delayed_work(struct delayed_work *work, unsigned long delay)); |
92 | 94 | ||
93 | extern int schedule_delayed_work_on(int cpu, struct delayed_work *work, unsigned long delay); | 95 | extern int schedule_delayed_work_on(int cpu, struct delayed_work *work, unsigned long delay); |
94 | extern int schedule_on_each_cpu(void (*func)(void *info), void *info); | 96 | extern int schedule_on_each_cpu(work_func_t func, void *info); |
95 | extern void flush_scheduled_work(void); | 97 | extern void flush_scheduled_work(void); |
96 | extern int current_is_keventd(void); | 98 | extern int current_is_keventd(void); |
97 | extern int keventd_up(void); | 99 | extern int keventd_up(void); |
@@ -100,8 +102,7 @@ extern void init_workqueues(void); | |||
100 | void cancel_rearming_delayed_work(struct delayed_work *work); | 102 | void cancel_rearming_delayed_work(struct delayed_work *work); |
101 | void cancel_rearming_delayed_workqueue(struct workqueue_struct *, | 103 | void cancel_rearming_delayed_workqueue(struct workqueue_struct *, |
102 | struct delayed_work *); | 104 | struct delayed_work *); |
103 | int execute_in_process_context(void (*fn)(void *), void *, | 105 | int execute_in_process_context(work_func_t fn, void *, struct execute_work *); |
104 | struct execute_work *); | ||
105 | 106 | ||
106 | /* | 107 | /* |
107 | * Kill off a pending schedule_delayed_work(). Note that the work callback | 108 | * Kill off a pending schedule_delayed_work(). Note that the work callback |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 44fc54b7decf..1e9d61ecf762 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -217,7 +217,7 @@ static void run_workqueue(struct cpu_workqueue_struct *cwq) | |||
217 | while (!list_empty(&cwq->worklist)) { | 217 | while (!list_empty(&cwq->worklist)) { |
218 | struct work_struct *work = list_entry(cwq->worklist.next, | 218 | struct work_struct *work = list_entry(cwq->worklist.next, |
219 | struct work_struct, entry); | 219 | struct work_struct, entry); |
220 | void (*f) (void *) = work->func; | 220 | work_func_t f = work->func; |
221 | void *data = work->data; | 221 | void *data = work->data; |
222 | 222 | ||
223 | list_del_init(cwq->worklist.next); | 223 | list_del_init(cwq->worklist.next); |
@@ -513,7 +513,7 @@ EXPORT_SYMBOL(schedule_delayed_work_on); | |||
513 | * | 513 | * |
514 | * schedule_on_each_cpu() is very slow. | 514 | * schedule_on_each_cpu() is very slow. |
515 | */ | 515 | */ |
516 | int schedule_on_each_cpu(void (*func)(void *info), void *info) | 516 | int schedule_on_each_cpu(work_func_t func, void *info) |
517 | { | 517 | { |
518 | int cpu; | 518 | int cpu; |
519 | struct work_struct *works; | 519 | struct work_struct *works; |
@@ -578,7 +578,7 @@ EXPORT_SYMBOL(cancel_rearming_delayed_work); | |||
578 | * Returns: 0 - function was executed | 578 | * Returns: 0 - function was executed |
579 | * 1 - function was scheduled for execution | 579 | * 1 - function was scheduled for execution |
580 | */ | 580 | */ |
581 | int execute_in_process_context(void (*fn)(void *data), void *data, | 581 | int execute_in_process_context(work_func_t fn, void *data, |
582 | struct execute_work *ew) | 582 | struct execute_work *ew) |
583 | { | 583 | { |
584 | if (!in_interrupt()) { | 584 | if (!in_interrupt()) { |