linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next 00/11] remove CONFIG_KMOD
@ 2008-07-09  8:28 Johannes Berg
  2008-07-09  8:28 ` [PATCH -next 01/11] make CONFIG_KMOD invisible Johannes Berg
                   ` (11 more replies)
  0 siblings, 12 replies; 16+ messages in thread
From: Johannes Berg @ 2008-07-09  8:28 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Christoph Hellwig, linux-kernel

I've rebased this patch series against -next-20080708 (one conflict
against ftrace, another against BKL pushdown) and fixed the things
Adrian Bunk pointed out.

johannes

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH -next 01/11] make CONFIG_KMOD invisible
  2008-07-09  8:28 [PATCH -next 00/11] remove CONFIG_KMOD Johannes Berg
@ 2008-07-09  8:28 ` Johannes Berg
  2008-07-09  8:28 ` [PATCH -next 02/11] remove CONFIG_KMOD from core kernel code Johannes Berg
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Johannes Berg @ 2008-07-09  8:28 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Christoph Hellwig, linux-kernel

[-- Attachment #1: 003-config-kmod-invisible.patch --]
[-- Type: text/plain, Size: 1044 bytes --]

... as preparation for removing it completely, make it an
invisible bool defaulting to yes.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 init/Kconfig |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

--- everything.orig/init/Kconfig	2008-07-08 21:53:13.000000000 +0200
+++ everything/init/Kconfig	2008-07-08 22:00:24.000000000 +0200
@@ -893,16 +893,8 @@ config MODULE_SRCVERSION_ALL
 	  will be created for all modules.  If unsure, say N.
 
 config KMOD
-	bool "Automatic kernel module loading"
+	def_bool y
 	depends on MODULES
-	help
-	  Normally when you have selected some parts of the kernel to
-	  be created as kernel modules, you must load them (using the
-	  "modprobe" command) before you can use them. If you say Y
-	  here, some parts of the kernel will be able to load modules
-	  automatically: when a part of the kernel needs a module, it
-	  runs modprobe with the appropriate arguments, thereby
-	  loading the module if it is available.  If unsure, say Y.
 
 config STOP_MACHINE
 	bool

-- 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH -next 02/11] remove CONFIG_KMOD from core kernel code
  2008-07-09  8:28 [PATCH -next 00/11] remove CONFIG_KMOD Johannes Berg
  2008-07-09  8:28 ` [PATCH -next 01/11] make CONFIG_KMOD invisible Johannes Berg
@ 2008-07-09  8:28 ` Johannes Berg
  2008-07-09  8:28 ` [PATCH -next 03/11] rework try_then_request_module to do less in non-modular kernels Johannes Berg
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Johannes Berg @ 2008-07-09  8:28 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Christoph Hellwig, linux-kernel

[-- Attachment #1: 004-config-kmod-remove-core.patch --]
[-- Type: text/plain, Size: 2225 bytes --]

Always compile request_module when the kernel allows modules.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 include/linux/kmod.h |    2 +-
 kernel/exec_domain.c |    2 +-
 kernel/kmod.c        |    4 ++--
 kernel/sysctl.c      |    4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

--- linux-next.orig/include/linux/kmod.h	2008-07-08 23:57:41.000000000 +0200
+++ linux-next/include/linux/kmod.h	2008-07-08 23:57:43.000000000 +0200
@@ -25,7 +25,7 @@
 
 #define KMOD_PATH_LEN 256
 
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 /* 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)));
--- linux-next.orig/kernel/exec_domain.c	2008-07-08 23:57:41.000000000 +0200
+++ linux-next/kernel/exec_domain.c	2008-07-08 23:57:43.000000000 +0200
@@ -65,7 +65,7 @@ lookup_exec_domain(u_long personality)
 				goto out;
 	}
 
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 	read_unlock(&exec_domains_lock);
 	request_module("personality-%ld", pers);
 	read_lock(&exec_domains_lock);
--- linux-next.orig/kernel/kmod.c	2008-07-08 23:57:41.000000000 +0200
+++ linux-next/kernel/kmod.c	2008-07-08 23:57:59.000000000 +0200
@@ -42,7 +42,7 @@ extern int max_threads;
 
 static struct workqueue_struct *khelper_wq;
 
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 
 /*
 	modprobe_path is set via /proc/sys.
@@ -113,7 +113,7 @@ int request_module(const char *fmt, ...)
 	return ret;
 }
 EXPORT_SYMBOL(request_module);
-#endif /* CONFIG_KMOD */
+#endif /* CONFIG_MODULES */
 
 struct subprocess_info {
 	struct work_struct work;
--- linux-next.orig/kernel/sysctl.c	2008-07-08 23:57:41.000000000 +0200
+++ linux-next/kernel/sysctl.c	2008-07-08 23:57:43.000000000 +0200
@@ -112,7 +112,7 @@ static int min_percpu_pagelist_fract = 8
 
 static int ngroups_max = NGROUPS_MAX;
 
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 extern char modprobe_path[];
 #endif
 #ifdef CONFIG_CHR_DEV_SG
@@ -477,7 +477,7 @@ static struct ctl_table kern_table[] = {
 		.proc_handler	= &ftrace_enable_sysctl,
 	},
 #endif
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 	{
 		.ctl_name	= KERN_MODPROBE,
 		.procname	= "modprobe",

-- 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH -next 03/11] rework try_then_request_module to do less in non-modular kernels
  2008-07-09  8:28 [PATCH -next 00/11] remove CONFIG_KMOD Johannes Berg
  2008-07-09  8:28 ` [PATCH -next 01/11] make CONFIG_KMOD invisible Johannes Berg
  2008-07-09  8:28 ` [PATCH -next 02/11] remove CONFIG_KMOD from core kernel code Johannes Berg
@ 2008-07-09  8:28 ` Johannes Berg
  2008-07-09  8:28 ` [PATCH -next 04/11] remove CONFIG_KMOD from drivers Johannes Berg
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Johannes Berg @ 2008-07-09  8:28 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Christoph Hellwig, linux-kernel

[-- Attachment #1: 005-config-kmod-try-then-rework.patch --]
[-- Type: text/plain, Size: 953 bytes --]

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

-- 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH -next 04/11] remove CONFIG_KMOD from drivers
  2008-07-09  8:28 [PATCH -next 00/11] remove CONFIG_KMOD Johannes Berg
                   ` (2 preceding siblings ...)
  2008-07-09  8:28 ` [PATCH -next 03/11] rework try_then_request_module to do less in non-modular kernels Johannes Berg
@ 2008-07-09  8:28 ` Johannes Berg
  2008-07-09  8:28 ` [PATCH -next 05/11] remove CONFIG_KMOD from sparc64 Johannes Berg
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Johannes Berg @ 2008-07-09  8:28 UTC (permalink / raw)
  To: Rusty Russell
  Cc: Christoph Hellwig, linux-kernel, video4linux-list,
	David Woodhouse, linux-ppp, dm-devel

[-- Attachment #1: 006-config-kmod-remove-drivers.patch --]
[-- Type: text/plain, Size: 8716 bytes --]

Straight forward conversions to CONFIG_MODULE; many drivers
include <linux/kmod.h> conditionally and then don't have any
other conditional code so remove it from those.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: video4linux-list@redhat.com
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-ppp@vger.kernel.org
Cc: dm-devel@redhat.com
---
v2: remove #ifdef in md.c

 drivers/md/md.c                                 |    7 -------
 drivers/media/video/cpia.c                      |    4 ----
 drivers/media/video/usbvision/usbvision-core.c  |    4 ----
 drivers/media/video/usbvision/usbvision-video.c |    4 ----
 drivers/media/video/v4l1-compat.c               |    4 ----
 drivers/media/video/v4l2-common.c               |    4 ----
 drivers/media/video/vino.c                      |    5 +----
 drivers/media/video/w9968cf.c                   |    4 ++--
 drivers/mtd/mtdpart.c                           |    2 --
 drivers/net/irda/sir_dongle.c                   |    2 --
 drivers/net/ppp_generic.c                       |   10 +++-------
 drivers/net/pppox.c                             |    9 ++-------
 drivers/video/fbmem.c                           |   17 ++---------------
 13 files changed, 10 insertions(+), 66 deletions(-)

--- linux-next.orig/drivers/md/md.c	2008-07-08 23:47:19.000000000 +0200
+++ linux-next/drivers/md/md.c	2008-07-08 23:55:21.000000000 +0200
@@ -44,14 +44,9 @@
 #include <linux/mutex.h>
 #include <linux/ctype.h>
 #include <linux/freezer.h>
-
 #include <linux/init.h>
-
 #include <linux/file.h>
-
-#ifdef CONFIG_KMOD
 #include <linux/kmod.h>
-#endif
 
 #include <asm/unaligned.h>
 
@@ -3565,12 +3560,10 @@ static int do_md_run(mddev_t * mddev)
 		}
 	}
 
-#ifdef CONFIG_KMOD
 	if (mddev->level != LEVEL_NONE)
 		request_module("md-level-%d", mddev->level);
 	else if (mddev->clevel[0])
 		request_module("md-%s", mddev->clevel);
-#endif
 
 	/*
 	 * Drop all container device buffers, from now on
--- linux-next.orig/drivers/media/video/cpia.c	2008-07-08 23:47:19.000000000 +0200
+++ linux-next/drivers/media/video/cpia.c	2008-07-08 23:55:21.000000000 +0200
@@ -39,10 +39,6 @@
 #include <asm/io.h>
 #include <linux/mutex.h>
 
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif
-
 #include "cpia.h"
 
 static int video_nr = -1;
--- linux-next.orig/drivers/media/video/usbvision/usbvision-core.c	2008-07-08 23:47:19.000000000 +0200
+++ linux-next/drivers/media/video/usbvision/usbvision-core.c	2008-07-08 23:55:21.000000000 +0200
@@ -47,10 +47,6 @@
 
 #include <linux/workqueue.h>
 
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif
-
 #include "usbvision.h"
 
 static unsigned int core_debug;
--- linux-next.orig/drivers/media/video/usbvision/usbvision-video.c	2008-07-08 23:47:19.000000000 +0200
+++ linux-next/drivers/media/video/usbvision/usbvision-video.c	2008-07-08 23:55:21.000000000 +0200
@@ -70,10 +70,6 @@
 
 #include <linux/workqueue.h>
 
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif
-
 #include "usbvision.h"
 #include "usbvision-cards.h"
 
--- linux-next.orig/drivers/media/video/v4l1-compat.c	2008-07-08 23:47:19.000000000 +0200
+++ linux-next/drivers/media/video/v4l1-compat.c	2008-07-08 23:55:21.000000000 +0200
@@ -35,10 +35,6 @@
 #include <asm/system.h>
 #include <asm/pgtable.h>
 
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif
-
 static unsigned int debug;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "enable debug messages");
--- linux-next.orig/drivers/media/video/v4l2-common.c	2008-07-08 23:47:19.000000000 +0200
+++ linux-next/drivers/media/video/v4l2-common.c	2008-07-08 23:55:21.000000000 +0200
@@ -60,10 +60,6 @@
 #include <media/v4l2-common.h>
 #include <media/v4l2-chip-ident.h>
 
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif
-
 #include <linux/videodev.h>
 
 MODULE_AUTHOR("Bill Dirks, Justin Schoeman, Gerd Knorr");
--- linux-next.orig/drivers/media/video/vino.c	2008-07-08 23:47:20.000000000 +0200
+++ linux-next/drivers/media/video/vino.c	2008-07-08 23:55:21.000000000 +0200
@@ -30,10 +30,7 @@
 #include <linux/mm.h>
 #include <linux/time.h>
 #include <linux/version.h>
-
-#ifdef CONFIG_KMOD
 #include <linux/kmod.h>
-#endif
 
 #include <linux/i2c.h>
 #include <linux/i2c-algo-sgi.h>
@@ -4641,7 +4638,7 @@ static int __init vino_module_init(void)
 	}
 	vino_init_stage++;
 
-#if defined(CONFIG_KMOD) && defined(MODULE)
+#ifdef MODULE
 	request_module("saa7191");
 	request_module("indycam");
 #endif
--- linux-next.orig/drivers/media/video/w9968cf.c	2008-07-08 23:47:20.000000000 +0200
+++ linux-next/drivers/media/video/w9968cf.c	2008-07-08 23:55:21.000000000 +0200
@@ -110,7 +110,7 @@ static int specific_debug = W9968CF_SPEC
 
 static unsigned int param_nv[24]; /* number of values per parameter */
 
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 module_param(ovmod_load, bool, 0644);
 #endif
 module_param(simcams, ushort, 0644);
@@ -143,7 +143,7 @@ module_param(debug, ushort, 0644);
 module_param(specific_debug, bool, 0644);
 #endif
 
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 MODULE_PARM_DESC(ovmod_load,
 		 "\n<0|1> Automatic 'ovcamchip' module loading."
 		 "\n0 disabled, 1 enabled."
--- linux-next.orig/drivers/mtd/mtdpart.c	2008-07-08 23:47:22.000000000 +0200
+++ linux-next/drivers/mtd/mtdpart.c	2008-07-08 23:55:21.000000000 +0200
@@ -544,10 +544,8 @@ int parse_mtd_partitions(struct mtd_info
 
 	for ( ; ret <= 0 && *types; types++) {
 		parser = get_partition_parser(*types);
-#ifdef CONFIG_KMOD
 		if (!parser && !request_module("%s", *types))
 				parser = get_partition_parser(*types);
-#endif
 		if (!parser) {
 			printk(KERN_NOTICE "%s partition parsing not available\n",
 			       *types);
--- linux-next.orig/drivers/net/irda/sir_dongle.c	2008-07-08 23:47:22.000000000 +0200
+++ linux-next/drivers/net/irda/sir_dongle.c	2008-07-08 23:55:21.000000000 +0200
@@ -67,9 +67,7 @@ int sirdev_get_dongle(struct sir_dev *de
 	const struct dongle_driver *drv = NULL;
 	int err = -EINVAL;
 
-#ifdef CONFIG_KMOD
 	request_module("irda-dongle-%d", type);
-#endif
 
 	if (dev->dongle_drv != NULL)
 		return -EBUSY;
--- linux-next.orig/drivers/net/ppp_generic.c	2008-07-08 23:47:23.000000000 +0200
+++ linux-next/drivers/net/ppp_generic.c	2008-07-08 23:55:21.000000000 +0200
@@ -2124,13 +2124,9 @@ ppp_set_compress(struct ppp *ppp, unsign
 	    || ccp_option[1] < 2 || ccp_option[1] > data.length)
 		goto out;
 
-	cp = find_compressor(ccp_option[0]);
-#ifdef CONFIG_KMOD
-	if (!cp) {
-		request_module("ppp-compress-%d", ccp_option[0]);
-		cp = find_compressor(ccp_option[0]);
-	}
-#endif /* CONFIG_KMOD */
+	cp = try_then_request_module(
+		find_compressor(ccp_option[0]),
+		"ppp-compress-%d", ccp_option[0]);
 	if (!cp)
 		goto out;
 
--- linux-next.orig/drivers/net/pppox.c	2008-07-08 23:47:23.000000000 +0200
+++ linux-next/drivers/net/pppox.c	2008-07-08 23:55:21.000000000 +0200
@@ -115,13 +115,8 @@ static int pppox_create(struct net *net,
 		goto out;
 
 	rc = -EPROTONOSUPPORT;
-#ifdef CONFIG_KMOD
-	if (!pppox_protos[protocol]) {
-		char buffer[32];
-		sprintf(buffer, "pppox-proto-%d", protocol);
-		request_module(buffer);
-	}
-#endif
+	if (!pppox_protos[protocol])
+		request_module("pppox-proto-%d", protocol);
 	if (!pppox_protos[protocol] ||
 	    !try_module_get(pppox_protos[protocol]->owner))
 		goto out;
--- linux-next.orig/drivers/video/fbmem.c	2008-07-08 23:47:28.000000000 +0200
+++ linux-next/drivers/video/fbmem.c	2008-07-08 23:55:21.000000000 +0200
@@ -28,9 +28,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/console.h>
-#ifdef CONFIG_KMOD
 #include <linux/kmod.h>
-#endif
 #include <linux/err.h>
 #include <linux/device.h>
 #include <linux/efi.h>
@@ -837,13 +835,6 @@ fb_write(struct file *file, const char _
 	return (cnt) ? cnt : err;
 }
 
-#ifdef CONFIG_KMOD
-static void try_to_load(int fb)
-{
-	request_module("fb%d", fb);
-}
-#endif /* CONFIG_KMOD */
-
 int
 fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var)
 {
@@ -1086,10 +1077,8 @@ fb_ioctl(struct inode *inode, struct fil
 		    return -EINVAL;
 		if (con2fb.framebuffer < 0 || con2fb.framebuffer >= FB_MAX)
 		    return -EINVAL;
-#ifdef CONFIG_KMOD
 		if (!registered_fb[con2fb.framebuffer])
-		    try_to_load(con2fb.framebuffer);
-#endif /* CONFIG_KMOD */
+		    request_module("fb%d", con2fb.framebuffer);
 		if (!registered_fb[con2fb.framebuffer])
 		    return -EINVAL;
 		event.info = info;
@@ -1327,10 +1316,8 @@ fb_open(struct inode *inode, struct file
 	if (fbidx >= FB_MAX)
 		return -ENODEV;
 	lock_kernel();
-#ifdef CONFIG_KMOD
 	if (!(info = registered_fb[fbidx]))
-		try_to_load(fbidx);
-#endif /* CONFIG_KMOD */
+		request_module("fb%d", fbidx);
 	if (!(info = registered_fb[fbidx])) {
 		res = -ENODEV;
 		goto out;

-- 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH -next 05/11] remove CONFIG_KMOD from sparc64
  2008-07-09  8:28 [PATCH -next 00/11] remove CONFIG_KMOD Johannes Berg
                   ` (3 preceding siblings ...)
  2008-07-09  8:28 ` [PATCH -next 04/11] remove CONFIG_KMOD from drivers Johannes Berg
@ 2008-07-09  8:28 ` Johannes Berg
  2008-07-09  8:28 ` [PATCH -next 06/11] remove CONFIG_KMOD from fs Johannes Berg
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Johannes Berg @ 2008-07-09  8:28 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Christoph Hellwig, linux-kernel, David S. Miller

[-- Attachment #1: 007-config-kmod-remove-sparc64.patch --]
[-- Type: text/plain, Size: 1463 bytes --]

One place is just a comment, the other a conditional, unused
inclusion of linux/kmod.h.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: David S. Miller <davem@davemloft.net>
---
 arch/sparc64/kernel/process.c |    6 +++---
 arch/sparc64/kernel/traps.c   |    3 ---
 2 files changed, 3 insertions(+), 6 deletions(-)

--- everything.orig/arch/sparc64/kernel/traps.c	2008-07-08 21:53:12.000000000 +0200
+++ everything/arch/sparc64/kernel/traps.c	2008-07-08 22:00:28.000000000 +0200
@@ -37,9 +37,6 @@
 #include <asm/processor.h>
 #include <asm/timer.h>
 #include <asm/head.h>
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif
 #include <asm/prom.h>
 
 #include "entry.h"
--- everything.orig/arch/sparc64/kernel/process.c	2008-07-08 21:53:11.000000000 +0200
+++ everything/arch/sparc64/kernel/process.c	2008-07-08 22:00:28.000000000 +0200
@@ -691,9 +691,9 @@ int copy_thread(int nr, unsigned long cl
 		  ((unsigned long) child_sf) - STACK_BIAS;
 
 		/* Special case, if we are spawning a kernel thread from
-		 * a userspace task (via KMOD, NFS, or similar) we must
-		 * disable performance counters in the child because the
-		 * address space and protection realm are changing.
+		 * a userspace task (usermode helper, NFS or similar), we
+		 * must disable performance counters in the child because
+		 * the address space and protection realm are changing.
 		 */
 		if (t->flags & _TIF_PERFCTR) {
 			t->user_cntd0 = t->user_cntd1 = NULL;

-- 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH -next 06/11] remove CONFIG_KMOD from fs
  2008-07-09  8:28 [PATCH -next 00/11] remove CONFIG_KMOD Johannes Berg
                   ` (4 preceding siblings ...)
  2008-07-09  8:28 ` [PATCH -next 05/11] remove CONFIG_KMOD from sparc64 Johannes Berg
@ 2008-07-09  8:28 ` Johannes Berg
  2008-07-09  8:28 ` [PATCH -next 07/11] remove CONFIG_KMOD from sound Johannes Berg
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Johannes Berg @ 2008-07-09  8:28 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Christoph Hellwig, linux-kernel

[-- Attachment #1: 008-config-kmod-remove-fs.patch --]
[-- Type: text/plain, Size: 2568 bytes --]

Just always compile the code when the kernel is modular.
Convert load_nls to use try_then_request_module to tidy
up the code.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
v2: fix "unused variable" warning pointed out by Adrian Bunk
    by just using try_then_request_module() for load_nls().

 fs/char_dev.c     |    3 ---
 fs/exec.c         |    9 +++------
 fs/nls/nls_base.c |   23 +++--------------------
 3 files changed, 6 insertions(+), 29 deletions(-)

--- everything.orig/fs/char_dev.c	2008-07-08 22:09:18.000000000 +0200
+++ everything/fs/char_dev.c	2008-07-08 22:10:41.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 22:09:18.000000000 +0200
+++ everything/fs/exec.c	2008-07-08 22:10:41.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 22:09:18.000000000 +0200
+++ everything/fs/nls/nls_base.c	2008-07-08 22:11:57.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;
@@ -215,24 +213,9 @@ 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
-	ret = request_module("nls_%s", charset);
-	if (ret != 0) {
-		printk("Unable to load NLS charset %s\n", charset);
-		return NULL;
-	}
-	nls = find_nls(charset);
-#endif
-	return nls;
+	return try_then_request_module(
+			find_nls(charset),
+			"nls_%s", charset);
 }
 
 void unload_nls(struct nls_table *nls)

-- 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH -next 07/11] remove CONFIG_KMOD from sound
  2008-07-09  8:28 [PATCH -next 00/11] remove CONFIG_KMOD Johannes Berg
                   ` (5 preceding siblings ...)
  2008-07-09  8:28 ` [PATCH -next 06/11] remove CONFIG_KMOD from fs Johannes Berg
@ 2008-07-09  8:28 ` Johannes Berg
  2008-07-09 17:33   ` Takashi Iwai
  2008-07-09  8:28 ` [PATCH -next 08/11] remove CONFIG_KMOD from net Johannes Berg
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 16+ messages in thread
From: Johannes Berg @ 2008-07-09  8:28 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Christoph Hellwig, linux-kernel, Takashi Iwai

[-- Attachment #1: 009-config-kmod-remove-sound.patch --]
[-- Type: text/plain, Size: 5161 bytes --]

A bunch of things in alsa depend on CONFIG_KMOD,
use CONFIG_MODULES instead where the dependency
is needed at all.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Takashi Iwai <tiwai@suse.de>
---
v2: remove #ifdef around EXPORT_SYMBOL pointed out by
    Adrian Bunk

 include/sound/seq_kernel.h     |    2 +-
 sound/core/seq/seq_clientmgr.c |    2 +-
 sound/core/seq/seq_device.c    |    6 ++----
 sound/core/sound.c             |    8 ++++----
 sound/core/timer.c             |    6 +++---
 sound/ppc/daca.c               |    2 --
 sound/ppc/tumbler.c            |    2 --
 7 files changed, 11 insertions(+), 17 deletions(-)

--- linux-next.orig/include/sound/seq_kernel.h	2008-07-08 23:47:40.000000000 +0200
+++ linux-next/include/sound/seq_kernel.h	2008-07-08 23:55:27.000000000 +0200
@@ -105,7 +105,7 @@ int snd_seq_event_port_attach(int client
 			      int cap, int type, int midi_channels, int midi_voices, char *portname);
 int snd_seq_event_port_detach(int client, int port);
 
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 void snd_seq_autoload_lock(void);
 void snd_seq_autoload_unlock(void);
 #else
--- linux-next.orig/sound/core/seq/seq_clientmgr.c	2008-07-08 23:47:42.000000000 +0200
+++ linux-next/sound/core/seq/seq_clientmgr.c	2008-07-08 23:55:27.000000000 +0200
@@ -148,7 +148,7 @@ struct snd_seq_client *snd_seq_client_us
 		return NULL;
 	}
 	spin_unlock_irqrestore(&clients_lock, flags);
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 	if (!in_interrupt()) {
 		static char client_requested[SNDRV_SEQ_GLOBAL_CLIENTS];
 		static char card_requested[SNDRV_CARDS];
--- linux-next.orig/sound/core/seq/seq_device.c	2008-07-08 23:47:42.000000000 +0200
+++ linux-next/sound/core/seq/seq_device.c	2008-07-08 23:55:27.000000000 +0200
@@ -124,7 +124,7 @@ static void snd_seq_device_info(struct s
  * load all registered drivers (called from seq_clientmgr.c)
  */
 
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 /* avoid auto-loading during module_init() */
 static int snd_seq_in_init;
 void snd_seq_autoload_lock(void)
@@ -140,7 +140,7 @@ void snd_seq_autoload_unlock(void)
 
 void snd_seq_device_load_drivers(void)
 {
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 	struct ops_list *ops;
 
 	/* Calling request_module during module_init()
@@ -566,7 +566,5 @@ EXPORT_SYMBOL(snd_seq_device_load_driver
 EXPORT_SYMBOL(snd_seq_device_new);
 EXPORT_SYMBOL(snd_seq_device_register_driver);
 EXPORT_SYMBOL(snd_seq_device_unregister_driver);
-#ifdef CONFIG_KMOD
 EXPORT_SYMBOL(snd_seq_autoload_lock);
 EXPORT_SYMBOL(snd_seq_autoload_unlock);
-#endif
--- linux-next.orig/sound/core/sound.c	2008-07-08 23:47:42.000000000 +0200
+++ linux-next/sound/core/sound.c	2008-07-08 23:55:27.000000000 +0200
@@ -61,14 +61,14 @@ EXPORT_SYMBOL(snd_ecards_limit);
 static struct snd_minor *snd_minors[SNDRV_OS_MINORS];
 static DEFINE_MUTEX(sound_mutex);
 
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 
 /**
  * snd_request_card - try to load the card module
  * @card: the card number
  *
  * Tries to load the module "snd-card-X" for the given card number
- * via KMOD.  Returns immediately if already loaded.
+ * via request_module.  Returns immediately if already loaded.
  */
 void snd_request_card(int card)
 {
@@ -93,7 +93,7 @@ static void snd_request_other(int minor)
 	request_module(str);
 }
 
-#endif				/* request_module support */
+#endif	/* modular kernel */
 
 /**
  * snd_lookup_minor_data - get user data of a registered device
@@ -133,7 +133,7 @@ static int __snd_open(struct inode *inod
 		return -ENODEV;
 	mptr = snd_minors[minor];
 	if (mptr == NULL) {
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 		int dev = SNDRV_MINOR_DEVICE(minor);
 		if (dev == SNDRV_MINOR_CONTROL) {
 			/* /dev/aloadC? */
--- linux-next.orig/sound/core/timer.c	2008-07-08 23:47:42.000000000 +0200
+++ linux-next/sound/core/timer.c	2008-07-08 23:55:27.000000000 +0200
@@ -146,7 +146,7 @@ static struct snd_timer *snd_timer_find(
 	return NULL;
 }
 
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 
 static void snd_timer_request(struct snd_timer_id *tid)
 {
@@ -259,8 +259,8 @@ int snd_timer_open(struct snd_timer_inst
 	/* open a master instance */
 	mutex_lock(&register_mutex);
 	timer = snd_timer_find(tid);
-#ifdef CONFIG_KMOD
-	if (timer == NULL) {
+#ifdef CONFIG_MODULES
+	if (!timer) {
 		mutex_unlock(&register_mutex);
 		snd_timer_request(tid);
 		mutex_lock(&register_mutex);
--- linux-next.orig/sound/ppc/daca.c	2008-07-08 23:47:43.000000000 +0200
+++ linux-next/sound/ppc/daca.c	2008-07-08 23:55:27.000000000 +0200
@@ -249,9 +249,7 @@ int __init snd_pmac_daca_init(struct snd
 	int i, err;
 	struct pmac_daca *mix;
 
-#ifdef CONFIG_KMOD
 	request_module("i2c-powermac");
-#endif /* CONFIG_KMOD */
 
 	mix = kzalloc(sizeof(*mix), GFP_KERNEL);
 	if (! mix)
--- linux-next.orig/sound/ppc/tumbler.c	2008-07-08 23:47:43.000000000 +0200
+++ linux-next/sound/ppc/tumbler.c	2008-07-08 23:55:27.000000000 +0200
@@ -1350,9 +1350,7 @@ int __init snd_pmac_tumbler_init(struct 
 	struct device_node *tas_node, *np;
 	char *chipname;
 
-#ifdef CONFIG_KMOD
 	request_module("i2c-powermac");
-#endif /* CONFIG_KMOD */
 
 	mix = kzalloc(sizeof(*mix), GFP_KERNEL);
 	if (! mix)

-- 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH -next 08/11] remove CONFIG_KMOD from net
  2008-07-09  8:28 [PATCH -next 00/11] remove CONFIG_KMOD Johannes Berg
                   ` (6 preceding siblings ...)
  2008-07-09  8:28 ` [PATCH -next 07/11] remove CONFIG_KMOD from sound Johannes Berg
@ 2008-07-09  8:28 ` Johannes Berg
  2008-07-09  8:28 ` [PATCH -next 09/11] remove CONFIG_KMOD from lib Johannes Berg
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Johannes Berg @ 2008-07-09  8:28 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Christoph Hellwig, linux-kernel, netdev

[-- Attachment #1: 010-config-kmod-remove-net.patch --]
[-- Type: text/plain, Size: 10613 bytes --]

Some code here depends on CONFIG_KMOD to not try to load
protocol modules or similar, replace by CONFIG_MODULES
where more than just request_module depends on CONFIG_KMOD
and and also use try_then_request_module in ebtables.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: netdev@vger.kernel.org
---
v2: remove #ifdef around EXPORT_SYMBOL pointed out by
    Adrian Bunk

 include/linux/netdevice.h       |    5 ++++-
 net/bluetooth/af_bluetooth.c    |    8 +-------
 net/bridge/netfilter/ebtables.c |   15 +++------------
 net/can/af_can.c                |    4 ++--
 net/core/dev.c                  |    2 --
 net/core/rtnetlink.c            |    4 ++--
 net/dccp/ccid.c                 |    2 +-
 net/decnet/dn_dev.c             |    2 --
 net/ipv4/devinet.c              |    2 --
 net/ipv4/inet_diag.c            |    2 --
 net/ipv4/tcp_cong.c             |    4 ++--
 net/netfilter/nfnetlink.c       |    2 +-
 net/netlink/af_netlink.c        |    2 +-
 net/sched/act_api.c             |    2 +-
 net/sched/cls_api.c             |    2 +-
 net/sched/ematch.c              |    2 +-
 net/sched/sch_api.c             |    2 +-
 net/socket.c                    |    2 +-
 net/sunrpc/auth.c               |    2 --
 19 files changed, 22 insertions(+), 44 deletions(-)

--- linux-next.orig/net/bluetooth/af_bluetooth.c	2008-07-08 23:47:41.000000000 +0200
+++ linux-next/net/bluetooth/af_bluetooth.c	2008-07-08 23:55:31.000000000 +0200
@@ -36,10 +36,7 @@
 #include <linux/init.h>
 #include <linux/poll.h>
 #include <net/sock.h>
-
-#if defined(CONFIG_KMOD)
 #include <linux/kmod.h>
-#endif
 
 #include <net/bluetooth/bluetooth.h>
 
@@ -144,11 +141,8 @@ static int bt_sock_create(struct net *ne
 	if (proto < 0 || proto >= BT_MAX_PROTO)
 		return -EINVAL;
 
-#if defined(CONFIG_KMOD)
-	if (!bt_proto[proto]) {
+	if (!bt_proto[proto])
 		request_module("bt-proto-%d", proto);
-	}
-#endif
 
 	err = -EPROTONOSUPPORT;
 
--- linux-next.orig/net/bridge/netfilter/ebtables.c	2008-07-08 23:47:41.000000000 +0200
+++ linux-next/net/bridge/netfilter/ebtables.c	2008-07-08 23:55:31.000000000 +0200
@@ -288,23 +288,14 @@ find_inlist_lock_noload(struct list_head
 	return NULL;
 }
 
-#ifndef CONFIG_KMOD
-#define find_inlist_lock(h,n,p,e,m) find_inlist_lock_noload((h),(n),(e),(m))
-#else
 static void *
 find_inlist_lock(struct list_head *head, const char *name, const char *prefix,
    int *error, struct mutex *mutex)
 {
-	void *ret;
-
-	ret = find_inlist_lock_noload(head, name, error, mutex);
-	if (!ret) {
-		request_module("%s%s", prefix, name);
-		ret = find_inlist_lock_noload(head, name, error, mutex);
-	}
-	return ret;
+	return try_then_request_module(
+			find_inlist_lock_noload(head, name, error, mutex),
+			"%s%s", prefix, name);
 }
-#endif
 
 static inline struct ebt_table *
 find_table_lock(const char *name, int *error, struct mutex *mutex)
--- linux-next.orig/net/can/af_can.c	2008-07-08 23:47:41.000000000 +0200
+++ linux-next/net/can/af_can.c	2008-07-08 23:55:31.000000000 +0200
@@ -128,8 +128,8 @@ static int can_create(struct net *net, s
 	if (net != &init_net)
 		return -EAFNOSUPPORT;
 
-#ifdef CONFIG_KMOD
-	/* try to load protocol module, when CONFIG_KMOD is defined */
+#ifdef CONFIG_MODULES
+	/* try to load protocol module kernel is modular */
 	if (!proto_tab[protocol]) {
 		err = request_module("can-proto-%d", protocol);
 
--- linux-next.orig/net/core/dev.c	2008-07-08 23:47:41.000000000 +0200
+++ linux-next/net/core/dev.c	2008-07-08 23:55:31.000000000 +0200
@@ -4704,8 +4704,6 @@ EXPORT_SYMBOL(br_fdb_get_hook);
 EXPORT_SYMBOL(br_fdb_put_hook);
 #endif
 
-#ifdef CONFIG_KMOD
 EXPORT_SYMBOL(dev_load);
-#endif
 
 EXPORT_PER_CPU_SYMBOL(softnet_data);
--- linux-next.orig/net/core/rtnetlink.c	2008-07-08 23:47:41.000000000 +0200
+++ linux-next/net/core/rtnetlink.c	2008-07-08 23:55:31.000000000 +0200
@@ -1025,7 +1025,7 @@ static int rtnl_newlink(struct sk_buff *
 	struct nlattr *linkinfo[IFLA_INFO_MAX+1];
 	int err;
 
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 replay:
 #endif
 	err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy);
@@ -1114,7 +1114,7 @@ replay:
 			return -EOPNOTSUPP;
 
 		if (!ops) {
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 			if (kind[0]) {
 				__rtnl_unlock();
 				request_module("rtnl-link-%s", kind);
--- linux-next.orig/net/dccp/ccid.c	2008-07-08 23:47:41.000000000 +0200
+++ linux-next/net/dccp/ccid.c	2008-07-08 23:55:31.000000000 +0200
@@ -154,7 +154,7 @@ struct ccid *ccid_new(unsigned char id, 
 	struct ccid *ccid = NULL;
 
 	ccids_read_lock();
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 	if (ccids[id] == NULL) {
 		/* We only try to load if in process context */
 		ccids_read_unlock();
--- linux-next.orig/net/decnet/dn_dev.c	2008-07-08 23:47:41.000000000 +0200
+++ linux-next/net/decnet/dn_dev.c	2008-07-08 23:55:31.000000000 +0200
@@ -490,9 +490,7 @@ int dn_dev_ioctl(unsigned int cmd, void 
 		return -EFAULT;
 	ifr->ifr_name[IFNAMSIZ-1] = 0;
 
-#ifdef CONFIG_KMOD
 	dev_load(&init_net, ifr->ifr_name);
-#endif
 
 	switch(cmd) {
 		case SIOCGIFADDR:
--- linux-next.orig/net/ipv4/devinet.c	2008-07-08 23:47:41.000000000 +0200
+++ linux-next/net/ipv4/devinet.c	2008-07-08 23:55:31.000000000 +0200
@@ -613,9 +613,7 @@ int devinet_ioctl(struct net *net, unsig
 	if (colon)
 		*colon = 0;
 
-#ifdef CONFIG_KMOD
 	dev_load(net, ifr.ifr_name);
-#endif
 
 	switch (cmd) {
 	case SIOCGIFADDR:	/* Get interface address */
--- linux-next.orig/net/ipv4/inet_diag.c	2008-07-08 23:47:41.000000000 +0200
+++ linux-next/net/ipv4/inet_diag.c	2008-07-08 23:55:31.000000000 +0200
@@ -53,11 +53,9 @@ static DEFINE_MUTEX(inet_diag_table_mute
 
 static const struct inet_diag_handler *inet_diag_lock_handler(int type)
 {
-#ifdef CONFIG_KMOD
 	if (!inet_diag_table[type])
 		request_module("net-pf-%d-proto-%d-type-%d", PF_NETLINK,
 			       NETLINK_INET_DIAG, type);
-#endif
 
 	mutex_lock(&inet_diag_table_mutex);
 	if (!inet_diag_table[type])
--- linux-next.orig/net/ipv4/tcp_cong.c	2008-07-08 23:47:42.000000000 +0200
+++ linux-next/net/ipv4/tcp_cong.c	2008-07-08 23:55:31.000000000 +0200
@@ -115,7 +115,7 @@ int tcp_set_default_congestion_control(c
 
 	spin_lock(&tcp_cong_list_lock);
 	ca = tcp_ca_find(name);
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 	if (!ca && capable(CAP_SYS_MODULE)) {
 		spin_unlock(&tcp_cong_list_lock);
 
@@ -244,7 +244,7 @@ int tcp_set_congestion_control(struct so
 	if (ca == icsk->icsk_ca_ops)
 		goto out;
 
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 	/* not found attempt to autoload module */
 	if (!ca && capable(CAP_SYS_MODULE)) {
 		rcu_read_unlock();
--- linux-next.orig/net/netfilter/nfnetlink.c	2008-07-08 23:47:42.000000000 +0200
+++ linux-next/net/netfilter/nfnetlink.c	2008-07-08 23:55:31.000000000 +0200
@@ -134,7 +134,7 @@ static int nfnetlink_rcv_msg(struct sk_b
 	type = nlh->nlmsg_type;
 	ss = nfnetlink_get_subsys(type);
 	if (!ss) {
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 		nfnl_unlock();
 		request_module("nfnetlink-subsys-%d", NFNL_SUBSYS_ID(type));
 		nfnl_lock();
--- linux-next.orig/net/netlink/af_netlink.c	2008-07-08 23:47:42.000000000 +0200
+++ linux-next/net/netlink/af_netlink.c	2008-07-08 23:55:31.000000000 +0200
@@ -434,7 +434,7 @@ static int netlink_create(struct net *ne
 		return -EPROTONOSUPPORT;
 
 	netlink_lock_table();
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 	if (!nl_table[protocol].registered) {
 		netlink_unlock_table();
 		request_module("net-pf-%d-proto-%d", PF_NETLINK, protocol);
--- linux-next.orig/net/sched/act_api.c	2008-07-08 23:47:42.000000000 +0200
+++ linux-next/net/sched/act_api.c	2008-07-08 23:55:31.000000000 +0200
@@ -495,7 +495,7 @@ struct tc_action *tcf_action_init_1(stru
 
 	a_o = tc_lookup_action_n(act_name);
 	if (a_o == NULL) {
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 		rtnl_unlock();
 		request_module("act_%s", act_name);
 		rtnl_lock();
--- linux-next.orig/net/sched/cls_api.c	2008-07-08 23:47:42.000000000 +0200
+++ linux-next/net/sched/cls_api.c	2008-07-08 23:55:31.000000000 +0200
@@ -223,7 +223,7 @@ replay:
 		err = -ENOENT;
 		tp_ops = tcf_proto_lookup_ops(tca[TCA_KIND]);
 		if (tp_ops == NULL) {
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 			struct nlattr *kind = tca[TCA_KIND];
 			char name[IFNAMSIZ];
 
--- linux-next.orig/net/sched/ematch.c	2008-07-08 23:47:42.000000000 +0200
+++ linux-next/net/sched/ematch.c	2008-07-08 23:55:31.000000000 +0200
@@ -224,7 +224,7 @@ static int tcf_em_validate(struct tcf_pr
 
 		if (em->ops == NULL) {
 			err = -ENOENT;
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 			__rtnl_unlock();
 			request_module("ematch-kind-%u", em_hdr->kind);
 			rtnl_lock();
--- linux-next.orig/net/sched/sch_api.c	2008-07-08 23:47:42.000000000 +0200
+++ linux-next/net/sched/sch_api.c	2008-07-08 23:55:31.000000000 +0200
@@ -561,7 +561,7 @@ qdisc_create(struct net_device *dev, u32
 	struct Qdisc_ops *ops;
 
 	ops = qdisc_lookup_ops(kind);
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 	if (ops == NULL && kind != NULL) {
 		char name[IFNAMSIZ];
 		if (nla_strlcpy(name, kind, IFNAMSIZ) < IFNAMSIZ) {
--- linux-next.orig/net/socket.c	2008-07-08 23:47:42.000000000 +0200
+++ linux-next/net/socket.c	2008-07-08 23:55:31.000000000 +0200
@@ -1140,7 +1140,7 @@ static int __sock_create(struct net *net
 
 	sock->type = type;
 
-#if defined(CONFIG_KMOD)
+#ifdef CONFIG_MODULES
 	/* Attempt to load a protocol module if the find failed.
 	 *
 	 * 12/09/1996 Marcin: But! this makes REALLY only sense, if the user
--- linux-next.orig/net/sunrpc/auth.c	2008-07-08 23:47:42.000000000 +0200
+++ linux-next/net/sunrpc/auth.c	2008-07-08 23:55:31.000000000 +0200
@@ -83,10 +83,8 @@ rpcauth_create(rpc_authflavor_t pseudofl
 	if (flavor >= RPC_AUTH_MAXFLAVOR)
 		goto out;
 
-#ifdef CONFIG_KMOD
 	if ((ops = auth_flavors[flavor]) == NULL)
 		request_module("rpc-auth-%u", flavor);
-#endif
 	spin_lock(&rpc_authflavor_lock);
 	ops = auth_flavors[flavor];
 	if (ops == NULL || !try_module_get(ops->owner)) {
--- linux-next.orig/include/linux/netdevice.h	2008-07-08 23:47:39.000000000 +0200
+++ linux-next/include/linux/netdevice.h	2008-07-08 23:55:31.000000000 +0200
@@ -1488,8 +1488,11 @@ extern int		dev_set_allmulti(struct net_
 extern void		netdev_state_change(struct net_device *dev);
 extern void		netdev_bonding_change(struct net_device *dev);
 extern void		netdev_features_change(struct net_device *dev);
-/* Load a device via the kmod */
+#ifdef CONFIG_MODULES
 extern void		dev_load(struct net *net, const char *name);
+#else
+static inline void	dev_load(struct net *net, const char *name) {};
+#endif
 extern void		dev_mcast_init(void);
 extern int		netdev_max_backlog;
 extern int		weight_p;

-- 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH -next 09/11] remove CONFIG_KMOD from lib
  2008-07-09  8:28 [PATCH -next 00/11] remove CONFIG_KMOD Johannes Berg
                   ` (7 preceding siblings ...)
  2008-07-09  8:28 ` [PATCH -next 08/11] remove CONFIG_KMOD from net Johannes Berg
@ 2008-07-09  8:28 ` Johannes Berg
  2008-07-09  8:28 ` [PATCH -next 10/11] remove mention of CONFIG_KMOD from documentation Johannes Berg
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Johannes Berg @ 2008-07-09  8:28 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Christoph Hellwig, linux-kernel

[-- Attachment #1: 011-config-kmod-remove-lib.patch --]
[-- Type: text/plain, Size: 670 bytes --]

textsearch algorithms can be loaded, make the code depend
on CONFIG_MODULES instead of CONFIG_KMOD.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 lib/textsearch.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next.orig/lib/textsearch.c	2008-07-08 23:47:41.000000000 +0200
+++ linux-next/lib/textsearch.c	2008-07-08 23:55:34.000000000 +0200
@@ -265,7 +265,7 @@ struct ts_config *textsearch_prepare(con
 		return ERR_PTR(-EINVAL);
 
 	ops = lookup_ts_algo(algo);
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
 	/*
 	 * Why not always autoload you may ask. Some users are
 	 * in a situation where requesting a module may deadlock,

-- 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH -next 10/11] remove mention of CONFIG_KMOD from documentation
  2008-07-09  8:28 [PATCH -next 00/11] remove CONFIG_KMOD Johannes Berg
                   ` (8 preceding siblings ...)
  2008-07-09  8:28 ` [PATCH -next 09/11] remove CONFIG_KMOD from lib Johannes Berg
@ 2008-07-09  8:28 ` Johannes Berg
  2008-07-09  8:28 ` [PATCH -next 11/11] remove CONFIG_KMOD Johannes Berg
  2008-07-13 15:03 ` [PATCH -next 00/11] " Andi Kleen
  11 siblings, 0 replies; 16+ messages in thread
From: Johannes Berg @ 2008-07-09  8:28 UTC (permalink / raw)
  To: Rusty Russell
  Cc: Christoph Hellwig, linux-kernel, Randy Dunlap, Michael Kerrisk,
	linux-doc

[-- Attachment #1: 012-config-kmod-remove-doc.patch --]
[-- Type: text/plain, Size: 5828 bytes --]

Also includes a few Kconfig files (xtensa, blackfin)

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Randy Dunlap <rdunlap@xenotime.net>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: linux-doc@vger.kernel.org
---
 Documentation/filesystems/bfs.txt                     |   10 +++++-----
 Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl |    2 +-
 Documentation/telephony/ixj.txt                       |   13 +++----------
 Documentation/video4linux/w9968cf.txt                 |    3 ---
 arch/blackfin/Kconfig                                 |    4 ++--
 arch/xtensa/Kconfig                                   |    4 ++--
 6 files changed, 13 insertions(+), 23 deletions(-)

--- linux-next.orig/Documentation/filesystems/bfs.txt	2008-07-08 23:47:02.000000000 +0200
+++ linux-next/Documentation/filesystems/bfs.txt	2008-07-08 23:55:38.000000000 +0200
@@ -26,11 +26,11 @@ You can simplify mounting by just typing
 
 this will allocate the first available loopback device (and load loop.o 
 kernel module if necessary) automatically. If the loopback driver is not
-loaded automatically, make sure that your kernel is compiled with kmod 
-support (CONFIG_KMOD) enabled. Beware that umount will not
-deallocate /dev/loopN device if /etc/mtab file on your system is a
-symbolic link to /proc/mounts. You will need to do it manually using
-"-d" switch of losetup(8). Read losetup(8) manpage for more info.
+loaded automatically, make sure that you have compiled the module and
+that modprobe is functioning. Beware that umount will not deallocate
+/dev/loopN device if /etc/mtab file on your system is a symbolic link to
+/proc/mounts. You will need to do it manually using "-d" switch of
+losetup(8). Read losetup(8) manpage for more info.
 
 To create the BFS image under UnixWare you need to find out first which
 slice contains it. The command prtvtoc(1M) is your friend:
--- linux-next.orig/Documentation/telephony/ixj.txt	2008-07-08 23:47:03.000000000 +0200
+++ linux-next/Documentation/telephony/ixj.txt	2008-07-08 23:55:38.000000000 +0200
@@ -305,21 +305,14 @@ driver, like this:
 
 which will result in the needed drivers getting loaded automatically.
 
-   g.  if you are planning on using kerneld to automatically load the 
-module for you, then you need to edit /etc/conf.modules and add the 
+   g.  if you are planning on having the kernel automatically request
+the module for you, then you need to edit /etc/conf.modules and add the
 following lines:
 
 	options ixj dspio=0x340 xio=0x330 ixjdebug=0
 
 If you do this, then when you execute an application that uses the
-module kerneld will load the module for you.  Note that to do this,
-you need to have your kernel set to support kerneld.  You can check
-for this by looking at /usr/src/linux/.config and you should see this:
-
-	# Loadable module support
-	#
-	<snip>
-	CONFIG_KMOD=y
+module the kernel will request that it is loaded.
 
   h.  if you want non-root users to be able to read and write to the 
 ixj devices (this is a good idea!) you should do the following:
--- linux-next.orig/Documentation/video4linux/w9968cf.txt	2008-07-08 23:47:03.000000000 +0200
+++ linux-next/Documentation/video4linux/w9968cf.txt	2008-07-08 23:55:38.000000000 +0200
@@ -193,9 +193,6 @@ Description:     Automatic 'ovcamchip' m
 		 loads that module automatically. This action is performed as
 		 once soon as the 'w9968cf' module is loaded into memory.
 Default:         1
-Note:            The kernel must be compiled with the CONFIG_KMOD option
-		 enabled for the 'ovcamchip' module to be loaded and for
-		 this parameter to be present.
 -------------------------------------------------------------------------------
 Name:           simcams
 Type:           int
--- linux-next.orig/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl	2008-07-08 23:47:03.000000000 +0200
+++ linux-next/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl	2008-07-08 23:55:38.000000000 +0200
@@ -42,7 +42,7 @@
      <sect1><title>Device Components</title>
 !Esound/core/device.c
      </sect1>
-     <sect1><title>KMOD and Device File Entries</title>
+     <sect1><title>Module requests and Device File Entries</title>
 !Esound/core/sound.c
      </sect1>
      <sect1><title>Memory Management Helpers</title>
--- linux-next.orig/arch/blackfin/Kconfig	2008-07-08 23:47:04.000000000 +0200
+++ linux-next/arch/blackfin/Kconfig	2008-07-08 23:55:38.000000000 +0200
@@ -873,8 +873,8 @@ config HOTPLUG
 	  plugged into slots found on all modern laptop computers.  Another
 	  example, used on modern desktops as well as laptops, is USB.
 
-	  Enable HOTPLUG and KMOD, and build a modular kernel.  Get agent
-	  software (at <http://linux-hotplug.sourceforge.net/>) and install it.
+	  Enable HOTPLUG and build a modular kernel.  Get agent software
+	  (from <http://linux-hotplug.sourceforge.net/>) and install it.
 	  Then your kernel will automatically call out to a user mode "policy
 	  agent" (/sbin/hotplug) to load modules and set up software needed
 	  to use devices as you hotplug them.
--- linux-next.orig/arch/xtensa/Kconfig	2008-07-08 23:47:15.000000000 +0200
+++ linux-next/arch/xtensa/Kconfig	2008-07-08 23:55:38.000000000 +0200
@@ -194,8 +194,8 @@ config HOTPLUG
 	plugged into slots found on all modern laptop computers.  Another
 	example, used on modern desktops as well as laptops, is USB.
 
-	Enable HOTPLUG and KMOD, and build a modular kernel.  Get agent
-	software (at <http://linux-hotplug.sourceforge.net/>) and install it.
+	Enable HOTPLUG and build a modular kernel.  Get agent software
+	(from <http://linux-hotplug.sourceforge.net/>) and install it.
 	Then your kernel will automatically call out to a user mode "policy
 	agent" (/sbin/hotplug) to load modules and set up software needed
 	to use devices as you hotplug them.

-- 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH -next 11/11] remove CONFIG_KMOD
  2008-07-09  8:28 [PATCH -next 00/11] remove CONFIG_KMOD Johannes Berg
                   ` (9 preceding siblings ...)
  2008-07-09  8:28 ` [PATCH -next 10/11] remove mention of CONFIG_KMOD from documentation Johannes Berg
@ 2008-07-09  8:28 ` Johannes Berg
  2008-07-13 15:03 ` [PATCH -next 00/11] " Andi Kleen
  11 siblings, 0 replies; 16+ messages in thread
From: Johannes Berg @ 2008-07-09  8:28 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Christoph Hellwig, linux-kernel

[-- Attachment #1: 013-config-kmod-remove.patch --]
[-- Type: text/plain, Size: 580 bytes --]

Now that nothing depends on it any more, remove CONFIG_KMOD.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 init/Kconfig |    4 ----
 1 file changed, 4 deletions(-)

--- linux-next.orig/init/Kconfig	2008-07-08 23:52:17.000000000 +0200
+++ linux-next/init/Kconfig	2008-07-08 23:55:41.000000000 +0200
@@ -892,10 +892,6 @@ config MODULE_SRCVERSION_ALL
 	  the version).  With this option, such a "srcversion" field
 	  will be created for all modules.  If unsure, say N.
 
-config KMOD
-	def_bool y
-	depends on MODULES
-
 config STOP_MACHINE
 	bool
 	default y

-- 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH -next 07/11] remove CONFIG_KMOD from sound
  2008-07-09  8:28 ` [PATCH -next 07/11] remove CONFIG_KMOD from sound Johannes Berg
@ 2008-07-09 17:33   ` Takashi Iwai
  0 siblings, 0 replies; 16+ messages in thread
From: Takashi Iwai @ 2008-07-09 17:33 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Rusty Russell, Christoph Hellwig, linux-kernel

At Wed, 09 Jul 2008 10:28:41 +0200,
Johannes Berg wrote:
> 
> A bunch of things in alsa depend on CONFIG_KMOD,
> use CONFIG_MODULES instead where the dependency
> is needed at all.
> 
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
> Cc: Takashi Iwai <tiwai@suse.de>
> ---
> v2: remove #ifdef around EXPORT_SYMBOL pointed out by
>     Adrian Bunk

Thanks, applied to sound-2.6 git tree.


Takashi

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH -next 00/11] remove CONFIG_KMOD
  2008-07-09  8:28 [PATCH -next 00/11] remove CONFIG_KMOD Johannes Berg
                   ` (10 preceding siblings ...)
  2008-07-09  8:28 ` [PATCH -next 11/11] remove CONFIG_KMOD Johannes Berg
@ 2008-07-13 15:03 ` Andi Kleen
  2008-07-14  0:38   ` Rusty Russell
  2008-07-14  7:52   ` Johannes Berg
  11 siblings, 2 replies; 16+ messages in thread
From: Andi Kleen @ 2008-07-13 15:03 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Rusty Russell, Christoph Hellwig, linux-kernel

Johannes Berg <johannes@sipsolutions.net> writes:

> I've rebased this patch series against -next-20080708 (one conflict
> against ftrace, another against BKL pushdown) and fixed the things
> Adrian Bunk pointed out.

You forgot to say why you want to remove that?
 
I personally like to not set CONFIG_KMOD because the auto loader
tends to load way too many modules. e.g. currently when someone requests
aes on x86 you get three different aes modules (including VIA PadLock
aes and an unoptimized C version), and keeping those around
is just a waste. 

Also if I didn't load a driver I prefer if it's not loaded at all.
This is also useful for power saving for example where it's better
to keep modules not loaded that you don't need and it's hard to
control who accesses the respective devices.

Please keep the option.

Thanks.

-Andi


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH -next 00/11] remove CONFIG_KMOD
  2008-07-13 15:03 ` [PATCH -next 00/11] " Andi Kleen
@ 2008-07-14  0:38   ` Rusty Russell
  2008-07-14  7:52   ` Johannes Berg
  1 sibling, 0 replies; 16+ messages in thread
From: Rusty Russell @ 2008-07-14  0:38 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Johannes Berg, Christoph Hellwig, linux-kernel

On Monday 14 July 2008 01:03:02 Andi Kleen wrote:
> Johannes Berg <johannes@sipsolutions.net> writes:
> > I've rebased this patch series against -next-20080708 (one conflict
> > against ftrace, another against BKL pushdown) and fixed the things
> > Adrian Bunk pointed out.
>
> You forgot to say why you want to remove that?
>
> I personally like to not set CONFIG_KMOD because the auto loader
> tends to load way too many modules. e.g. currently when someone requests
> aes on x86 you get three different aes modules (including VIA PadLock
> aes and an unoptimized C version), and keeping those around
> is just a waste.

Well, if you're building your own kernel anyway, don't build modules you don't 
want.

> Also if I didn't load a driver I prefer if it's not loaded at all.
> This is also useful for power saving for example where it's better
> to keep modules not loaded that you don't need and it's hard to
> control who accesses the respective devices.
>
> Please keep the option.

"echo /bin/true > /proc/sys/kernel/modprobe".

Given that, I don't think the config option is useful any more.

Rusty.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH -next 00/11] remove CONFIG_KMOD
  2008-07-13 15:03 ` [PATCH -next 00/11] " Andi Kleen
  2008-07-14  0:38   ` Rusty Russell
@ 2008-07-14  7:52   ` Johannes Berg
  1 sibling, 0 replies; 16+ messages in thread
From: Johannes Berg @ 2008-07-14  7:52 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Rusty Russell, Christoph Hellwig, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1362 bytes --]

On Sun, 2008-07-13 at 17:03 +0200, Andi Kleen wrote:
> Johannes Berg <johannes@sipsolutions.net> writes:
> 
> > I've rebased this patch series against -next-20080708 (one conflict
> > against ftrace, another against BKL pushdown) and fixed the things
> > Adrian Bunk pointed out.
> 
> You forgot to say why you want to remove that?

Indeed, I did. Well for one, it's pointless. As Rusty pointed out, you
can achieve pretty much the same thing by putting /bin/true into the
modprobe path, and the option protects only very little code.

Secondly, the option has a lot of potential for misuse. A lot of people
tend to unset it because they think they can load modules manually, but
then they forget all the dependencies that aren't link-time resolvable
like crypto providers: if you request an encryption with RC4 the arc4
module will be loaded by the crypto provider code, but this isn't a
link-time dependency so modprobe cannot resolve it. We're getting bug
reports like that probably about bi-weekly or so and I suspect distros
are getting many more.
Hence, it's beneficial to remove the option, those who really do need to
turn off module autoloading can still do it at runtime which even
benefits them because it allows them finer-grained control, and others
are left with less potential to screw up their kernel config.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-07-14  7:54 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-09  8:28 [PATCH -next 00/11] remove CONFIG_KMOD Johannes Berg
2008-07-09  8:28 ` [PATCH -next 01/11] make CONFIG_KMOD invisible Johannes Berg
2008-07-09  8:28 ` [PATCH -next 02/11] remove CONFIG_KMOD from core kernel code Johannes Berg
2008-07-09  8:28 ` [PATCH -next 03/11] rework try_then_request_module to do less in non-modular kernels Johannes Berg
2008-07-09  8:28 ` [PATCH -next 04/11] remove CONFIG_KMOD from drivers Johannes Berg
2008-07-09  8:28 ` [PATCH -next 05/11] remove CONFIG_KMOD from sparc64 Johannes Berg
2008-07-09  8:28 ` [PATCH -next 06/11] remove CONFIG_KMOD from fs Johannes Berg
2008-07-09  8:28 ` [PATCH -next 07/11] remove CONFIG_KMOD from sound Johannes Berg
2008-07-09 17:33   ` Takashi Iwai
2008-07-09  8:28 ` [PATCH -next 08/11] remove CONFIG_KMOD from net Johannes Berg
2008-07-09  8:28 ` [PATCH -next 09/11] remove CONFIG_KMOD from lib Johannes Berg
2008-07-09  8:28 ` [PATCH -next 10/11] remove mention of CONFIG_KMOD from documentation Johannes Berg
2008-07-09  8:28 ` [PATCH -next 11/11] remove CONFIG_KMOD Johannes Berg
2008-07-13 15:03 ` [PATCH -next 00/11] " Andi Kleen
2008-07-14  0:38   ` Rusty Russell
2008-07-14  7:52   ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).