From: Johannes Berg Date: Tue, 8 Jul 2008 17:00:18 +0000 (+0200) Subject: rework try_then_request_module to do less in non-modular kernels X-Git-Tag: v2.6.27-rc1~864^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=df648c9fbebb4de50e7a6e76cc253c7cb0421f9b;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git 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 Signed-off-by: Rusty Russell --- diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 5dc1384..9bdb28d 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h @@ -29,11 +29,12 @@ /* modprobe exit status on success, -ve on error. Return value * usually useless though. */ extern int request_module(const char * name, ...) __attribute__ ((format (printf, 1, 2))); +#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) #else static inline int request_module(const char * name, ...) { return -ENOSYS; } +#define try_then_request_module(x, mod...) (x) #endif -#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) struct key; struct file;