[PATCH -next 03/11] rework try_then_request_module to do less innon-modular kernels

From: Johannes Berg
Date: Wed Jul 09 2008 - 08:51:17 EST


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@xxxxxxxxxxxxxxxx>
---
include/linux/kmod.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--- everything.orig/include/linux/kmod.h 2008-07-08 22:00:25.000000000 +0200
+++ everything/include/linux/kmod.h 2008-07-08 22:00:26.000000000 +0200
@@ -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;

--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/