aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2006-03-25 06:07:05 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-25 11:22:52 -0500
commit8d3b33f67fdc0fb364a1ef6d8fbbea7c2e4e6c98 (patch)
tree7fc48e7544ea6a6c6a7cc7685612a38f5edc25ae /kernel
parentc721bccece2b3abca4f7b0b95108e68b78445cec (diff)
[PATCH] Remove MODULE_PARM
MODULE_PARM was actually breaking: recent gcc version optimize them out as unused. It's time to replace the last users, which are generally in the most unloved drivers anyway. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/module.c183
-rw-r--r--kernel/rcutorture.c10
2 files changed, 16 insertions, 177 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 54623c714bba..ddfe45ac2fd1 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -233,24 +233,6 @@ static unsigned long __find_symbol(const char *name,
233 return 0; 233 return 0;
234} 234}
235 235
236/* Find a symbol in this elf symbol table */
237static unsigned long find_local_symbol(Elf_Shdr *sechdrs,
238 unsigned int symindex,
239 const char *strtab,
240 const char *name)
241{
242 unsigned int i;
243 Elf_Sym *sym = (void *)sechdrs[symindex].sh_addr;
244
245 /* Search (defined) internal symbols first. */
246 for (i = 1; i < sechdrs[symindex].sh_size/sizeof(*sym); i++) {
247 if (sym[i].st_shndx != SHN_UNDEF
248 && strcmp(name, strtab + sym[i].st_name) == 0)
249 return sym[i].st_value;
250 }
251 return 0;
252}
253
254/* Search for module by name: must hold module_mutex. */ 236/* Search for module by name: must hold module_mutex. */
255static struct module *find_module(const char *name) 237static struct module *find_module(const char *name)
256{ 238{
@@ -785,139 +767,6 @@ static struct module_attribute *modinfo_attrs[] = {
785 NULL, 767 NULL,
786}; 768};
787 769
788#ifdef CONFIG_OBSOLETE_MODPARM
789/* Bounds checking done below */
790static int obsparm_copy_string(const char *val, struct kernel_param *kp)
791{
792 strcpy(kp->arg, val);
793 return 0;
794}
795
796static int set_obsolete(const char *val, struct kernel_param *kp)
797{
798 unsigned int min, max;
799 unsigned int size, maxsize;
800 int dummy;
801 char *endp;
802 const char *p;
803 struct obsolete_modparm *obsparm = kp->arg;
804
805 if (!val) {
806 printk(KERN_ERR "Parameter %s needs an argument\n", kp->name);
807 return -EINVAL;
808 }
809
810 /* type is: [min[-max]]{b,h,i,l,s} */
811 p = obsparm->type;
812 min = simple_strtol(p, &endp, 10);
813 if (endp == obsparm->type)
814 min = max = 1;
815 else if (*endp == '-') {
816 p = endp+1;
817 max = simple_strtol(p, &endp, 10);
818 } else
819 max = min;
820 switch (*endp) {
821 case 'b':
822 return param_array(kp->name, val, min, max, obsparm->addr,
823 1, param_set_byte, &dummy);
824 case 'h':
825 return param_array(kp->name, val, min, max, obsparm->addr,
826 sizeof(short), param_set_short, &dummy);
827 case 'i':
828 return param_array(kp->name, val, min, max, obsparm->addr,
829 sizeof(int), param_set_int, &dummy);
830 case 'l':
831 return param_array(kp->name, val, min, max, obsparm->addr,
832 sizeof(long), param_set_long, &dummy);
833 case 's':
834 return param_array(kp->name, val, min, max, obsparm->addr,
835 sizeof(char *), param_set_charp, &dummy);
836
837 case 'c':
838 /* Undocumented: 1-5c50 means 1-5 strings of up to 49 chars,
839 and the decl is "char xxx[5][50];" */
840 p = endp+1;
841 maxsize = simple_strtol(p, &endp, 10);
842 /* We check lengths here (yes, this is a hack). */
843 p = val;
844 while (p[size = strcspn(p, ",")]) {
845 if (size >= maxsize)
846 goto oversize;
847 p += size+1;
848 }
849 if (size >= maxsize)
850 goto oversize;
851 return param_array(kp->name, val, min, max, obsparm->addr,
852 maxsize, obsparm_copy_string, &dummy);
853 }
854 printk(KERN_ERR "Unknown obsolete parameter type %s\n", obsparm->type);
855 return -EINVAL;
856 oversize:
857 printk(KERN_ERR
858 "Parameter %s doesn't fit in %u chars.\n", kp->name, maxsize);
859 return -EINVAL;
860}
861
862static int obsolete_params(const char *name,
863 char *args,
864 struct obsolete_modparm obsparm[],
865 unsigned int num,
866 Elf_Shdr *sechdrs,
867 unsigned int symindex,
868 const char *strtab)
869{
870 struct kernel_param *kp;
871 unsigned int i;
872 int ret;
873
874 kp = kmalloc(sizeof(kp[0]) * num, GFP_KERNEL);
875 if (!kp)
876 return -ENOMEM;
877
878 for (i = 0; i < num; i++) {
879 char sym_name[128 + sizeof(MODULE_SYMBOL_PREFIX)];
880
881 snprintf(sym_name, sizeof(sym_name), "%s%s",
882 MODULE_SYMBOL_PREFIX, obsparm[i].name);
883
884 kp[i].name = obsparm[i].name;
885 kp[i].perm = 000;
886 kp[i].set = set_obsolete;
887 kp[i].get = NULL;
888 obsparm[i].addr
889 = (void *)find_local_symbol(sechdrs, symindex, strtab,
890 sym_name);
891 if (!obsparm[i].addr) {
892 printk("%s: falsely claims to have parameter %s\n",
893 name, obsparm[i].name);
894 ret = -EINVAL;
895 goto out;
896 }
897 kp[i].arg = &obsparm[i];
898 }
899
900 ret = parse_args(name, args, kp, num, NULL);
901 out:
902 kfree(kp);
903 return ret;
904}
905#else
906static int obsolete_params(const char *name,
907 char *args,
908 struct obsolete_modparm obsparm[],
909 unsigned int num,
910 Elf_Shdr *sechdrs,
911 unsigned int symindex,
912 const char *strtab)
913{
914 if (num != 0)
915 printk(KERN_WARNING "%s: Ignoring obsolete parameters\n",
916 name);
917 return 0;
918}
919#endif /* CONFIG_OBSOLETE_MODPARM */
920
921static const char vermagic[] = VERMAGIC_STRING; 770static const char vermagic[] = VERMAGIC_STRING;
922 771
923#ifdef CONFIG_MODVERSIONS 772#ifdef CONFIG_MODVERSIONS
@@ -1874,27 +1723,17 @@ static struct module *load_module(void __user *umod,
1874 set_fs(old_fs); 1723 set_fs(old_fs);
1875 1724
1876 mod->args = args; 1725 mod->args = args;
1877 if (obsparmindex) { 1726 if (obsparmindex)
1878 err = obsolete_params(mod->name, mod->args, 1727 printk(KERN_WARNING "%s: Ignoring obsolete parameters\n",
1879 (struct obsolete_modparm *) 1728 mod->name);
1880 sechdrs[obsparmindex].sh_addr, 1729
1881 sechdrs[obsparmindex].sh_size 1730 /* Size of section 0 is 0, so this works well if no params */
1882 / sizeof(struct obsolete_modparm), 1731 err = parse_args(mod->name, mod->args,
1883 sechdrs, symindex, 1732 (struct kernel_param *)
1884 (char *)sechdrs[strindex].sh_addr); 1733 sechdrs[setupindex].sh_addr,
1885 if (setupindex) 1734 sechdrs[setupindex].sh_size
1886 printk(KERN_WARNING "%s: Ignoring new-style " 1735 / sizeof(struct kernel_param),
1887 "parameters in presence of obsolete ones\n", 1736 NULL);
1888 mod->name);
1889 } else {
1890 /* Size of section 0 is 0, so this works well if no params */
1891 err = parse_args(mod->name, mod->args,
1892 (struct kernel_param *)
1893 sechdrs[setupindex].sh_addr,
1894 sechdrs[setupindex].sh_size
1895 / sizeof(struct kernel_param),
1896 NULL);
1897 }
1898 if (err < 0) 1737 if (err < 0)
1899 goto arch_cleanup; 1738 goto arch_cleanup;
1900 1739
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
index 9a1fa8894b95..b4b362b5baf5 100644
--- a/kernel/rcutorture.c
+++ b/kernel/rcutorture.c
@@ -54,15 +54,15 @@ static int verbose; /* Print more debug info. */
54static int test_no_idle_hz; /* Test RCU's support for tickless idle CPUs. */ 54static int test_no_idle_hz; /* Test RCU's support for tickless idle CPUs. */
55static int shuffle_interval = 5; /* Interval between shuffles (in sec)*/ 55static int shuffle_interval = 5; /* Interval between shuffles (in sec)*/
56 56
57MODULE_PARM(nreaders, "i"); 57module_param(nreaders, int, 0);
58MODULE_PARM_DESC(nreaders, "Number of RCU reader threads"); 58MODULE_PARM_DESC(nreaders, "Number of RCU reader threads");
59MODULE_PARM(stat_interval, "i"); 59module_param(stat_interval, int, 0);
60MODULE_PARM_DESC(stat_interval, "Number of seconds between stats printk()s"); 60MODULE_PARM_DESC(stat_interval, "Number of seconds between stats printk()s");
61MODULE_PARM(verbose, "i"); 61module_param(verbose, bool, 0);
62MODULE_PARM_DESC(verbose, "Enable verbose debugging printk()s"); 62MODULE_PARM_DESC(verbose, "Enable verbose debugging printk()s");
63MODULE_PARM(test_no_idle_hz, "i"); 63module_param(test_no_idle_hz, bool, 0);
64MODULE_PARM_DESC(test_no_idle_hz, "Test support for tickless idle CPUs"); 64MODULE_PARM_DESC(test_no_idle_hz, "Test support for tickless idle CPUs");
65MODULE_PARM(shuffle_interval, "i"); 65module_param(shuffle_interval, int, 0);
66MODULE_PARM_DESC(shuffle_interval, "Number of seconds between shuffles"); 66MODULE_PARM_DESC(shuffle_interval, "Number of seconds between shuffles");
67#define TORTURE_FLAG "rcutorture: " 67#define TORTURE_FLAG "rcutorture: "
68#define PRINTK_STRING(s) \ 68#define PRINTK_STRING(s) \