i7core_edac: Avoid printing a warning when debug is disabled
[safe/jmp/linux-2.6] / drivers / edac / edac_device_sysfs.c
index 10e5b19..0709681 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <linux/ctype.h>
 #include <linux/module.h>
+#include <linux/slab.h>
 
 #include "edac_core.h"
 #include "edac_module.h"
@@ -137,7 +138,7 @@ static ssize_t edac_dev_ctl_info_store(struct kobject *kobj,
 }
 
 /* edac_dev file operations for an 'ctl_info' */
-static struct sysfs_ops device_ctl_info_ops = {
+static const struct sysfs_ops device_ctl_info_ops = {
        .show = edac_dev_ctl_info_show,
        .store = edac_dev_ctl_info_store
 };
@@ -303,7 +304,7 @@ void edac_device_unregister_sysfs_main_kobj(
         *   a) module_put() this module
         *   b) 'kfree' the memory
         */
-       kobject_unregister(&edac_dev->kobj);
+       kobject_put(&edac_dev->kobj);
 }
 
 /* edac_dev -> instance information */
@@ -373,7 +374,7 @@ static ssize_t edac_dev_instance_store(struct kobject *kobj,
 }
 
 /* edac_dev file operations for an 'instance' */
-static struct sysfs_ops device_instance_ops = {
+static const struct sysfs_ops device_instance_ops = {
        .show = edac_dev_instance_show,
        .store = edac_dev_instance_store
 };
@@ -476,7 +477,7 @@ static ssize_t edac_dev_block_store(struct kobject *kobj,
 }
 
 /* edac_dev file operations for a 'block' */
-static struct sysfs_ops device_block_ops = {
+static const struct sysfs_ops device_block_ops = {
        .show = edac_dev_block_show,
        .store = edac_dev_block_store
 };
@@ -574,7 +575,7 @@ static int edac_device_create_block(struct edac_device_ctl_info *edac_dev,
 
        /* Error unwind stack */
 err_on_attrib:
-       kobject_unregister(&block->kobj);
+       kobject_put(&block->kobj);
 
 err_out:
        return err;
@@ -605,7 +606,7 @@ static void edac_device_delete_block(struct edac_device_ctl_info *edac_dev,
        /* unregister this block's kobject, SEE:
         *      edac_device_ctrl_block_release() callback operation
         */
-       kobject_unregister(&block->kobj);
+       kobject_put(&block->kobj);
 }
 
 /* instance ctor/dtor code */
@@ -672,7 +673,7 @@ static int edac_device_create_instance(struct edac_device_ctl_info *edac_dev,
 
        /* error unwind stack */
 err_release_instance_kobj:
-       kobject_unregister(&instance->kobj);
+       kobject_put(&instance->kobj);
 
 err_out:
        return err;
@@ -697,7 +698,7 @@ static void edac_device_delete_instance(struct edac_device_ctl_info *edac_dev,
        /* unregister this instance's kobject, SEE:
         *      edac_device_ctrl_instance_release() for callback operation
         */
-       kobject_unregister(&instance->kobj);
+       kobject_put(&instance->kobj);
 }
 
 /*