diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-22 13:47:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-22 13:47:24 -0500 |
commit | 2152f8536668a957ea3214735b4761e7b22ef7d8 (patch) | |
tree | 56723fc51445b1bc930c6400d4c00fd6fc831f88 /kernel/workqueue.c | |
parent | 7cae7e26f245151b9ccad868bf2edf8c8048d307 (diff) | |
parent | 30afc84cf7325e88fb9746340eba3c161080ff49 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (138 commits)
[SCSI] libata: implement minimal transport template for ->eh_timed_out
[SCSI] eliminate rphy allocation in favour of expander/end device allocation
[SCSI] convert mptsas over to end_device/expander allocations
[SCSI] allow displaying and setting of cache type via sysfs
[SCSI] add scsi_mode_select to scsi_lib.c
[SCSI] 3ware 9000 add big endian support
[SCSI] qla2xxx: update MAINTAINERS
[SCSI] scsi: move target_destroy call
[SCSI] fusion - bump version
[SCSI] fusion - expander hotplug suport in mptsas module
[SCSI] fusion - exposing raid components in mptsas
[SCSI] fusion - memory leak, and initializing fields
[SCSI] fusion - exclosure misspelled
[SCSI] fusion - cleanup mptsas event handling functions
[SCSI] fusion - removing target_id/bus_id from the VirtDevice structure
[SCSI] fusion - static fix's
[SCSI] fusion - move some debug firmware event debug msgs to verbose level
[SCSI] fusion - loginfo header update
[SCSI] add scsi_reprobe_device
[SCSI] megaraid_sas: fix extended timeout handling
...
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r-- | kernel/workqueue.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index b052e2c4c710..e9e464a90376 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/cpu.h> | 27 | #include <linux/cpu.h> |
28 | #include <linux/notifier.h> | 28 | #include <linux/notifier.h> |
29 | #include <linux/kthread.h> | 29 | #include <linux/kthread.h> |
30 | #include <linux/hardirq.h> | ||
30 | 31 | ||
31 | /* | 32 | /* |
32 | * The per-CPU workqueue (if single thread, we always use the first | 33 | * The per-CPU workqueue (if single thread, we always use the first |
@@ -476,6 +477,34 @@ void cancel_rearming_delayed_work(struct work_struct *work) | |||
476 | } | 477 | } |
477 | EXPORT_SYMBOL(cancel_rearming_delayed_work); | 478 | EXPORT_SYMBOL(cancel_rearming_delayed_work); |
478 | 479 | ||
480 | /** | ||
481 | * execute_in_process_context - reliably execute the routine with user context | ||
482 | * @fn: the function to execute | ||
483 | * @data: data to pass to the function | ||
484 | * @ew: guaranteed storage for the execute work structure (must | ||
485 | * be available when the work executes) | ||
486 | * | ||
487 | * Executes the function immediately if process context is available, | ||
488 | * otherwise schedules the function for delayed execution. | ||
489 | * | ||
490 | * Returns: 0 - function was executed | ||
491 | * 1 - function was scheduled for execution | ||
492 | */ | ||
493 | int execute_in_process_context(void (*fn)(void *data), void *data, | ||
494 | struct execute_work *ew) | ||
495 | { | ||
496 | if (!in_interrupt()) { | ||
497 | fn(data); | ||
498 | return 0; | ||
499 | } | ||
500 | |||
501 | INIT_WORK(&ew->work, fn, data); | ||
502 | schedule_work(&ew->work); | ||
503 | |||
504 | return 1; | ||
505 | } | ||
506 | EXPORT_SYMBOL_GPL(execute_in_process_context); | ||
507 | |||
479 | int keventd_up(void) | 508 | int keventd_up(void) |
480 | { | 509 | { |
481 | return keventd_wq != NULL; | 510 | return keventd_wq != NULL; |