edac: convert sysdev_class to a regular subsystem
After all sysdev classes are ported to regular driver core entities, the sysdev implementation will be entirely removed from the kernel. Cc: Doug Thompson <dougthompson@xmission.com> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Lucas De Marchi <lucas.demarchi@profusion.mobi> Cc: Borislav Petkov <borislav.petkov@amd.com> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
		
					parent
					
						
							
								997d3eaf02
							
						
					
				
			
			
				commit
				
					
						fe5ff8b84c
					
				
			
		
					 11 changed files with 53 additions and 59 deletions
				
			
		| 
						 | 
					@ -32,7 +32,6 @@
 | 
				
			||||||
#include <linux/completion.h>
 | 
					#include <linux/completion.h>
 | 
				
			||||||
#include <linux/kobject.h>
 | 
					#include <linux/kobject.h>
 | 
				
			||||||
#include <linux/platform_device.h>
 | 
					#include <linux/platform_device.h>
 | 
				
			||||||
#include <linux/sysdev.h>
 | 
					 | 
				
			||||||
#include <linux/workqueue.h>
 | 
					#include <linux/workqueue.h>
 | 
				
			||||||
#include <linux/edac.h>
 | 
					#include <linux/edac.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -243,8 +242,8 @@ struct edac_device_ctl_info {
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	struct edac_dev_sysfs_attribute *sysfs_attributes;
 | 
						struct edac_dev_sysfs_attribute *sysfs_attributes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* pointer to main 'edac' class in sysfs */
 | 
						/* pointer to main 'edac' subsys in sysfs */
 | 
				
			||||||
	struct sysdev_class *edac_class;
 | 
						struct bus_type *edac_subsys;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* the internal state of this controller instance */
 | 
						/* the internal state of this controller instance */
 | 
				
			||||||
	int op_state;
 | 
						int op_state;
 | 
				
			||||||
| 
						 | 
					@ -342,7 +341,7 @@ struct edac_pci_ctl_info {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int pci_idx;
 | 
						int pci_idx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct sysdev_class *edac_class;	/* pointer to class */
 | 
						struct bus_type *edac_subsys;	/* pointer to subsystem */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* the internal state of this controller instance */
 | 
						/* the internal state of this controller instance */
 | 
				
			||||||
	int op_state;
 | 
						int op_state;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,7 +23,6 @@
 | 
				
			||||||
#include <linux/jiffies.h>
 | 
					#include <linux/jiffies.h>
 | 
				
			||||||
#include <linux/spinlock.h>
 | 
					#include <linux/spinlock.h>
 | 
				
			||||||
#include <linux/list.h>
 | 
					#include <linux/list.h>
 | 
				
			||||||
#include <linux/sysdev.h>
 | 
					 | 
				
			||||||
#include <linux/ctype.h>
 | 
					#include <linux/ctype.h>
 | 
				
			||||||
#include <linux/workqueue.h>
 | 
					#include <linux/workqueue.h>
 | 
				
			||||||
#include <asm/uaccess.h>
 | 
					#include <asm/uaccess.h>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * file for managing the edac_device class of devices for EDAC
 | 
					 * file for managing the edac_device subsystem of devices for EDAC
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * (C) 2007 SoftwareBitMaker 
 | 
					 * (C) 2007 SoftwareBitMaker 
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
| 
						 | 
					@ -230,21 +230,21 @@ static struct kobj_type ktype_device_ctrl = {
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev)
 | 
					int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct sysdev_class *edac_class;
 | 
						struct bus_type *edac_subsys;
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	debugf1("%s()\n", __func__);
 | 
						debugf1("%s()\n", __func__);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* get the /sys/devices/system/edac reference */
 | 
						/* get the /sys/devices/system/edac reference */
 | 
				
			||||||
	edac_class = edac_get_sysfs_class();
 | 
						edac_subsys = edac_get_sysfs_subsys();
 | 
				
			||||||
	if (edac_class == NULL) {
 | 
						if (edac_subsys == NULL) {
 | 
				
			||||||
		debugf1("%s() no edac_class error\n", __func__);
 | 
							debugf1("%s() no edac_subsys error\n", __func__);
 | 
				
			||||||
		err = -ENODEV;
 | 
							err = -ENODEV;
 | 
				
			||||||
		goto err_out;
 | 
							goto err_out;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Point to the 'edac_class' this instance 'reports' to */
 | 
						/* Point to the 'edac_subsys' this instance 'reports' to */
 | 
				
			||||||
	edac_dev->edac_class = edac_class;
 | 
						edac_dev->edac_subsys = edac_subsys;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Init the devices's kobject */
 | 
						/* Init the devices's kobject */
 | 
				
			||||||
	memset(&edac_dev->kobj, 0, sizeof(struct kobject));
 | 
						memset(&edac_dev->kobj, 0, sizeof(struct kobject));
 | 
				
			||||||
| 
						 | 
					@ -261,7 +261,7 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* register */
 | 
						/* register */
 | 
				
			||||||
	err = kobject_init_and_add(&edac_dev->kobj, &ktype_device_ctrl,
 | 
						err = kobject_init_and_add(&edac_dev->kobj, &ktype_device_ctrl,
 | 
				
			||||||
				   &edac_class->kset.kobj,
 | 
									   &edac_subsys->dev_root->kobj,
 | 
				
			||||||
				   "%s", edac_dev->name);
 | 
									   "%s", edac_dev->name);
 | 
				
			||||||
	if (err) {
 | 
						if (err) {
 | 
				
			||||||
		debugf1("%s()Failed to register '.../edac/%s'\n",
 | 
							debugf1("%s()Failed to register '.../edac/%s'\n",
 | 
				
			||||||
| 
						 | 
					@ -284,7 +284,7 @@ err_kobj_reg:
 | 
				
			||||||
	module_put(edac_dev->owner);
 | 
						module_put(edac_dev->owner);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
err_mod_get:
 | 
					err_mod_get:
 | 
				
			||||||
	edac_put_sysfs_class();
 | 
						edac_put_sysfs_subsys();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
err_out:
 | 
					err_out:
 | 
				
			||||||
	return err;
 | 
						return err;
 | 
				
			||||||
| 
						 | 
					@ -308,7 +308,7 @@ void edac_device_unregister_sysfs_main_kobj(struct edac_device_ctl_info *dev)
 | 
				
			||||||
	 *   b) 'kfree' the memory
 | 
						 *   b) 'kfree' the memory
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	kobject_put(&dev->kobj);
 | 
						kobject_put(&dev->kobj);
 | 
				
			||||||
	edac_put_sysfs_class();
 | 
						edac_put_sysfs_subsys();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* edac_dev -> instance information */
 | 
					/* edac_dev -> instance information */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,7 +25,6 @@
 | 
				
			||||||
#include <linux/jiffies.h>
 | 
					#include <linux/jiffies.h>
 | 
				
			||||||
#include <linux/spinlock.h>
 | 
					#include <linux/spinlock.h>
 | 
				
			||||||
#include <linux/list.h>
 | 
					#include <linux/list.h>
 | 
				
			||||||
#include <linux/sysdev.h>
 | 
					 | 
				
			||||||
#include <linux/ctype.h>
 | 
					#include <linux/ctype.h>
 | 
				
			||||||
#include <linux/edac.h>
 | 
					#include <linux/edac.h>
 | 
				
			||||||
#include <asm/uaccess.h>
 | 
					#include <asm/uaccess.h>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1021,19 +1021,19 @@ void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci)
 | 
				
			||||||
int edac_sysfs_setup_mc_kset(void)
 | 
					int edac_sysfs_setup_mc_kset(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int err = -EINVAL;
 | 
						int err = -EINVAL;
 | 
				
			||||||
	struct sysdev_class *edac_class;
 | 
						struct bus_type *edac_subsys;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	debugf1("%s()\n", __func__);
 | 
						debugf1("%s()\n", __func__);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* get the /sys/devices/system/edac class reference */
 | 
						/* get the /sys/devices/system/edac subsys reference */
 | 
				
			||||||
	edac_class = edac_get_sysfs_class();
 | 
						edac_subsys = edac_get_sysfs_subsys();
 | 
				
			||||||
	if (edac_class == NULL) {
 | 
						if (edac_subsys == NULL) {
 | 
				
			||||||
		debugf1("%s() no edac_class error=%d\n", __func__, err);
 | 
							debugf1("%s() no edac_subsys error=%d\n", __func__, err);
 | 
				
			||||||
		goto fail_out;
 | 
							goto fail_out;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Init the MC's kobject */
 | 
						/* Init the MC's kobject */
 | 
				
			||||||
	mc_kset = kset_create_and_add("mc", NULL, &edac_class->kset.kobj);
 | 
						mc_kset = kset_create_and_add("mc", NULL, &edac_subsys->dev_root->kobj);
 | 
				
			||||||
	if (!mc_kset) {
 | 
						if (!mc_kset) {
 | 
				
			||||||
		err = -ENOMEM;
 | 
							err = -ENOMEM;
 | 
				
			||||||
		debugf1("%s() Failed to register '.../edac/mc'\n", __func__);
 | 
							debugf1("%s() Failed to register '.../edac/mc'\n", __func__);
 | 
				
			||||||
| 
						 | 
					@ -1045,7 +1045,7 @@ int edac_sysfs_setup_mc_kset(void)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fail_kset:
 | 
					fail_kset:
 | 
				
			||||||
	edac_put_sysfs_class();
 | 
						edac_put_sysfs_subsys();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fail_out:
 | 
					fail_out:
 | 
				
			||||||
	return err;
 | 
						return err;
 | 
				
			||||||
| 
						 | 
					@ -1059,6 +1059,6 @@ fail_out:
 | 
				
			||||||
void edac_sysfs_teardown_mc_kset(void)
 | 
					void edac_sysfs_teardown_mc_kset(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	kset_unregister(mc_kset);
 | 
						kset_unregister(mc_kset);
 | 
				
			||||||
	edac_put_sysfs_class();
 | 
						edac_put_sysfs_subsys();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,8 +10,6 @@
 | 
				
			||||||
#ifndef	__EDAC_MODULE_H__
 | 
					#ifndef	__EDAC_MODULE_H__
 | 
				
			||||||
#define	__EDAC_MODULE_H__
 | 
					#define	__EDAC_MODULE_H__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <linux/sysdev.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "edac_core.h"
 | 
					#include "edac_core.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,7 +19,6 @@
 | 
				
			||||||
#include <linux/slab.h>
 | 
					#include <linux/slab.h>
 | 
				
			||||||
#include <linux/spinlock.h>
 | 
					#include <linux/spinlock.h>
 | 
				
			||||||
#include <linux/list.h>
 | 
					#include <linux/list.h>
 | 
				
			||||||
#include <linux/sysdev.h>
 | 
					 | 
				
			||||||
#include <linux/ctype.h>
 | 
					#include <linux/ctype.h>
 | 
				
			||||||
#include <linux/workqueue.h>
 | 
					#include <linux/workqueue.h>
 | 
				
			||||||
#include <asm/uaccess.h>
 | 
					#include <asm/uaccess.h>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -338,12 +338,12 @@ static struct kobj_type ktype_edac_pci_main_kobj = {
 | 
				
			||||||
 * edac_pci_main_kobj_setup()
 | 
					 * edac_pci_main_kobj_setup()
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *	setup the sysfs for EDAC PCI attributes
 | 
					 *	setup the sysfs for EDAC PCI attributes
 | 
				
			||||||
 *	assumes edac_class has already been initialized
 | 
					 *	assumes edac_subsys has already been initialized
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static int edac_pci_main_kobj_setup(void)
 | 
					static int edac_pci_main_kobj_setup(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
	struct sysdev_class *edac_class;
 | 
						struct bus_type *edac_subsys;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	debugf0("%s()\n", __func__);
 | 
						debugf0("%s()\n", __func__);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -354,9 +354,9 @@ static int edac_pci_main_kobj_setup(void)
 | 
				
			||||||
	/* First time, so create the main kobject and its
 | 
						/* First time, so create the main kobject and its
 | 
				
			||||||
	 * controls and attributes
 | 
						 * controls and attributes
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	edac_class = edac_get_sysfs_class();
 | 
						edac_subsys = edac_get_sysfs_subsys();
 | 
				
			||||||
	if (edac_class == NULL) {
 | 
						if (edac_subsys == NULL) {
 | 
				
			||||||
		debugf1("%s() no edac_class\n", __func__);
 | 
							debugf1("%s() no edac_subsys\n", __func__);
 | 
				
			||||||
		err = -ENODEV;
 | 
							err = -ENODEV;
 | 
				
			||||||
		goto decrement_count_fail;
 | 
							goto decrement_count_fail;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -381,7 +381,7 @@ static int edac_pci_main_kobj_setup(void)
 | 
				
			||||||
	/* Instanstiate the pci object */
 | 
						/* Instanstiate the pci object */
 | 
				
			||||||
	err = kobject_init_and_add(edac_pci_top_main_kobj,
 | 
						err = kobject_init_and_add(edac_pci_top_main_kobj,
 | 
				
			||||||
				   &ktype_edac_pci_main_kobj,
 | 
									   &ktype_edac_pci_main_kobj,
 | 
				
			||||||
				   &edac_class->kset.kobj, "pci");
 | 
									   &edac_subsys->dev_root->kobj, "pci");
 | 
				
			||||||
	if (err) {
 | 
						if (err) {
 | 
				
			||||||
		debugf1("Failed to register '.../edac/pci'\n");
 | 
							debugf1("Failed to register '.../edac/pci'\n");
 | 
				
			||||||
		goto kobject_init_and_add_fail;
 | 
							goto kobject_init_and_add_fail;
 | 
				
			||||||
| 
						 | 
					@ -404,7 +404,7 @@ kzalloc_fail:
 | 
				
			||||||
	module_put(THIS_MODULE);
 | 
						module_put(THIS_MODULE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
mod_get_fail:
 | 
					mod_get_fail:
 | 
				
			||||||
	edac_put_sysfs_class();
 | 
						edac_put_sysfs_subsys();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
decrement_count_fail:
 | 
					decrement_count_fail:
 | 
				
			||||||
	/* if are on this error exit, nothing to tear down */
 | 
						/* if are on this error exit, nothing to tear down */
 | 
				
			||||||
| 
						 | 
					@ -432,7 +432,7 @@ static void edac_pci_main_kobj_teardown(void)
 | 
				
			||||||
			__func__);
 | 
								__func__);
 | 
				
			||||||
		kobject_put(edac_pci_top_main_kobj);
 | 
							kobject_put(edac_pci_top_main_kobj);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	edac_put_sysfs_class();
 | 
						edac_put_sysfs_subsys();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,7 +26,7 @@ EXPORT_SYMBOL_GPL(edac_handlers);
 | 
				
			||||||
int edac_err_assert = 0;
 | 
					int edac_err_assert = 0;
 | 
				
			||||||
EXPORT_SYMBOL_GPL(edac_err_assert);
 | 
					EXPORT_SYMBOL_GPL(edac_err_assert);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static atomic_t edac_class_valid = ATOMIC_INIT(0);
 | 
					static atomic_t edac_subsys_valid = ATOMIC_INIT(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * called to determine if there is an EDAC driver interested in
 | 
					 * called to determine if there is an EDAC driver interested in
 | 
				
			||||||
| 
						 | 
					@ -54,36 +54,37 @@ EXPORT_SYMBOL_GPL(edac_atomic_assert_error);
 | 
				
			||||||
 * sysfs object: /sys/devices/system/edac
 | 
					 * sysfs object: /sys/devices/system/edac
 | 
				
			||||||
 *	need to export to other files
 | 
					 *	need to export to other files
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct sysdev_class edac_class = {
 | 
					struct bus_type edac_subsys = {
 | 
				
			||||||
	.name = "edac",
 | 
						.name = "edac",
 | 
				
			||||||
 | 
						.dev_name = "edac",
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
EXPORT_SYMBOL_GPL(edac_class);
 | 
					EXPORT_SYMBOL_GPL(edac_subsys);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* return pointer to the 'edac' node in sysfs */
 | 
					/* return pointer to the 'edac' node in sysfs */
 | 
				
			||||||
struct sysdev_class *edac_get_sysfs_class(void)
 | 
					struct bus_type *edac_get_sysfs_subsys(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int err = 0;
 | 
						int err = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (atomic_read(&edac_class_valid))
 | 
						if (atomic_read(&edac_subsys_valid))
 | 
				
			||||||
		goto out;
 | 
							goto out;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* create the /sys/devices/system/edac directory */
 | 
						/* create the /sys/devices/system/edac directory */
 | 
				
			||||||
	err = sysdev_class_register(&edac_class);
 | 
						err = subsys_system_register(&edac_subsys, NULL);
 | 
				
			||||||
	if (err) {
 | 
						if (err) {
 | 
				
			||||||
		printk(KERN_ERR "Error registering toplevel EDAC sysfs dir\n");
 | 
							printk(KERN_ERR "Error registering toplevel EDAC sysfs dir\n");
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
out:
 | 
					out:
 | 
				
			||||||
	atomic_inc(&edac_class_valid);
 | 
						atomic_inc(&edac_subsys_valid);
 | 
				
			||||||
	return &edac_class;
 | 
						return &edac_subsys;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL_GPL(edac_get_sysfs_class);
 | 
					EXPORT_SYMBOL_GPL(edac_get_sysfs_subsys);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void edac_put_sysfs_class(void)
 | 
					void edac_put_sysfs_subsys(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	/* last user unregisters it */
 | 
						/* last user unregisters it */
 | 
				
			||||||
	if (atomic_dec_and_test(&edac_class_valid))
 | 
						if (atomic_dec_and_test(&edac_subsys_valid))
 | 
				
			||||||
		sysdev_class_unregister(&edac_class);
 | 
							bus_unregister(&edac_subsys);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL_GPL(edac_put_sysfs_class);
 | 
					EXPORT_SYMBOL_GPL(edac_put_sysfs_subsys);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,7 +11,6 @@
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <linux/kobject.h>
 | 
					#include <linux/kobject.h>
 | 
				
			||||||
#include <linux/sysdev.h>
 | 
					 | 
				
			||||||
#include <linux/edac.h>
 | 
					#include <linux/edac.h>
 | 
				
			||||||
#include <linux/module.h>
 | 
					#include <linux/module.h>
 | 
				
			||||||
#include <asm/mce.h>
 | 
					#include <asm/mce.h>
 | 
				
			||||||
| 
						 | 
					@ -116,14 +115,14 @@ static struct edac_mce_attr *sysfs_attrs[] = { &mce_attr_status, &mce_attr_misc,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int __init edac_init_mce_inject(void)
 | 
					static int __init edac_init_mce_inject(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct sysdev_class *edac_class = NULL;
 | 
						struct bus_type *edac_subsys = NULL;
 | 
				
			||||||
	int i, err = 0;
 | 
						int i, err = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	edac_class = edac_get_sysfs_class();
 | 
						edac_subsys = edac_get_sysfs_subsys();
 | 
				
			||||||
	if (!edac_class)
 | 
						if (!edac_subsys)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mce_kobj = kobject_create_and_add("mce", &edac_class->kset.kobj);
 | 
						mce_kobj = kobject_create_and_add("mce", &edac_subsys->dev_root->kobj);
 | 
				
			||||||
	if (!mce_kobj) {
 | 
						if (!mce_kobj) {
 | 
				
			||||||
		printk(KERN_ERR "Error creating a mce kset.\n");
 | 
							printk(KERN_ERR "Error creating a mce kset.\n");
 | 
				
			||||||
		err = -ENOMEM;
 | 
							err = -ENOMEM;
 | 
				
			||||||
| 
						 | 
					@ -147,7 +146,7 @@ err_sysfs_create:
 | 
				
			||||||
	kobject_del(mce_kobj);
 | 
						kobject_del(mce_kobj);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
err_mce_kobj:
 | 
					err_mce_kobj:
 | 
				
			||||||
	edac_put_sysfs_class();
 | 
						edac_put_sysfs_subsys();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return err;
 | 
						return err;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -161,7 +160,7 @@ static void __exit edac_exit_mce_inject(void)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	kobject_del(mce_kobj);
 | 
						kobject_del(mce_kobj);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	edac_put_sysfs_class();
 | 
						edac_put_sysfs_subsys();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module_init(edac_init_mce_inject);
 | 
					module_init(edac_init_mce_inject);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,7 +13,7 @@
 | 
				
			||||||
#define _LINUX_EDAC_H_
 | 
					#define _LINUX_EDAC_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <linux/atomic.h>
 | 
					#include <linux/atomic.h>
 | 
				
			||||||
#include <linux/sysdev.h>
 | 
					#include <linux/device.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define EDAC_OPSTATE_INVAL	-1
 | 
					#define EDAC_OPSTATE_INVAL	-1
 | 
				
			||||||
#define EDAC_OPSTATE_POLL	0
 | 
					#define EDAC_OPSTATE_POLL	0
 | 
				
			||||||
| 
						 | 
					@ -23,12 +23,12 @@
 | 
				
			||||||
extern int edac_op_state;
 | 
					extern int edac_op_state;
 | 
				
			||||||
extern int edac_err_assert;
 | 
					extern int edac_err_assert;
 | 
				
			||||||
extern atomic_t edac_handlers;
 | 
					extern atomic_t edac_handlers;
 | 
				
			||||||
extern struct sysdev_class edac_class;
 | 
					extern struct bus_type edac_subsys;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern int edac_handler_set(void);
 | 
					extern int edac_handler_set(void);
 | 
				
			||||||
extern void edac_atomic_assert_error(void);
 | 
					extern void edac_atomic_assert_error(void);
 | 
				
			||||||
extern struct sysdev_class *edac_get_sysfs_class(void);
 | 
					extern struct bus_type *edac_get_sysfs_subsys(void);
 | 
				
			||||||
extern void edac_put_sysfs_class(void);
 | 
					extern void edac_put_sysfs_subsys(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline void opstate_init(void)
 | 
					static inline void opstate_init(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue