Skip to contentSkip to conversation

Module rewrite 11/20: Parameter Support for Modules

PATCH New Rusty Russell 1 participant 1 message Sep 25, 2002

Subsystems (14)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Module rewrite 11/20: Parameter Support for Modules

[ Linus, I chose to not to leave a "#define __setup()" stub in init.h
to break compile on unconverted code. You might want to add it. ]

Name: Parameter __setup Removal Stage 1
Author: Rusty Russell
Status: Tested on 2.5.38
Depends: Module/param.patch.gz

D: This patch replaces some of the __setup calls (it is not
D: exhaustive), so my kernel compiles again. It heavily uses
D: __PARAM_CALL where I thought backwards compatibility was vital, but
D: some of these places really need a big renaming (esp. where module
D: parameters are different).
D:
D: This patch is reasonably large because the PARAM_CALL callbacks have
D: a slightly different prototype, and return 0 on success or -errno

arch/i386/kernel/apm.c +9 -57
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/arch/i386/kernel/apm.c .26895-linux-2.5.38.updated/arch/i386/kernel/apm.c
@@ -1792,53 +1792,6 @@ static int apm(void *unused)
 	return 0;
 }
 
-#ifndef MODULE
-static int __init apm_setup(char *str)
-{
-	int	invert;
-
-	while ((str != NULL) && (*str != '\0')) {
-		if (strncmp(str, "off", 3) == 0)
-			apm_disabled = 1;
-		if (strncmp(str, "on", 2) == 0)
-			apm_disabled = 0;
-		if ((strncmp(str, "bounce-interval=", 16) == 0) ||
-		    (strncmp(str, "bounce_interval=", 16) == 0))
-			bounce_interval = simple_strtol(str + 16, NULL, 0);
-		if ((strncmp(str, "idle-threshold=", 15) == 0) ||
-		    (strncmp(str, "idle_threshold=", 15) == 0))
-			idle_threshold = simple_strtol(str + 15, NULL, 0);
-		if ((strncmp(str, "idle-period=", 12) == 0) ||
-		    (strncmp(str, "idle_period=", 12) == 0))
-			idle_period = simple_strtol(str + 12, NULL, 0);
-		invert = (strncmp(str, "no-", 3) == 0) ||
-			(strncmp(str, "no_", 3) == 0);
-		if (invert)
-			str += 3;
-		if (strncmp(str, "debug", 5) == 0)
-			debug = !invert;
-		if ((strncmp(str, "power-off", 9) == 0) ||
-		    (strncmp(str, "power_off", 9) == 0))
-			power_off = !invert;
-		if ((strncmp(str, "allow-ints", 10) == 0) ||
-		    (strncmp(str, "allow_ints", 10) == 0))
- 			apm_info.allow_ints = !invert;
-		if ((strncmp(str, "broken-psr", 10) == 0) ||
-		    (strncmp(str, "broken_psr", 10) == 0))
-			apm_info.get_power_status_broken = !invert;
-		if ((strncmp(str, "realmode-power-off", 18) == 0) ||
-		    (strncmp(str, "realmode_power_off", 18) == 0))
-			apm_info.realmode_power_off = !invert;
-		str = strchr(str, ',');
-		if (str != NULL)
-			str += strspn(str, ", \t");
-	}
-	return 1;
-}
-
-__setup("apm=", apm_setup);
-#endif
-
 static struct file_operations apm_bios_fops = {
 	.owner		= THIS_MODULE,
 	.read		= do_read,
@@ -2029,23 +1982,22 @@ module_exit(apm_exit);
 MODULE_AUTHOR("Stephen Rothwell");
 MODULE_DESCRIPTION("Advanced Power Management");
 MODULE_LICENSE("GPL");
-MODULE_PARM(debug, "i");
+PARAM(debug, bool, S_IWUSR|S_IRUGO);
 MODULE_PARM_DESC(debug, "Enable debug mode");
-MODULE_PARM(power_off, "i");
+PARAM(power_off, bool, S_IWUSR|S_IRUGO);
 MODULE_PARM_DESC(power_off, "Enable power off");
-MODULE_PARM(bounce_interval, "i");
-MODULE_PARM_DESC(bounce_interval,
-		"Set the number of ticks to ignore suspend bounces");
-MODULE_PARM(allow_ints, "i");
+PARAM(bounce_interval, int, S_IWUSR|S_IRUGO);
+MODULE_PARM_DESC(bounce_interval, "Set the number of ticks to ignore suspend bounces");
+PARAM(allow_ints, bool, S_IWUSR|S_IRUGO);
 MODULE_PARM_DESC(allow_ints, "Allow interrupts during BIOS calls");
-MODULE_PARM(broken_psr, "i");
+PARAM(broken_psr, bool, S_IWUSR|S_IRUGO);
 MODULE_PARM_DESC(broken_psr, "BIOS has a broken GetPowerStatus call");
-MODULE_PARM(realmode_power_off, "i");
+PARAM(realmode_power_off, bool, S_IWUSR|S_IRUGO);
 MODULE_PARM_DESC(realmode_power_off,
 		"Switch to real mode before powering off");
-MODULE_PARM(idle_threshold, "i");
+PARAM(idle_threshold, int, S_IWUSR|S_IRUGO);
 MODULE_PARM_DESC(idle_threshold,
 	"System idle percentage above which to make APM BIOS idle calls");
-MODULE_PARM(idle_period, "i");
+PARAM(idle_period, int, S_IWUSR|S_IRUGO);
 MODULE_PARM_DESC(idle_period,
 	"Period (in sec/100) over which to caculate the idle percentage");
arch/i386/kernel/bluesmoke.c +7 -9
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/arch/i386/kernel/bluesmoke.c .26895-linux-2.5.38.updated/arch/i386/kernel/bluesmoke.c
@@ -11,6 +11,7 @@
 #include <linux/irq.h>
 #include <linux/tqueue.h>
 #include <linux/interrupt.h>
+#include <linux/params.h>
 
 #include <asm/processor.h> 
 #include <asm/system.h>
@@ -488,20 +489,17 @@ void __init mcheck_init(struct cpuinfo_x
 	}
 }
 
-static int __init mcheck_disable(char *str)
-{
-	mce_disabled = 1;
-	return 0;
-}
-
-static int __init mcheck_enable(char *str)
+static int __init mcheck_enable(const char *str, struct kernel_param *kp)
 {
 	mce_disabled = -1;
 	return 0;
 }
 
-__setup("nomce", mcheck_disable);
-__setup("mce", mcheck_enable);
+#undef PARAM_PREFIX
+#define PARAM_PREFIX ""
+
+PARAM_NAMED(nomce, mce_disabled, bool, 000);
+PARAM_CALL(mce, mcheck_enable, NULL, NULL, 000);
 
 #else
 asmlinkage void do_machine_check(struct pt_regs * regs, long error_code) {}
arch/i386/kernel/cpu/common.c +7 -21
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/arch/i386/kernel/cpu/common.c .26895-linux-2.5.38.updated/arch/i386/kernel/cpu/common.c
@@ -2,6 +2,7 @@
 #include <linux/string.h>
 #include <linux/delay.h>
 #include <linux/smp.h>
+#include <linux/params.h>
 #include <asm/semaphore.h>
 #include <asm/processor.h>
 #include <asm/msr.h>
@@ -10,6 +11,9 @@
 
 #include "cpu.h"
 
+#undef PARAM_PREFIX
+#define PARAM_PREFIX ""
+
 static int cachesize_override __initdata = -1;
 static int disable_x86_fxsr __initdata = 0;
 
@@ -35,23 +39,12 @@ static struct cpu_dev default_cpu = {
 };
 static struct cpu_dev * this_cpu = &default_cpu;
 
-static int __init cachesize_setup(char *str)
-{
-	get_option (&str, &cachesize_override);
-	return 1;
-}
-__setup("cachesize=", cachesize_setup);
+PARAM_NAMED(cachesize, cachesize_override, int, 000);
 
 #ifndef CONFIG_X86_TSC
 static int tsc_disable __initdata = 0;
 
-static int __init tsc_setup(char *str)
-{
-	tsc_disable = 1;
-	return 1;
-}
-
-__setup("notsc", tsc_setup);
+PARAM_NAMED(notsc, tsc_disable, bool, 000);
 #endif
 
 int __init get_model_name(struct cpuinfo_x86 *c)
@@ -165,14 +158,7 @@ void __init get_cpu_vendor(struct cpuinf
 	}
 }
 
-
-static int __init x86_fxsr_setup(char * s)
-{
-	disable_x86_fxsr = 1;
-	return 1;
-}
-__setup("nofxsr", x86_fxsr_setup);
-
+PARAM_NAMED(nofxsr, disable_x86_fxsr, bool, 000);
 
 /* Standard macro to see if a specific flag is changeable */
 static inline int flag_is_changeable_p(u32 flag)
arch/i386/kernel/cpu/intel.c +3 -13
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/arch/i386/kernel/cpu/intel.c .26895-linux-2.5.38.updated/arch/i386/kernel/cpu/intel.c
@@ -3,6 +3,7 @@
 #include <linux/string.h>
 #include <linux/bitops.h>
 #include <linux/smp.h>
+#include <linux/params.h>
 #include <asm/processor.h>
 #include <asm/thread_info.h>
 #include <asm/msr.h>
@@ -77,19 +78,8 @@ static void __init squash_the_stupid_ser
 	}
 }
 
-static int __init x86_serial_nr_setup(char *s)
-{
-	disable_x86_serial_nr = 0;
-	return 1;
-}
-__setup("serialnumber", x86_serial_nr_setup);
-
-static int __init P4_disable_ht(char *s)
-{
-	disable_P4_HT = 1;
-	return 1;
-}
-__setup("noht", P4_disable_ht);
+PARAM_NAMED(serialnumber, disable_x86_serial_nr, invbool, 000);
+PARAM_NAMED(noht, disable_P4_HT, bool, 000);
 
 #define LVL_1_INST	1
 #define LVL_1_DATA	2
arch/i386/kernel/io_apic.c +5 -10
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/arch/i386/kernel/io_apic.c .26895-linux-2.5.38.updated/arch/i386/kernel/io_apic.c
@@ -31,6 +31,7 @@
 #include <linux/mc146818rtc.h>
 #include <linux/compiler.h>
 #include <linux/acpi.h>
+#include <linux/params.h>
 
 #include <asm/io.h>
 #include <asm/smp.h>
@@ -288,15 +289,9 @@ int pirq_entries [MAX_PIRQS];
 int pirqs_enabled;
 int skip_ioapic_setup;
 
-static int __init ioapic_setup(char *str)
-{
-	skip_ioapic_setup = 1;
-	return 1;
-}
-
-__setup("noapic", ioapic_setup);
+PARAM_NAMED(noapic, skip_ioapic_setup, bool, 000);
 
-static int __init ioapic_pirq_setup(char *str)
+static int __init ioapic_pirq_setup(const char *str, struct kernel_param *kp)
 {
 	int i, max;
 	int ints[MAX_PIRQS+1];
@@ -319,10 +314,10 @@ static int __init ioapic_pirq_setup(char
 		 */
 		pirq_entries[MAX_PIRQS-i-1] = ints[i+1];
 	}
-	return 1;
+	return 0;
 }
 
-__setup("pirq=", ioapic_pirq_setup);
+PARAM_CALL(pirq, ioapic_pirq_setup, NULL, NULL, 000);
 
 /*
  * Find the IRQ entry number of a certain pin.
arch/i386/kernel/nmi.c +4 -3
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/arch/i386/kernel/nmi.c .26895-linux-2.5.38.updated/arch/i386/kernel/nmi.c
@@ -20,6 +20,7 @@
 #include <linux/interrupt.h>
 #include <linux/mc146818rtc.h>
 #include <linux/kernel_stat.h>
+#include <linux/params.h>
 
 #include <asm/smp.h>
 #include <asm/mtrr.h>
@@ -102,7 +103,7 @@ int __init check_nmi_watchdog (void)
 	return 0;
 }
 
-static int __init setup_nmi_watchdog(char *str)
+static int __init setup_nmi_watchdog(const char *str, struct kernel_param *kp)
 {
 	int nmi;
 
@@ -131,10 +132,10 @@ static int __init setup_nmi_watchdog(cha
 	 */
 	if (nmi == NMI_IO_APIC)
 		nmi_watchdog = nmi;
-	return 1;
+	return 0;
 }
 
-__setup("nmi_watchdog=", setup_nmi_watchdog);
+PARAM_CALL(nmi_watchdog, setup_nmi_watchdog, NULL, NULL, 000);
 
 #ifdef CONFIG_PM
 
arch/i386/kernel/process.c +4 -3
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/arch/i386/kernel/process.c .26895-linux-2.5.38.updated/arch/i386/kernel/process.c
@@ -33,6 +33,7 @@
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/mc146818rtc.h>
+#include <linux/params.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -143,17 +144,17 @@ void cpu_idle (void)
 	}
 }
 
-static int __init idle_setup (char *str)
+static int __init idle_setup (const char *str, struct kernel_param *kp)
 {
 	if (!strncmp(str, "poll", 4)) {
 		printk("using polling idle threads.\n");
 		pm_idle = poll_idle;
 	}
 
-	return 1;
+	return 0;
 }
 
-__setup("idle=", idle_setup);
+__PARAM_CALL("", idle, idle_setup, NULL, NULL, 000);
 
 extern void show_trace(unsigned long* esp);
 
arch/i386/kernel/reboot.c +4 -3
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/arch/i386/kernel/reboot.c .26895-linux-2.5.38.updated/arch/i386/kernel/reboot.c
@@ -25,6 +25,7 @@
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/mc146818rtc.h>
+#include <linux/params.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -56,7 +57,7 @@ static int reboot_cpu = -1;
 /* shamelessly grabbed from lib/vsprintf.c for readability */
 #define is_digit(c)	((c) >= '0' && (c) <= '9')
 #endif
-static int __init reboot_setup(char *str)
+static int __init reboot_setup(const char *str, struct kernel_param *kp)
 {
 	while(1) {
 		switch (*str) {
@@ -91,10 +92,10 @@ static int __init reboot_setup(char *str
 		else
 			break;
 	}
-	return 1;
+	return 0;
 }
 
-__setup("reboot=", reboot_setup);
+__PARAM_CALL("", reboot, reboot_setup, NULL, NULL, 000);
 
 /* The following code and data reboots the machine by switching to real
    mode and jumping to the BIOS reset entry point, as if the CPU has
arch/i386/kernel/setup.c +5 -3
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/arch/i386/kernel/setup.c .26895-linux-2.5.38.updated/arch/i386/kernel/setup.c
@@ -34,6 +34,7 @@
 #include <linux/console.h>
 #include <linux/root_dev.h>
 #include <linux/highmem.h>
+#include <linux/params.h>
 #include <asm/e820.h>
 #include <asm/mpspec.h>
 #include <asm/setup.h>
@@ -893,13 +894,14 @@ void __init setup_arch(char **cmdline_p)
 	dmi_scan_machine();
 }
 
-static int __init highio_setup(char *str)
+static int __init highio_setup(const char *str, struct kernel_param *kp)
 {
 	printk("i386: disabling HIGHMEM block I/O\n");
 	blk_nohighio = 1;
-	return 1;
+	return 0;
 }
-__setup("nohighio", highio_setup);
+
+__PARAM_CALL("", nohighio, highio_setup, NULL, NULL, 000);
  
 
 #include "setup_arch_post.h"
arch/i386/pci/common.c +2 -2
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/arch/i386/pci/common.c .26895-linux-2.5.38.updated/arch/i386/pci/common.c
@@ -138,7 +138,7 @@ static int __init pcibios_init(void)
 
 subsys_initcall(pcibios_init);
 
-char * __devinit  pcibios_setup(char *str)
+char * __devinit  pcibios_setup(const char *str)
 {
 	if (!strcmp(str, "off")) {
 		pci_probe = 0;
@@ -191,7 +191,7 @@ char * __devinit  pcibios_setup(char *st
 		pcibios_last_bus = simple_strtol(str+8, NULL, 0);
 		return NULL;
 	}
-	return str;
+	return (char *)str;
 }
 
 unsigned int pcibios_assign_all_busses(void)
drivers/block/loop.c +4 -12
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/drivers/block/loop.c .26895-linux-2.5.38.updated/drivers/block/loop.c
@@ -76,6 +76,7 @@
 #include <linux/suspend.h>
 #include <linux/writeback.h>
 #include <linux/buffer_head.h>		/* for invalidate_bdev() */
+#include <linux/params.h>
 
 #include <asm/uaccess.h>
 
@@ -964,9 +965,6 @@ static struct block_device_operations lo
 /*
  * And now the modules code and kernel interface.
  */
-MODULE_PARM(max_loop, "i");
-MODULE_PARM_DESC(max_loop, "Maximum number of loop devices (1-256)");
-MODULE_LICENSE("GPL");
 
 int loop_register_transfer(struct loop_func_table *funcs)
 {
@@ -1078,12 +1076,6 @@ void loop_exit(void) 
 module_init(loop_init);
 module_exit(loop_exit);
 
-#ifndef MODULE
-static int __init max_loop_setup(char *str)
-{
-	max_loop = simple_strtol(str, NULL, 0);
-	return 1;
-}
-
-__setup("max_loop=", max_loop_setup);
-#endif
+PARAM(max_loop, int, 000);
+MODULE_PARM_DESC(max_loop, "Maximum number of loop devices (1-256)");
+MODULE_LICENSE("GPL");
drivers/char/lp.c +7 -4
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/drivers/char/lp.c .26895-linux-2.5.38.updated/drivers/char/lp.c
@@ -126,6 +126,7 @@
 #include <linux/delay.h>
 #include <linux/poll.h>
 #include <linux/console.h>
+#include <linux/params.h>
 
 #include <linux/parport.h>
 #undef LP_STATS
@@ -759,7 +760,7 @@ MODULE_PARM(parport, "1-" __MODULE_STRIN
 MODULE_PARM(reset, "i");
 
 #ifndef MODULE
-static int __init lp_setup (char *str)
+static int __init lp_setup (const char *str, struct kernel_param *kp)
 {
 	static int parport_ptr; // initially zero
 	int x;
@@ -770,7 +771,7 @@ static int __init lp_setup (char *str)
 			parport_nr[0] = LP_PARPORT_OFF;
 		} else {
 			printk(KERN_WARNING "warning: 'lp=0x%x' is deprecated, ignored\n", x);
-			return 0;
+			return -EINVAL;
 		}
 	} else if (!strncmp(str, "parport", 7)) {
 		int n = simple_strtoul(str+7, NULL, 10);
@@ -786,8 +787,11 @@ static int __init lp_setup (char *str)
 	} else if (!strcmp(str, "reset")) {
 		reset = 1;
 	}
-	return 1;
+	return 0;
 }
+
+/* just "lp=" for backwards compat. */
+__PARAM_CALL("", lp, lp_setup, NULL, NULL, 000);
 #endif
 
 static int lp_register(int nr, struct parport *port)
@@ -973,7 +977,6 @@ static void lp_cleanup_module (void)
 	}
 }
 
-__setup("lp=", lp_setup);
 module_init(lp_init_module);
 module_exit(lp_cleanup_module);
 
drivers/ide/ide.c +77 -88

297 lines not on this page · raw message

drivers/parport/init.c +10 -9
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/drivers/parport/init.c .26895-linux-2.5.38.updated/drivers/parport/init.c
@@ -17,6 +17,7 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/init.h>
+#include <linux/params.h>
 
 #ifndef MODULE
 static int io[PARPORT_MAX+1] __initdata = { [0 ... PARPORT_MAX] = 0 };
@@ -44,7 +45,7 @@ static int parport_setup_ptr __initdata 
  *
  * IRQ/DMA may be numeric or 'auto' or 'none'
  */
-static int __init parport_setup (char *str)
+static int __init parport_setup(const char *str, struct kernel_param *kp)
 {
 	char *endptr;
 	char *sep;
@@ -53,24 +54,24 @@ static int __init parport_setup (char *s
 	if (!str || !*str || (*str == '0' && !*(str+1))) {
 		/* Disable parport if "parport=0" in cmdline */
 		io[0] = PARPORT_DISABLE;
-		return 1;
+		return 0;
 	}
 
 	if (!strncmp (str, "auto", 4)) {
 		irq[0] = PARPORT_IRQ_AUTO;
 		dma[0] = PARPORT_DMA_AUTO;
-		return 1;
+		return 0;
 	}
 
 	val = simple_strtoul (str, &endptr, 0);
 	if (endptr == str) {
 		printk (KERN_WARNING "parport=%s not understood\n", str);
-		return 1;
+		return 0;
 	}
 
 	if (parport_setup_ptr == PARPORT_MAX) {
 		printk(KERN_ERR "parport=%s ignored, too many ports\n", str);
-		return 1;
+		return 0;
 	}
 	
 	io[parport_setup_ptr] = val;
@@ -87,7 +88,7 @@ static int __init parport_setup (char *s
 				printk (KERN_WARNING
 					"parport=%s: irq not understood\n",
 					str);
-				return 1;
+				return 0;
 			}
 			irq[parport_setup_ptr] = val;
 		}
@@ -105,17 +106,17 @@ static int __init parport_setup (char *s
 				printk (KERN_WARNING
 					"parport=%s: dma not understood\n",
 					str);
-				return 1;
+				return -EINVAL;
 			}
 			dma[parport_setup_ptr] = val;
 		}
 	}
 
 	parport_setup_ptr++;
-	return 1;
+	return 0;
 }
 
-__setup ("parport=", parport_setup);
+PARAM_CALL(parport, parport_setup, NULL, NULL, 0);
 
 #endif
 
drivers/pci/pci.c +4 -3
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/drivers/pci/pci.c .26895-linux-2.5.38.updated/drivers/pci/pci.c
@@ -14,6 +14,7 @@
 #include <linux/pci.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
+#include <linux/params.h>
 #include <asm/dma.h>	/* isa_dma_bridge_buggy */
 
 #undef DEBUG
@@ -623,7 +624,7 @@ static int __devinit pci_init(void)
 	return 0;
 }
 
-static int __devinit pci_setup(char *str)
+static int __devinit pci_setup(const char *str, struct kernel_param *kp)
 {
 	while (str) {
 		char *k = strchr(str, ',');
@@ -635,12 +636,12 @@ static int __devinit pci_setup(char *str
 		}
 		str = k;
 	}
-	return 1;
+	return 0;
 }
 
 device_initcall(pci_init);
 
-__setup("pci=", pci_setup);
+__PARAM_CALL("", pci, pci_setup, NULL, NULL, 000);
 
 EXPORT_SYMBOL(pci_enable_device);
 EXPORT_SYMBOL(pci_disable_device);
drivers/video/vgacon.c +5 -4
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/drivers/video/vgacon.c .26895-linux-2.5.38.updated/drivers/video/vgacon.c
@@ -50,6 +50,7 @@
 #include <linux/spinlock.h>
 #include <linux/ioport.h>
 #include <linux/init.h>
+#include <linux/params.h>
 
 #include <asm/io.h>
 
@@ -119,18 +120,18 @@ static int	       vga_video_font_height;
 static unsigned int    vga_rolled_over = 0;
 
 
-static int __init no_scroll(char *str)
+static int __init no_scroll(const char *str, struct kernel_param *kp)
 {
 	/*
 	 * Disabling scrollback is required for the Braillex ib80-piezo
 	 * Braille reader made by F.H. Papenmeier (Germany).
-	 * Use the "no-scroll" bootflag.
+	 * Use the "vgacon.no-scroll" bootflag.
 	 */
 	vga_hardscroll_user_enable = vga_hardscroll_enabled = 0;
-	return 1;
+	return 0;
 }
 
-__setup("no-scroll", no_scroll);
+PARAM_CALL(no_scroll, no_scroll, NULL, NULL, 000);
 
 /*
  * By replacing the four outb_p with two back to back outw, we can reduce
fs/devfs/base.c +4 -3
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/fs/devfs/base.c .26895-linux-2.5.38.updated/fs/devfs/base.c
@@ -671,6 +671,7 @@
 #include <linux/smp.h>
 #include <linux/version.h>
 #include <linux/rwsem.h>
+#include <linux/params.h>
 
 #include <asm/uaccess.h>
 #include <asm/io.h>
@@ -2247,7 +2248,7 @@ int devfs_only (void)
  *	@str: The boot options after the "devfs=".
  */
 
-static int __init devfs_setup (char *str)
+static int __init devfs_setup (const char *str, struct kernel_param *kp)
 {
     static struct
     {
@@ -2303,10 +2304,10 @@ static int __init devfs_setup (char *str
 	if (*str != ',') return 0;  /*  No more options  */
 	++str;
     }
-    return 1;
+    return 0;
 }   /*  End Function devfs_setup  */
 
-__setup("devfs=", devfs_setup);
+__PARAM_CALL("", devfs, devfs_setup, NULL, NULL, 000);
 
 EXPORT_SYMBOL(devfs_put);
 EXPORT_SYMBOL(devfs_register);
fs/lockd/svc.c +2 -15
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/fs/lockd/svc.c .26895-linux-2.5.38.updated/fs/lockd/svc.c
@@ -332,22 +332,9 @@ cleanup_module(void)
 	nlm_shutdown_hosts();
 }
 #else
-/* not a module, so process bootargs
- * lockd.udpport and lockd.tcpport
- */
 
-static int __init udpport_set(char *str)
-{
-	nlm_udpport = simple_strtoul(str, NULL, 0);
-	return 1;
-}
-static int __init tcpport_set(char *str)
-{
-	nlm_tcpport = simple_strtoul(str, NULL, 0);
-	return 1;
-}
-__setup("lockd.udpport=", udpport_set);
-__setup("lockd.tcpport=", tcpport_set);
+PARAM_NAMED(udpport, nlm_udpport, long, 000);
+PARAM_NAMED(tcpport, nlm_tcpport, long, 000);
 
 #endif
 
fs/nfs/nfsroot.c +3 -3
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/fs/nfs/nfsroot.c .26895-linux-2.5.38.updated/fs/nfs/nfsroot.c
@@ -334,7 +334,7 @@ int __init root_nfs_init(void)
  *  Parse NFS server and directory information passed on the kernel
  *  command line.
  */
-int __init nfs_root_setup(char *line)
+int __init nfs_root_setup(char *line, struct kernel_param *kp)
 {
 	ROOT_DEV = Root_NFS;
 	if (line[0] == '/' || line[0] == ',' || (line[0] >= '0' && line[0] <= '9')) {
@@ -347,10 +347,10 @@ int __init nfs_root_setup(char *line)
 		sprintf(nfs_root_name, NFS_ROOT, line);
 	}
 	root_nfs_parse_addr(nfs_root_name);
-	return 1;
+	return 0;
 }
 
-__setup("nfsroot=", nfs_root_setup);
+__PARAM_CALL("", nfsroot, nfs_root_setup, NULL, NULL, 000);
 
 /***************************************************************************
 
fs/partitions/efi.c +1 -8
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/fs/partitions/efi.c .26895-linux-2.5.38.updated/fs/partitions/efi.c
@@ -113,14 +113,7 @@
  * the partition tables happens after init too.
  */
 static int force_gpt;
-static int __init
-force_gpt_fn(char *str)
-{
-	force_gpt = 1;
-	return 1;
-}
-__setup("gpt", force_gpt_fn);
-
+PARAM_NAMED(gpt, force_gpt, bool, 000);
 
 /**
  * efi_crc32() - EFI version of crc32 function
include/asm-i386/bugs.h +11 -15
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/include/asm-i386/bugs.h .26895-linux-2.5.38.updated/include/asm-i386/bugs.h
@@ -22,34 +22,30 @@
 
 #include <linux/config.h>
 #include <linux/init.h>
+#include <linux/params.h>
 #include <asm/processor.h>
 #include <asm/i387.h>
 #include <asm/msr.h>
 
-static int __init no_halt(char *s)
+/* We want top level for backwards compat. */
+#undef PARAM_PREFIX
+#define PARAM_PREFIX ""
+static int __init no_halt(const char *s, struct kernel_param *kp)
 {
 	boot_cpu_data.hlt_works_ok = 0;
-	return 1;
-}
-
-__setup("no-hlt", no_halt);
-
-static int __init mca_pentium(char *s)
-{
-	mca_pentium_flag = 1;
-	return 1;
+	return 0;
 }
+PARAM_CALL(no_hlt, no_halt, NULL, NULL, 000);
+PARAM_NAMED(mca_pentium, mca_pentium_flag, bool, 000);
 
-__setup("mca-pentium", mca_pentium);
-
-static int __init no_387(char *s)
+static int __init no_387(const char *s, struct kernel_param *kp)
 {
 	boot_cpu_data.hard_math = 0;
 	write_cr0(0xE | read_cr0());
-	return 1;
+	return 0;
 }
 
-__setup("no387", no_387);
+PARAM_CALL(no387, no_387, NULL, NULL, 000);
 
 static double __initdata x = 4195835.0;
 static double __initdata y = 3145727.0;
include/linux/init.h +0 -14
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/include/linux/init.h .26895-linux-2.5.38.updated/include/linux/init.h
@@ -73,20 +73,6 @@ extern initcall_t __initcall_start, __in
 #define __exitcall(fn)								\
 	static exitcall_t __exitcall_##fn __exit_call = fn
 
-/*
- * Used for kernel command line parameter setup
- */
-struct kernel_param {
-	const char *str;
-	int (*setup_func)(char *);
-};
-
-extern struct kernel_param __setup_start, __setup_end;
-
-#define __setup(str, fn)								\
-	static char __setup_str_##fn[] __initdata = str;				\
-	static struct kernel_param __setup_##fn __attribute__((unused)) __initsetup = { __setup_str_##fn, fn }
-
 #endif /* __ASSEMBLY__ */
 
 /*
include/linux/netdevice.h +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/include/linux/netdevice.h .26895-linux-2.5.38.updated/include/linux/netdevice.h
@@ -458,7 +458,7 @@ extern struct net_device		loopback_dev;	
 extern struct net_device		*dev_base;		/* All devices */
 extern rwlock_t				dev_base_lock;		/* Device list lock */
 
-extern int			netdev_boot_setup_add(char *name, struct ifmap *map);
+extern int			netdev_boot_setup_add(const char *name, struct ifmap *map);
 extern int 			netdev_boot_setup_check(struct net_device *dev);
 extern struct net_device    *dev_getbyhwaddr(unsigned short type, char *hwaddr);
 extern void		dev_add_pack(struct packet_type *pt);
include/linux/pci.h +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/include/linux/pci.h .26895-linux-2.5.38.updated/include/linux/pci.h
@@ -508,7 +508,7 @@ struct pci_driver {
 
 void pcibios_fixup_bus(struct pci_bus *);
 int pcibios_enable_device(struct pci_dev *, int mask);
-char *pcibios_setup (char *str);
+char *pcibios_setup (const char *str);
 
 /* Used only when drivers/pci/setup.c is used */
 void pcibios_align_resource(void *, struct resource *,
include/linux/security.h +1 -0
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/include/linux/security.h .26895-linux-2.5.38.updated/include/linux/security.h
@@ -655,6 +655,7 @@ struct swap_info_struct;
  * This is the main security structure.
  */
 struct security_operations {
+	struct module *owner;
 	int (*ptrace) (struct task_struct * parent, struct task_struct * child);
 	int (*capget) (struct task_struct * target,
 		       kernel_cap_t * effective,
init/do_mounts.c +26 -50

135 lines not on this page · raw message

init/main.c +19 -47

99 lines not on this page · raw message

kernel/panic.c +2 -7
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/kernel/panic.c .26895-linux-2.5.38.updated/kernel/panic.c
@@ -16,6 +16,7 @@
 #include <linux/init.h>
 #include <linux/sysrq.h>
 #include <linux/interrupt.h>
+#include <linux/params.h>
 
 asmlinkage void sys_sync(void);	/* it's really int */
 
@@ -23,13 +24,7 @@ int panic_timeout;
 
 struct notifier_block *panic_notifier_list;
 
-static int __init panic_setup(char *str)
-{
-	panic_timeout = simple_strtoul(str, NULL, 0);
-	return 1;
-}
-
-__setup("panic=", panic_setup);
+PARAM_NAMED(timeout, panic_timeout, int, 0640);
 
 /**
  *	panic - halt the system
kernel/printk.c +5 -4
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/kernel/printk.c .26895-linux-2.5.38.updated/kernel/printk.c
@@ -27,6 +27,7 @@
 #include <linux/config.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
+#include <linux/params.h>
 
 #include <asm/uaccess.h>
 
@@ -99,7 +100,7 @@ static int console_may_schedule;
 /*
  *	Setup a list of consoles. Called from init/main.c
  */
-static int __init console_setup(char *str)
+static int __init console_setup(const char *str, struct kernel_param *kp)
 {
 	struct console_cmdline *c;
 	char name[sizeof(c->name)];
@@ -140,16 +141,16 @@ static int __init console_setup(char *st
 				return 1;
 		}
 	if (i == MAX_CMDLINECONSOLES)
-		return 1;
+		return 0;
 	preferred_console = i;
 	c = &console_cmdline[i];
 	memcpy(c->name, name, sizeof(c->name));
 	c->options = options;
 	c->index = idx;
-	return 1;
+	return 0;
 }
 
-__setup("console=", console_setup);
+__PARAM_CALL("", console, console_setup, NULL, NULL, 000);
 
 /*
  * Commands to do_syslog:
kernel/resource.c +6 -3
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/kernel/resource.c .26895-linux-2.5.38.updated/kernel/resource.c
@@ -13,6 +13,7 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
+#include <linux/params.h>
 #include <asm/io.h>
 
 struct resource ioport_resource = { "PCI IO", 0x0000, IO_SPACE_LIMIT, IORESOURCE_IO };
@@ -297,7 +298,7 @@ void __release_region(struct resource *p
  * Called from init/main.c to reserve IO ports.
  */
 #define MAXRESERVE 4
-static int __init reserve_setup(char *str)
+static int __init reserve_setup(const char *str, struct kernel_param *kp)
 {
 	static int reserved = 0;
 	static struct resource reserve[MAXRESERVE];
@@ -321,7 +322,9 @@ static int __init reserve_setup(char *st
 				reserved = x+1;
 		}
 	}
-	return 1;
+	return 0;
 }
 
-__setup("reserve=", reserve_setup);
+#undef PARAM_PREFIX
+#define PARAM_PREFIX ""
+PARAM_CALL(reserve, reserve_setup, NULL, NULL, 000);
kernel/suspend.c +7 -7
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/kernel/suspend.c .26895-linux-2.5.38.updated/kernel/suspend.c
@@ -1221,28 +1221,28 @@ read_failure:
 	return;
 }
 
-static int __init resume_setup(char *str)
+static int __init resume_setup(char *str, struct kernel_param *kp)
 {
 	if(resume_status)
-		return 1;
+		return 0;
 
 	strncpy( resume_file, str, 255 );
 	resume_status = RESUME_SPECIFIED;
 
-	return 1;
+	return 0;
 }
 
-static int __init software_noresume(char *str)
+static int __init software_noresume(char *str, struct kernel_param *kp)
 {
 	if(!resume_status)
 		printk(KERN_WARNING "noresume option lacks a resume= option\n");
 	resume_status = NORESUME;
 	
-	return 1;
+	return 0;
 }
 
-__setup("noresume", software_noresume);
-__setup("resume=", resume_setup);
+PARAM_CALL(noresume, software_noresume, NULL, NULL, 000);
+PARAM_CALL(resume, resume_setup, NULL, NULL, 000);
 
 EXPORT_SYMBOL(software_suspend);
 EXPORT_SYMBOL(software_suspend_enabled);
mm/page_alloc.c +4 -3
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/mm/page_alloc.c .26895-linux-2.5.38.updated/mm/page_alloc.c
@@ -24,6 +24,7 @@
 #include <linux/suspend.h>
 #include <linux/pagevec.h>
 #include <linux/blkdev.h>
+#include <linux/params.h>
 
 unsigned long totalram_pages;
 unsigned long totalhigh_pages;
@@ -949,7 +950,7 @@ void __init free_area_init(unsigned long
 }
 #endif
 
-static int __init setup_mem_frac(char *str)
+static int __init setup_mem_frac(const char *str, struct kernel_param *kp)
 {
 	int j = 0;
 
@@ -957,7 +958,7 @@ static int __init setup_mem_frac(char *s
 	printk("setup_mem_frac: ");
 	for (j = 0; j < MAX_NR_ZONES; j++) printk("%d  ", zone_balance_ratio[j]);
 	printk("\n");
-	return 1;
+	return 0;
 }
 
-__setup("memfrac=", setup_mem_frac);
+__PARAM_CALL("", memfrac, setup_mem_frac, NULL, NULL, 000);
net/core/dev.c +6 -4
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/net/core/dev.c .26895-linux-2.5.38.updated/net/core/dev.c
@@ -105,6 +105,7 @@
 #include <linux/init.h>
 #include <linux/kmod.h>
 #include <linux/module.h>
+#include <linux/params.h>
 #if defined(CONFIG_NET_RADIO) || defined(CONFIG_NET_PCMCIA_RADIO)
 #include <linux/wireless.h>		/* Note : will define WIRELESS_EXT */
 #include <net/iw_handler.h>
@@ -316,7 +317,7 @@ static struct netdev_boot_setup dev_boot
  *	returns 0 on error and 1 on success.  This is a generic routine to
  *	all netdevices.
  */
-int netdev_boot_setup_add(char *name, struct ifmap *map)
+int netdev_boot_setup_add(const char *name, struct ifmap *map)
 {
 	struct netdev_boot_setup *s;
 	int i;
@@ -331,7 +332,7 @@ int netdev_boot_setup_add(char *name, st
 		}
 	}
 
-	return i >= NETDEV_BOOT_SETUP_MAX ? 0 : 1;
+	return i >= NETDEV_BOOT_SETUP_MAX ? -ENOSPC : 0;
 }
 
 /**
@@ -364,7 +365,7 @@ int netdev_boot_setup_check(struct net_d
 /*
  * Saves at boot time configured settings for any netdevice.
  */
-int __init netdev_boot_setup(char *str)
+int __init netdev_boot_setup(const char *str, struct kernel_param *kp)
 {
 	int ints[5];
 	struct ifmap map;
@@ -388,7 +389,8 @@ int __init netdev_boot_setup(char *str)
 	return netdev_boot_setup_add(str, &map);
 }
 
-__setup("netdev=", netdev_boot_setup);
+/* We want top level for backwards compat. */
+__PARAM_CALL("", netdev, netdev_boot_setup, NULL, NULL, 000);
 
 /*******************************************************************************
 
net/ethernet/eth.c +4 -2
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/net/ethernet/eth.c .26895-linux-2.5.38.updated/net/ethernet/eth.c
@@ -52,6 +52,7 @@
 #include <linux/errno.h>
 #include <linux/config.h>
 #include <linux/init.h>
+#include <linux/params.h>
 #include <net/dst.h>
 #include <net/arp.h>
 #include <net/sock.h>
@@ -61,9 +62,10 @@
 #include <asm/system.h>
 #include <asm/checksum.h>
 
-extern int __init netdev_boot_setup(char *str);
+extern int __init netdev_boot_setup(const char *str, struct kernel_param *kp);
 
-__setup("ether=", netdev_boot_setup);
+/* We want top level for backwards compat. */
+__PARAM_CALL("", ether, netdev_boot_setup, NULL, NULL, 000);
 
 /*
  *	 Create the Ethernet MAC header for an arbitrary protocol layer 
net/ipv4/ipconfig.c +10 -6
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26895-linux-2.5.38/net/ipv4/ipconfig.c .26895-linux-2.5.38.updated/net/ipv4/ipconfig.c
@@ -1320,7 +1320,7 @@ static int __init ic_proto_name(char *na
 	return 0;
 }
 
-static int __init ip_auto_config_setup(char *addrs)
+static int __init ip_auto_config_setup(char *addrs, struct kernel_param *kp)
 {
 	char *cp, *ip, *dp;
 	int num = 0;
@@ -1331,10 +1331,10 @@ static int __init ip_auto_config_setup(c
 		(strcmp(addrs, "off") != 0) && 
 		(strcmp(addrs, "none") != 0));
 	if (!ic_enable)
-		return 1;
+		return 0;
 
 	if (ic_proto_name(addrs))
-		return 1;
+		return 0;
 
 	/* Parse the whole string */
 	ip = addrs;
@@ -1383,7 +1383,7 @@ static int __init ip_auto_config_setup(c
 		num++;
 	}
 
-	return 1;
+	return 0;
 }
 
 static int __init nfsaddrs_config_setup(char *addrs)
@@ -1391,5 +1391,9 @@ static int __init nfsaddrs_config_setup(
 	return ip_auto_config_setup(addrs);
 }
 
-__setup("ip=", ip_auto_config_setup);
-__setup("nfsaddrs=", nfsaddrs_config_setup);
+/* We want top level for backwards compat. */
+#undef PARAM_PREFIX
+#define PARAM_PREFIX ""
+
+PARAM_CALL(ip, ip_auto_config_setup, NULL, NULL, 000);
+PARAM_CALL(nfsaddrs, nfsaddrs_config_setup, NULL, NULL, 000);

--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.