]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/params.c
kset: convert /sys/module to use kset_create
[linux-2.6-omap-h63xx.git] / kernel / params.c
index 2a4c51487e7257e1865ae33d805a22e3dbb7f9ae..97e092312155b406634579af4942d38ff81a2d8b 100644 (file)
@@ -560,7 +560,8 @@ static void __init kernel_param_sysfs_setup(const char *name,
        BUG_ON(!mk);
 
        mk->mod = THIS_MODULE;
-       kobj_set_kset_s(mk, module_subsys);
+       mk->kobj.kset = module_kset;
+       mk->kobj.ktype = &module_ktype;
        kobject_set_name(&mk->kobj, name);
        kobject_init(&mk->kobj);
        ret = kobject_add(&mk->kobj);
@@ -679,8 +680,6 @@ static struct sysfs_ops module_sysfs_ops = {
        .store = module_attr_store,
 };
 
-static struct kobj_type module_ktype;
-
 static int uevent_filter(struct kset *kset, struct kobject *kobj)
 {
        struct kobj_type *ktype = get_ktype(kobj);
@@ -694,11 +693,21 @@ static struct kset_uevent_ops module_uevent_ops = {
        .filter = uevent_filter,
 };
 
-decl_subsys(module, &module_ktype, &module_uevent_ops);
+struct kset *module_kset;
 int module_sysfs_initialized;
 
-static struct kobj_type module_ktype = {
+static void module_release(struct kobject *kobj)
+{
+       /*
+        * Stupid empty release function to allow the memory for the kobject to
+        * be properly cleaned up.  This will not need to be present for 2.6.25
+        * with the upcoming kobject core rework.
+        */
+}
+
+struct kobj_type module_ktype = {
        .sysfs_ops =    &module_sysfs_ops,
+       .release =      module_release,
 };
 
 /*
@@ -706,13 +715,11 @@ static struct kobj_type module_ktype = {
  */
 static int __init param_sysfs_init(void)
 {
-       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;
+       module_kset = kset_create_and_add("module", &module_uevent_ops, NULL);
+       if (!module_kset) {
+               printk(KERN_WARNING "%s (%d): error creating kset\n",
+                       __FILE__, __LINE__);
+               return -ENOMEM;
        }
        module_sysfs_initialized = 1;
 
@@ -722,14 +729,7 @@ static int __init param_sysfs_init(void)
 }
 subsys_initcall(param_sysfs_init);
 
-#else
-#if 0
-static struct sysfs_ops module_sysfs_ops = {
-       .show = NULL,
-       .store = NULL,
-};
-#endif
-#endif
+#endif /* CONFIG_SYSFS */
 
 EXPORT_SYMBOL(param_set_byte);
 EXPORT_SYMBOL(param_get_byte);