Just always compile the code when the kernel is modular.
load_nls could be converted to try_then_request_module
but would lose the printk in that case.
Signed-off-by: Johannes Berg <[email protected]>
---
fs/char_dev.c | 3 ---
fs/exec.c | 9 +++------
fs/nls/nls_base.c | 6 +-----
3 files changed, 4 insertions(+), 14 deletions(-)
--- everything.orig/fs/char_dev.c 2008-07-08 18:32:40.000000000 +0200
+++ everything/fs/char_dev.c 2008-07-08 18:33:54.000000000 +0200
@@ -22,9 +22,6 @@
#include <linux/mutex.h>
#include <linux/backing-dev.h>
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif
#include "internal.h"
/*
--- everything.orig/fs/exec.c 2008-07-08 18:32:40.000000000 +0200
+++ everything/fs/exec.c 2008-07-08 18:33:54.000000000 +0200
@@ -51,15 +51,12 @@
#include <linux/tsacct_kern.h>
#include <linux/cn_proc.h>
#include <linux/audit.h>
+#include <linux/kmod.h>
#include <asm/uaccess.h>
#include <asm/mmu_context.h>
#include <asm/tlb.h>
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif
-
#ifdef __alpha__
/* for /sbin/loader handling in search_binary_handler() */
#include <linux/a.out.h>
@@ -1239,8 +1236,8 @@ int search_binary_handler(struct linux_b
read_unlock(&binfmt_lock);
if (retval != -ENOEXEC || bprm->mm == NULL) {
break;
-#ifdef CONFIG_KMOD
- }else{
+#ifdef CONFIG_MODULES
+ } else {
#define printable(c) (((c)=='\t') || ((c)=='\n') || (0x20<=(c) && (c)<=0x7e))
if (printable(bprm->buf[0]) &&
printable(bprm->buf[1]) &&
--- everything.orig/fs/nls/nls_base.c 2008-07-08 18:32:40.000000000 +0200
+++ everything/fs/nls/nls_base.c 2008-07-08 18:34:44.000000000 +0200
@@ -13,9 +13,7 @@
#include <linux/nls.h>
#include <linux/kernel.h>
#include <linux/errno.h>
-#ifdef CONFIG_KMOD
#include <linux/kmod.h>
-#endif
#include <linux/spinlock.h>
static struct nls_table default_table;
@@ -216,15 +214,13 @@ static struct nls_table *find_nls(char *
struct nls_table *load_nls(char *charset)
{
struct nls_table *nls;
-#ifdef CONFIG_KMOD
int ret;
-#endif
nls = find_nls(charset);
if (nls)
return nls;
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
ret = request_module("nls_%s", charset);
if (ret != 0) {
printk("Unable to load NLS charset %s\n", charset);
--
On Tue, Jul 08, 2008 at 07:00:21PM +0200, Johannes Berg wrote:
>...
> --- everything.orig/fs/nls/nls_base.c 2008-07-08 18:32:40.000000000 +0200
> +++ everything/fs/nls/nls_base.c 2008-07-08 18:34:44.000000000 +0200
>...
> @@ -216,15 +214,13 @@ static struct nls_table *find_nls(char *
> struct nls_table *load_nls(char *charset)
> {
> struct nls_table *nls;
> -#ifdef CONFIG_KMOD
> int ret;
> -#endif
That gives an "unused variable" gcc warning with CONFIG_MODULES=n.
> nls = find_nls(charset);
> if (nls)
> return nls;
>
> -#ifdef CONFIG_KMOD
> +#ifdef CONFIG_MODULES
> ret = request_module("nls_%s", charset);
> if (ret != 0) {
> printk("Unable to load NLS charset %s\n", charset);
>
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
On Tue, 2008-07-08 at 22:57 +0300, Adrian Bunk wrote:
> On Tue, Jul 08, 2008 at 07:00:21PM +0200, Johannes Berg wrote:
> >...
> > --- everything.orig/fs/nls/nls_base.c 2008-07-08 18:32:40.000000000 +0200
> > +++ everything/fs/nls/nls_base.c 2008-07-08 18:34:44.000000000 +0200
> >...
> > @@ -216,15 +214,13 @@ static struct nls_table *find_nls(char *
> > struct nls_table *load_nls(char *charset)
> > {
> > struct nls_table *nls;
> > -#ifdef CONFIG_KMOD
> > int ret;
> > -#endif
>
> That gives an "unused variable" gcc warning with CONFIG_MODULES=n.
Will fix, thanks.
johannes
On Tue, 2008-07-08 at 22:57 +0300, Adrian Bunk wrote:
> On Tue, Jul 08, 2008 at 07:00:21PM +0200, Johannes Berg wrote:
> >...
> > --- everything.orig/fs/nls/nls_base.c 2008-07-08 18:32:40.000000000 +0200
> > +++ everything/fs/nls/nls_base.c 2008-07-08 18:34:44.000000000 +0200
> >...
> > @@ -216,15 +214,13 @@ static struct nls_table *find_nls(char *
> > struct nls_table *load_nls(char *charset)
> > {
> > struct nls_table *nls;
> > -#ifdef CONFIG_KMOD
> > int ret;
> > -#endif
>
> That gives an "unused variable" gcc warning with CONFIG_MODULES=n.
Actually, would anyone object to removing the printk and just using
try_then_request_module?
johannes