summaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_mc_sysfs.c
diff options
context:
space:
mode:
authorDouglas Thompson <dougthompson@xmission.com>2007-07-19 01:49:36 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 10:04:53 -0700
commite27e3dac651771fe3250f6305dee277bce29fc5d (patch)
tree9c0ac81a0948d8e52a72865ff9fbae4a12031a32 /drivers/edac/edac_mc_sysfs.c
parent7c9281d76c1c0b130f79d5fc021084e9749959d4 (diff)
downloadop-kernel-dev-e27e3dac651771fe3250f6305dee277bce29fc5d.zip
op-kernel-dev-e27e3dac651771fe3250f6305dee277bce29fc5d.tar.gz
drivers/edac: add edac_device class
This patch adds the new 'class' of object to be managed, named: 'edac_device'. As a peer of the 'edac_mc' class of object, it provides a non-memory centric view of an ERROR DETECTING device in hardware. It provides a sysfs interface and an abstraction for varioius EDAC type devices. Multiple 'instances' within the class are possible, with each 'instance' able to have multiple 'blocks', and each 'block' having 'attributes'. At the 'block' level there are the 'ce_count' and 'ue_count' fields which the device driver can update and/or call edac_device_handle_XX() functions. At each higher level are additional 'total' count fields, which are a summation of counts below that level. This 'edac_device' has been used to capture and present ECC errors which are found in a a L1 and L2 system on a per CORE/CPU basis. Signed-off-by: Douglas Thompson <dougthompson@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/edac/edac_mc_sysfs.c')
-rw-r--r--drivers/edac/edac_mc_sysfs.c70
1 files changed, 31 insertions, 39 deletions
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index 4a5e335..35bcf92 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -94,14 +94,6 @@ static const char *edac_caps[] = {
[EDAC_S16ECD16ED] = "S16ECD16ED"
};
-/*
- * sysfs object: /sys/devices/system/edac
- * need to export to other files in this modules
- */
-struct sysdev_class edac_class = {
- set_kset_name("edac"),
-};
-
/* sysfs object:
* /sys/devices/system/edac/mc
*/
@@ -224,43 +216,38 @@ static struct kobj_type ktype_memctrl = {
int edac_sysfs_memctrl_setup(void)
{
int err = 0;
+ struct sysdev_class *edac_class;
debugf1("%s()\n", __func__);
- /* create the /sys/devices/system/edac directory */
- err = sysdev_class_register(&edac_class);
-
- if (err) {
- debugf1("%s() error=%d\n", __func__, err);
+ /* get the /sys/devices/system/edac class reference */
+ edac_class = edac_get_edac_class();
+ if (edac_class == NULL) {
+ debugf1("%s() no edac_class error=%d\n", __func__, err);
return err;
}
/* Init the MC's kobject */
memset(&edac_memctrl_kobj, 0, sizeof (edac_memctrl_kobj));
- edac_memctrl_kobj.parent = &edac_class.kset.kobj;
+ edac_memctrl_kobj.parent = &edac_class->kset.kobj;
edac_memctrl_kobj.ktype = &ktype_memctrl;
/* generate sysfs "..../edac/mc" */
err = kobject_set_name(&edac_memctrl_kobj,"mc");
-
- if (err)
- goto fail;
+ if (err) {
+ debugf1("%s() Failed to set name '.../edac/mc'\n", __func__ );
+ return err;
+ }
/* FIXME: maybe new sysdev_create_subdir() */
err = kobject_register(&edac_memctrl_kobj);
-
if (err) {
- debugf1("Failed to register '.../edac/mc'\n");
- goto fail;
+ debugf1("%s() Failed to register '.../edac/mc'\n", __func__ );
+ return err;
}
- debugf1("Registered '.../edac/mc' kobject\n");
-
+ debugf1("%s() Registered '.../edac/mc' kobject\n",__func__);
return 0;
-
-fail:
- sysdev_class_unregister(&edac_class);
- return err;
}
/*
@@ -276,9 +263,6 @@ void edac_sysfs_memctrl_teardown(void)
init_completion(&edac_memctrl_kobj_complete);
kobject_unregister(&edac_memctrl_kobj);
wait_for_completion(&edac_memctrl_kobj_complete);
-
- /* Unregister the 'edac' object */
- sysdev_class_unregister(&edac_class);
}
@@ -286,32 +270,38 @@ void edac_sysfs_memctrl_teardown(void)
*/
/* Set of more default csrow<id> attribute show/store functions */
-static ssize_t csrow_ue_count_show(struct csrow_info *csrow, char *data, int private)
+static ssize_t csrow_ue_count_show(struct csrow_info *csrow, char *data,
+ int private)
{
return sprintf(data,"%u\n", csrow->ue_count);
}
-static ssize_t csrow_ce_count_show(struct csrow_info *csrow, char *data, int private)
+static ssize_t csrow_ce_count_show(struct csrow_info *csrow, char *data,
+ int private)
{
return sprintf(data,"%u\n", csrow->ce_count);
}
-static ssize_t csrow_size_show(struct csrow_info *csrow, char *data, int private)
+static ssize_t csrow_size_show(struct csrow_info *csrow, char *data,
+ int private)
{
return sprintf(data,"%u\n", PAGES_TO_MiB(csrow->nr_pages));
}
-static ssize_t csrow_mem_type_show(struct csrow_info *csrow, char *data, int private)
+static ssize_t csrow_mem_type_show(struct csrow_info *csrow, char *data,
+ int private)
{
return sprintf(data,"%s\n", mem_types[csrow->mtype]);
}
-static ssize_t csrow_dev_type_show(struct csrow_info *csrow, char *data, int private)
+static ssize_t csrow_dev_type_show(struct csrow_info *csrow, char *data,
+ int private)
{
return sprintf(data,"%s\n", dev_types[csrow->dtype]);
}
-static ssize_t csrow_edac_mode_show(struct csrow_info *csrow, char *data, int private)
+static ssize_t csrow_edac_mode_show(struct csrow_info *csrow, char *data,
+ int private)
{
return sprintf(data,"%s\n", edac_caps[csrow->edac_mode]);
}
@@ -509,9 +499,10 @@ static int edac_create_channel_files(struct kobject *kobj, int chan)
if (!err) {
/* create the CE Count attribute file */
err = sysfs_create_file(kobj,
- (struct attribute *) dynamic_csrow_ce_count_attr[chan]);
+ (struct attribute *)dynamic_csrow_ce_count_attr[chan]);
} else {
- debugf1("%s() dimm labels and ce_count files created", __func__);
+ debugf1("%s() dimm labels and ce_count files created",
+ __func__);
}
return err;
@@ -643,7 +634,7 @@ static ssize_t mci_sdram_scrub_rate_show(struct mem_ctl_info *mci, char *data)
} else {
/* FIXME: produce "not implemented" ERROR for user-side. */
edac_printk(KERN_WARNING, EDAC_MC,
- "Memory scrubbing 'get' control is not implemented!\n");
+ "Memory scrubbing 'get' control is not implemented\n");
}
return sprintf(data, "%d\n", bandwidth);
}
@@ -755,7 +746,8 @@ MCIDEV_ATTR(ue_count,S_IRUGO,mci_ue_count_show,NULL);
MCIDEV_ATTR(ce_count,S_IRUGO,mci_ce_count_show,NULL);
/* memory scrubber attribute file */
-MCIDEV_ATTR(sdram_scrub_rate,S_IRUGO|S_IWUSR,mci_sdram_scrub_rate_show,mci_sdram_scrub_rate_store);
+MCIDEV_ATTR(sdram_scrub_rate,S_IRUGO|S_IWUSR,mci_sdram_scrub_rate_show,\
+ mci_sdram_scrub_rate_store);
static struct mcidev_attribute *mci_attr[] = {
&mci_attr_reset_counters,
OpenPOWER on IntegriCloud