1
0
Fork 0

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>
hifive-unleashed-5.1
Johannes Berg 2008-07-08 19:00:18 +02:00 committed by Rusty Russell
parent a81792f668
commit df648c9fbe
1 changed files with 2 additions and 1 deletions

View File

@ -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;