fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / kernel / params.c
index c76ad25..718945d 100644 (file)
@@ -15,7 +15,6 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
-#include <linux/config.h>
 #include <linux/moduleparam.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
@@ -31,7 +30,7 @@
 #define DEBUGP(fmt, a...)
 #endif
 
-static inline int dash2underscore(char c)
+static inline char dash2underscore(char c)
 {
        if (c == '-')
                return '_';
@@ -144,9 +143,15 @@ int parse_args(const char *name,
 
        while (*args) {
                int ret;
+               int irq_was_disabled;
 
                args = next_arg(args, &param, &val);
+               irq_was_disabled = irqs_disabled();
                ret = parse_one(param, val, params, num, unknown);
+               if (irq_was_disabled && !irqs_disabled()) {
+                       printk(KERN_WARNING "parse_args(): option '%s' enabled "
+                                       "irq's!\n", param);
+               }
                switch (ret) {
                case -ENOENT:
                        printk(KERN_ERR "%s: Unknown parameter `%s'\n",
@@ -265,12 +270,12 @@ int param_get_invbool(char *buffer, struct kernel_param *kp)
 }
 
 /* We cheat here and temporarily mangle the string. */
-int param_array(const char *name,
-               const char *val,
-               unsigned int min, unsigned int max,
-               void *elem, int elemsize,
-               int (*set)(const char *, struct kernel_param *kp),
-               int *num)
+static int param_array(const char *name,
+                      const char *val,
+                      unsigned int min, unsigned int max,
+                      void *elem, int elemsize,
+                      int (*set)(const char *, struct kernel_param *kp),
+                      int *num)
 {
        int ret;
        struct kernel_param kp;
@@ -548,6 +553,7 @@ static void __init kernel_param_sysfs_setup(const char *name,
                                            unsigned int name_skip)
 {
        struct module_kobject *mk;
+       int ret;
 
        mk = kzalloc(sizeof(struct module_kobject), GFP_KERNEL);
        BUG_ON(!mk);
@@ -555,7 +561,8 @@ static void __init kernel_param_sysfs_setup(const char *name,
        mk->mod = THIS_MODULE;
        kobj_set_kset_s(mk, module_subsys);
        kobject_set_name(&mk->kobj, name);
-       kobject_register(&mk->kobj);
+       ret = kobject_register(&mk->kobj);
+       BUG_ON(ret < 0);
 
        /* no need to keep the kobject if no parameter is exported */
        if (!param_sysfs_setup(mk, kparam, num_params, name_skip)) {
@@ -638,13 +645,8 @@ static ssize_t module_attr_show(struct kobject *kobj,
        if (!attribute->show)
                return -EIO;
 
-       if (!try_module_get(mk->mod))
-               return -ENODEV;
-
        ret = attribute->show(attribute, mk->mod, buf);
 
-       module_put(mk->mod);
-
        return ret;
 }
 
@@ -662,13 +664,8 @@ static ssize_t module_attr_store(struct kobject *kobj,
        if (!attribute->store)
                return -EIO;
 
-       if (!try_module_get(mk->mod))
-               return -ENODEV;
-
        ret = attribute->store(attribute, mk->mod, buf, len);
 
-       module_put(mk->mod);
-
        return ret;
 }
 
@@ -695,13 +692,20 @@ decl_subsys(module, &module_ktype, NULL);
  */
 static int __init param_sysfs_init(void)
 {
-       subsystem_register(&module_subsys);
+       int ret;
+
+       ret = subsystem_register(&module_subsys);
+       if (ret < 0) {
+               printk(KERN_WARNING "%s (%d): subsystem_register error: %d\n",
+                       __FILE__, __LINE__, ret);
+               return ret;
+       }
 
        param_sysfs_builtin();
 
        return 0;
 }
-__initcall(param_sysfs_init);
+subsys_initcall(param_sysfs_init);
 
 EXPORT_SYMBOL(param_set_byte);
 EXPORT_SYMBOL(param_get_byte);