aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-07-08 13:00:18 -0400
committerRusty Russell <rusty@rustcorp.com.au>2008-07-22 05:24:29 -0400
commitdf648c9fbebb4de50e7a6e76cc253c7cb0421f9b (patch)
tree909e31ce61020e65b45f2c0caef3492b9a376b4a
parenta81792f668c20540c336af4242ba1400763eb14f (diff)
rework try_then_request_module to do less in non-modular kernels
This reworks try_then_request_module to only invoke the "lookup" function "x" once when the kernel is not modular. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--include/linux/kmod.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 5dc13848891b..9bdb28d6660f 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -29,11 +29,12 @@
29/* modprobe exit status on success, -ve on error. Return value 29/* modprobe exit status on success, -ve on error. Return value
30 * usually useless though. */ 30 * usually useless though. */
31extern int request_module(const char * name, ...) __attribute__ ((format (printf, 1, 2))); 31extern int request_module(const char * name, ...) __attribute__ ((format (printf, 1, 2)));
32#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x)))
32#else 33#else
33static inline int request_module(const char * name, ...) { return -ENOSYS; } 34static inline int request_module(const char * name, ...) { return -ENOSYS; }
35#define try_then_request_module(x, mod...) (x)
34#endif 36#endif
35 37
36#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x)))
37 38
38struct key; 39struct key;
39struct file; 40struct file;