diff options
author | Douglas Thompson <dougthompson@xmission.com> | 2007-07-19 01:49:58 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 10:04:54 -0700 |
commit | 079708b9173595bf74b31b14c36e946359ae6c7e (patch) | |
tree | 79ed508a2ccdcf8d8095923cb4613594ed0af54d /drivers/edac/edac_mc_sysfs.c | |
parent | 4de78c6877ec21142582ac19453c2d453d1ea298 (diff) | |
download | op-kernel-dev-079708b9173595bf74b31b14c36e946359ae6c7e.zip op-kernel-dev-079708b9173595bf74b31b14c36e946359ae6c7e.tar.gz |
drivers/edac: core Lindent cleanup
Run the EDAC CORE files through Lindent for cleanup
Signed-off-by: Douglas Thompson <dougthompson@xmission.com>
Signed-off-by: Dave Jiang <djiang@mvista.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.c | 336 |
1 files changed, 143 insertions, 193 deletions
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c index 7f8240f..8eaa1d6 100644 --- a/drivers/edac/edac_mc_sysfs.c +++ b/drivers/edac/edac_mc_sysfs.c @@ -48,14 +48,13 @@ module_param(edac_mc_panic_on_ue, int, 0644); MODULE_PARM_DESC(edac_mc_panic_on_ue, "Panic on uncorrected error: 0=off 1=on"); module_param(edac_mc_log_ue, int, 0644); MODULE_PARM_DESC(edac_mc_log_ue, - "Log uncorrectable error to console: 0=off 1=on"); + "Log uncorrectable error to console: 0=off 1=on"); module_param(edac_mc_log_ce, int, 0644); MODULE_PARM_DESC(edac_mc_log_ce, - "Log correctable error to console: 0=off 1=on"); + "Log correctable error to console: 0=off 1=on"); module_param(edac_mc_poll_msec, int, 0644); MODULE_PARM_DESC(edac_mc_poll_msec, "Polling period in milliseconds"); - /* * various constants for Memory Controllers */ @@ -116,13 +115,13 @@ static struct completion edac_memctrl_kobj_complete; */ static ssize_t memctrl_int_show(void *ptr, char *buffer) { - int *value = (int*) ptr; + int *value = (int *)ptr; return sprintf(buffer, "%u\n", *value); } static ssize_t memctrl_int_store(void *ptr, const char *buffer, size_t count) { - int *value = (int*) ptr; + int *value = (int *)ptr; if (isdigit(*buffer)) *value = simple_strtoul(buffer, NULL, 0); @@ -133,16 +132,16 @@ static ssize_t memctrl_int_store(void *ptr, const char *buffer, size_t count) struct memctrl_dev_attribute { struct attribute attr; void *value; - ssize_t (*show)(void *,char *); - ssize_t (*store)(void *, const char *, size_t); + ssize_t(*show) (void *, char *); + ssize_t(*store) (void *, const char *, size_t); }; /* Set of show/store abstract level functions for memory control object */ static ssize_t memctrl_dev_show(struct kobject *kobj, - struct attribute *attr, char *buffer) + struct attribute *attr, char *buffer) { struct memctrl_dev_attribute *memctrl_dev; - memctrl_dev = (struct memctrl_dev_attribute*)attr; + memctrl_dev = (struct memctrl_dev_attribute *)attr; if (memctrl_dev->show) return memctrl_dev->show(memctrl_dev->value, buffer); @@ -151,10 +150,10 @@ static ssize_t memctrl_dev_show(struct kobject *kobj, } static ssize_t memctrl_dev_store(struct kobject *kobj, struct attribute *attr, - const char *buffer, size_t count) + const char *buffer, size_t count) { struct memctrl_dev_attribute *memctrl_dev; - memctrl_dev = (struct memctrl_dev_attribute*)attr; + memctrl_dev = (struct memctrl_dev_attribute *)attr; if (memctrl_dev->store) return memctrl_dev->store(memctrl_dev->value, buffer, count); @@ -163,8 +162,8 @@ static ssize_t memctrl_dev_store(struct kobject *kobj, struct attribute *attr, } static struct sysfs_ops memctrlfs_ops = { - .show = memctrl_dev_show, - .store = memctrl_dev_store + .show = memctrl_dev_show, + .store = memctrl_dev_store }; #define MEMCTRL_ATTR(_name,_mode,_show,_store) \ @@ -185,24 +184,16 @@ static struct memctrl_dev_attribute attr_##_name = { \ /* csrow<id> control files */ MEMCTRL_ATTR(edac_mc_panic_on_ue, - S_IRUGO | S_IWUSR, - memctrl_int_show, - memctrl_int_store); + S_IRUGO | S_IWUSR, memctrl_int_show, memctrl_int_store); MEMCTRL_ATTR(edac_mc_log_ue, - S_IRUGO|S_IWUSR, - memctrl_int_show, - memctrl_int_store); + S_IRUGO | S_IWUSR, memctrl_int_show, memctrl_int_store); MEMCTRL_ATTR(edac_mc_log_ce, - S_IRUGO|S_IWUSR, - memctrl_int_show, - memctrl_int_store); + S_IRUGO | S_IWUSR, memctrl_int_show, memctrl_int_store); MEMCTRL_ATTR(edac_mc_poll_msec, - S_IRUGO|S_IWUSR, - memctrl_int_show, - memctrl_int_store); + S_IRUGO | S_IWUSR, memctrl_int_show, memctrl_int_store); /* Base Attributes of the memory ECC object */ static struct memctrl_dev_attribute *memctrl_attr[] = { @@ -223,7 +214,7 @@ static void edac_memctrl_master_release(struct kobject *kobj) static struct kobj_type ktype_memctrl = { .release = edac_memctrl_master_release, .sysfs_ops = &memctrlfs_ops, - .default_attrs = (struct attribute **) memctrl_attr, + .default_attrs = (struct attribute **)memctrl_attr, }; /* Initialize the main sysfs entries for edac: @@ -249,25 +240,25 @@ int edac_sysfs_memctrl_setup(void) } /* Init the MC's kobject */ - memset(&edac_memctrl_kobj, 0, sizeof (edac_memctrl_kobj)); + memset(&edac_memctrl_kobj, 0, sizeof(edac_memctrl_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"); + err = kobject_set_name(&edac_memctrl_kobj, "mc"); if (err) { - debugf1("%s() Failed to set name '.../edac/mc'\n", __func__ ); + 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("%s() Failed to register '.../edac/mc'\n", __func__ ); + debugf1("%s() Failed to register '.../edac/mc'\n", __func__); return err; } - debugf1("%s() Registered '.../edac/mc' kobject\n",__func__); + debugf1("%s() Registered '.../edac/mc' kobject\n", __func__); return 0; } @@ -286,63 +277,61 @@ void edac_sysfs_memctrl_teardown(void) wait_for_completion(&edac_memctrl_kobj_complete); } - /* EDAC sysfs CSROW data structures and methods */ /* 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) + int private) { - return sprintf(data,"%u\n", csrow->ue_count); + return sprintf(data, "%u\n", csrow->ue_count); } static ssize_t csrow_ce_count_show(struct csrow_info *csrow, char *data, - int private) + int private) { - return sprintf(data,"%u\n", csrow->ce_count); + return sprintf(data, "%u\n", csrow->ce_count); } static ssize_t csrow_size_show(struct csrow_info *csrow, char *data, - int private) + int private) { - return sprintf(data,"%u\n", PAGES_TO_MiB(csrow->nr_pages)); + 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) + int private) { - return sprintf(data,"%s\n", mem_types[csrow->mtype]); + return sprintf(data, "%s\n", mem_types[csrow->mtype]); } static ssize_t csrow_dev_type_show(struct csrow_info *csrow, char *data, - int private) + int private) { - return sprintf(data,"%s\n", dev_types[csrow->dtype]); + return sprintf(data, "%s\n", dev_types[csrow->dtype]); } static ssize_t csrow_edac_mode_show(struct csrow_info *csrow, char *data, - int private) + int private) { - return sprintf(data,"%s\n", edac_caps[csrow->edac_mode]); + return sprintf(data, "%s\n", edac_caps[csrow->edac_mode]); } /* show/store functions for DIMM Label attributes */ static ssize_t channel_dimm_label_show(struct csrow_info *csrow, - char *data, int channel) + char *data, int channel) { - return snprintf(data, EDAC_MC_LABEL_LEN,"%s", + return snprintf(data, EDAC_MC_LABEL_LEN, "%s", csrow->channels[channel].label); } static ssize_t channel_dimm_label_store(struct csrow_info *csrow, - const char *data, - size_t count, - int channel) + const char *data, + size_t count, int channel) { ssize_t max_size = 0; - max_size = min((ssize_t)count,(ssize_t)EDAC_MC_LABEL_LEN-1); + max_size = min((ssize_t) count, (ssize_t) EDAC_MC_LABEL_LEN - 1); strncpy(csrow->channels[channel].label, data, max_size); csrow->channels[channel].label[max_size] = '\0'; @@ -351,8 +340,7 @@ static ssize_t channel_dimm_label_store(struct csrow_info *csrow, /* show function for dynamic chX_ce_count attribute */ static ssize_t channel_ce_count_show(struct csrow_info *csrow, - char *data, - int channel) + char *data, int channel) { return sprintf(data, "%u\n", csrow->channels[channel].ce_count); } @@ -360,9 +348,9 @@ static ssize_t channel_ce_count_show(struct csrow_info *csrow, /* csrow specific attribute structure */ struct csrowdev_attribute { struct attribute attr; - ssize_t (*show)(struct csrow_info *,char *,int); - ssize_t (*store)(struct csrow_info *, const char *,size_t,int); - int private; + ssize_t(*show) (struct csrow_info *, char *, int); + ssize_t(*store) (struct csrow_info *, const char *, size_t, int); + int private; }; #define to_csrow(k) container_of(k, struct csrow_info, kobj) @@ -370,36 +358,33 @@ struct csrowdev_attribute { /* Set of show/store higher level functions for default csrow attributes */ static ssize_t csrowdev_show(struct kobject *kobj, - struct attribute *attr, - char *buffer) + struct attribute *attr, char *buffer) { struct csrow_info *csrow = to_csrow(kobj); struct csrowdev_attribute *csrowdev_attr = to_csrowdev_attr(attr); if (csrowdev_attr->show) return csrowdev_attr->show(csrow, - buffer, - csrowdev_attr->private); + buffer, csrowdev_attr->private); return -EIO; } static ssize_t csrowdev_store(struct kobject *kobj, struct attribute *attr, - const char *buffer, size_t count) + const char *buffer, size_t count) { struct csrow_info *csrow = to_csrow(kobj); - struct csrowdev_attribute * csrowdev_attr = to_csrowdev_attr(attr); + struct csrowdev_attribute *csrowdev_attr = to_csrowdev_attr(attr); if (csrowdev_attr->store) return csrowdev_attr->store(csrow, - buffer, - count, - csrowdev_attr->private); + buffer, + count, csrowdev_attr->private); return -EIO; } static struct sysfs_ops csrowfs_ops = { - .show = csrowdev_show, - .store = csrowdev_store + .show = csrowdev_show, + .store = csrowdev_store }; #define CSROWDEV_ATTR(_name,_mode,_show,_store,_private) \ @@ -411,12 +396,12 @@ static struct csrowdev_attribute attr_##_name = { \ }; /* default cwrow<id>/attribute files */ -CSROWDEV_ATTR(size_mb,S_IRUGO,csrow_size_show,NULL,0); -CSROWDEV_ATTR(dev_type,S_IRUGO,csrow_dev_type_show,NULL,0); -CSROWDEV_ATTR(mem_type,S_IRUGO,csrow_mem_type_show,NULL,0); -CSROWDEV_ATTR(edac_mode,S_IRUGO,csrow_edac_mode_show,NULL,0); -CSROWDEV_ATTR(ue_count,S_IRUGO,csrow_ue_count_show,NULL,0); -CSROWDEV_ATTR(ce_count,S_IRUGO,csrow_ce_count_show,NULL,0); +CSROWDEV_ATTR(size_mb, S_IRUGO, csrow_size_show, NULL, 0); +CSROWDEV_ATTR(dev_type, S_IRUGO, csrow_dev_type_show, NULL, 0); +CSROWDEV_ATTR(mem_type, S_IRUGO, csrow_mem_type_show, NULL, 0); +CSROWDEV_ATTR(edac_mode, S_IRUGO, csrow_edac_mode_show, NULL, 0); +CSROWDEV_ATTR(ue_count, S_IRUGO, csrow_ue_count_show, NULL, 0); +CSROWDEV_ATTR(ce_count, S_IRUGO, csrow_ce_count_show, NULL, 0); /* default attributes of the CSROW<id> object */ static struct csrowdev_attribute *default_csrow_attr[] = { @@ -429,98 +414,68 @@ static struct csrowdev_attribute *default_csrow_attr[] = { NULL, }; - /* possible dynamic channel DIMM Label attribute files */ -CSROWDEV_ATTR(ch0_dimm_label,S_IRUGO|S_IWUSR, - channel_dimm_label_show, - channel_dimm_label_store, - 0 ); -CSROWDEV_ATTR(ch1_dimm_label,S_IRUGO|S_IWUSR, - channel_dimm_label_show, - channel_dimm_label_store, - 1 ); -CSROWDEV_ATTR(ch2_dimm_label,S_IRUGO|S_IWUSR, - channel_dimm_label_show, - channel_dimm_label_store, - 2 ); -CSROWDEV_ATTR(ch3_dimm_label,S_IRUGO|S_IWUSR, - channel_dimm_label_show, - channel_dimm_label_store, - 3 ); -CSROWDEV_ATTR(ch4_dimm_label,S_IRUGO|S_IWUSR, - channel_dimm_label_show, - channel_dimm_label_store, - 4 ); -CSROWDEV_ATTR(ch5_dimm_label,S_IRUGO|S_IWUSR, - channel_dimm_label_show, - channel_dimm_label_store, - 5 ); +CSROWDEV_ATTR(ch0_dimm_label, S_IRUGO | S_IWUSR, + channel_dimm_label_show, channel_dimm_label_store, 0); +CSROWDEV_ATTR(ch1_dimm_label, S_IRUGO | S_IWUSR, + channel_dimm_label_show, channel_dimm_label_store, 1); +CSROWDEV_ATTR(ch2_dimm_label, S_IRUGO | S_IWUSR, + channel_dimm_label_show, channel_dimm_label_store, 2); +CSROWDEV_ATTR(ch3_dimm_label, S_IRUGO | S_IWUSR, + channel_dimm_label_show, channel_dimm_label_store, 3); +CSROWDEV_ATTR(ch4_dimm_label, S_IRUGO | S_IWUSR, + channel_dimm_label_show, channel_dimm_label_store, 4); +CSROWDEV_ATTR(ch5_dimm_label, S_IRUGO | S_IWUSR, + channel_dimm_label_show, channel_dimm_label_store, 5); /* Total possible dynamic DIMM Label attribute file table */ static struct csrowdev_attribute *dynamic_csrow_dimm_attr[] = { - &attr_ch0_dimm_label, - &attr_ch1_dimm_label, - &attr_ch2_dimm_label, - &attr_ch3_dimm_label, - &attr_ch4_dimm_label, - &attr_ch5_dimm_label + &attr_ch0_dimm_label, + &attr_ch1_dimm_label, + &attr_ch2_dimm_label, + &attr_ch3_dimm_label, + &attr_ch4_dimm_label, + &attr_ch5_dimm_label }; /* possible dynamic channel ce_count attribute files */ -CSROWDEV_ATTR(ch0_ce_count,S_IRUGO|S_IWUSR, - channel_ce_count_show, - NULL, - 0 ); -CSROWDEV_ATTR(ch1_ce_count,S_IRUGO|S_IWUSR, - channel_ce_count_show, - NULL, - 1 ); -CSROWDEV_ATTR(ch2_ce_count,S_IRUGO|S_IWUSR, - channel_ce_count_show, - NULL, - 2 ); -CSROWDEV_ATTR(ch3_ce_count,S_IRUGO|S_IWUSR, - channel_ce_count_show, - NULL, - 3 ); -CSROWDEV_ATTR(ch4_ce_count,S_IRUGO|S_IWUSR, - channel_ce_count_show, - NULL, - 4 ); -CSROWDEV_ATTR(ch5_ce_count,S_IRUGO|S_IWUSR, - channel_ce_count_show, - NULL, - 5 ); +CSROWDEV_ATTR(ch0_ce_count, S_IRUGO | S_IWUSR, channel_ce_count_show, NULL, 0); +CSROWDEV_ATTR(ch1_ce_count, S_IRUGO | S_IWUSR, channel_ce_count_show, NULL, 1); +CSROWDEV_ATTR(ch2_ce_count, S_IRUGO | S_IWUSR, channel_ce_count_show, NULL, 2); +CSROWDEV_ATTR(ch3_ce_count, S_IRUGO | S_IWUSR, channel_ce_count_show, NULL, 3); +CSROWDEV_ATTR(ch4_ce_count, S_IRUGO | S_IWUSR, channel_ce_count_show, NULL, 4); +CSROWDEV_ATTR(ch5_ce_count, S_IRUGO | S_IWUSR, channel_ce_count_show, NULL, 5); /* Total possible dynamic ce_count attribute file table */ static struct csrowdev_attribute *dynamic_csrow_ce_count_attr[] = { - &attr_ch0_ce_count, - &attr_ch1_ce_count, - &attr_ch2_ce_count, - &attr_ch3_ce_count, - &attr_ch4_ce_count, - &attr_ch5_ce_count + &attr_ch0_ce_count, + &attr_ch1_ce_count, + &attr_ch2_ce_count, + &attr_ch3_ce_count, + &attr_ch4_ce_count, + &attr_ch5_ce_count }; - #define EDAC_NR_CHANNELS 6 /* Create dynamic CHANNEL files, indexed by 'chan', under specifed CSROW */ static int edac_create_channel_files(struct kobject *kobj, int chan) { - int err=-ENODEV; + int err = -ENODEV; if (chan >= EDAC_NR_CHANNELS) return err; /* create the DIMM label attribute file */ err = sysfs_create_file(kobj, - (struct attribute *) dynamic_csrow_dimm_attr[chan]); + (struct attribute *) + dynamic_csrow_dimm_attr[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__); @@ -542,14 +497,12 @@ static void edac_csrow_instance_release(struct kobject *kobj) static struct kobj_type ktype_csrow = { .release = edac_csrow_instance_release, .sysfs_ops = &csrowfs_ops, - .default_attrs = (struct attribute **) default_csrow_attr, + .default_attrs = (struct attribute **)default_csrow_attr, }; /* Create a CSROW object under specifed edac_mc_device */ -static int edac_create_csrow_object( - struct kobject *edac_mci_kobj, - struct csrow_info *csrow, - int index) +static int edac_create_csrow_object(struct kobject *edac_mci_kobj, + struct csrow_info *csrow, int index) { int err = 0; int chan; @@ -562,7 +515,7 @@ static int edac_create_csrow_object( csrow->kobj.ktype = &ktype_csrow; /* name this instance of csrow<id> */ - err = kobject_set_name(&csrow->kobj,"csrow%d",index); + err = kobject_set_name(&csrow->kobj, "csrow%d", index); if (err) goto error_exit; @@ -573,20 +526,20 @@ static int edac_create_csrow_object( * namely, the DIMM labels and the channel ce_count */ for (chan = 0; chan < csrow->nr_channels; chan++) { - err = edac_create_channel_files(&csrow->kobj,chan); + err = edac_create_channel_files(&csrow->kobj, chan); if (err) break; } } -error_exit: + error_exit: return err; } /* default sysfs methods and data structures for the main MCI kobject */ static ssize_t mci_reset_counters_store(struct mem_ctl_info *mci, - const char *data, size_t count) + const char *data, size_t count) { int row, chan; @@ -611,7 +564,7 @@ static ssize_t mci_reset_counters_store(struct mem_ctl_info *mci, /* memory scrubbing */ static ssize_t mci_sdram_scrub_rate_store(struct mem_ctl_info *mci, - const char *data, size_t count) + const char *data, size_t count) { u32 bandwidth = -1; @@ -619,20 +572,20 @@ static ssize_t mci_sdram_scrub_rate_store(struct mem_ctl_info *mci, memctrl_int_store(&bandwidth, data, count); - if (!(*mci->set_sdram_scrub_rate)(mci, &bandwidth)) { + if (!(*mci->set_sdram_scrub_rate) (mci, &bandwidth)) { edac_printk(KERN_DEBUG, EDAC_MC, - "Scrub rate set successfully, applied: %d\n", - bandwidth); + "Scrub rate set successfully, applied: %d\n", + bandwidth); } else { /* FIXME: error codes maybe? */ edac_printk(KERN_DEBUG, EDAC_MC, - "Scrub rate set FAILED, could not apply: %d\n", - bandwidth); + "Scrub rate set FAILED, could not apply: %d\n", + bandwidth); } } else { /* FIXME: produce "not implemented" ERROR for user-side. */ edac_printk(KERN_WARNING, EDAC_MC, - "Memory scrubbing 'set'control is not implemented!\n"); + "Memory scrubbing 'set'control is not implemented!\n"); } return count; } @@ -642,20 +595,20 @@ static ssize_t mci_sdram_scrub_rate_show(struct mem_ctl_info *mci, char *data) u32 bandwidth = -1; if (mci->get_sdram_scrub_rate) { - if (!(*mci->get_sdram_scrub_rate)(mci, &bandwidth)) { + if (!(*mci->get_sdram_scrub_rate) (mci, &bandwidth)) { edac_printk(KERN_DEBUG, EDAC_MC, - "Scrub rate successfully, fetched: %d\n", - bandwidth); + "Scrub rate successfully, fetched: %d\n", + bandwidth); } else { /* FIXME: error codes maybe? */ edac_printk(KERN_DEBUG, EDAC_MC, - "Scrub rate fetch FAILED, got: %d\n", - bandwidth); + "Scrub rate fetch FAILED, got: %d\n", + bandwidth); } } 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); } @@ -663,32 +616,32 @@ static ssize_t mci_sdram_scrub_rate_show(struct mem_ctl_info *mci, char *data) /* default attribute files for the MCI object */ static ssize_t mci_ue_count_show(struct mem_ctl_info *mci, char *data) { - return sprintf(data,"%d\n", mci->ue_count); + return sprintf(data, "%d\n", mci->ue_count); } static ssize_t mci_ce_count_show(struct mem_ctl_info *mci, char *data) { - return sprintf(data,"%d\n", mci->ce_count); + return sprintf(data, "%d\n", mci->ce_count); } static ssize_t mci_ce_noinfo_show(struct mem_ctl_info *mci, char *data) { - return sprintf(data,"%d\n", mci->ce_noinfo_count); + return sprintf(data, "%d\n", mci->ce_noinfo_count); } static ssize_t mci_ue_noinfo_show(struct mem_ctl_info *mci, char *data) { - return sprintf(data,"%d\n", mci->ue_noinfo_count); + return sprintf(data, "%d\n", mci->ue_noinfo_count); } static ssize_t mci_seconds_show(struct mem_ctl_info *mci, char *data) { - return sprintf(data,"%ld\n", (jiffies - mci->start_time) / HZ); + return sprintf(data, "%ld\n", (jiffies - mci->start_time) / HZ); } static ssize_t mci_ctl_name_show(struct mem_ctl_info *mci, char *data) { - return sprintf(data,"%s\n", mci->ctl_name); + return sprintf(data, "%s\n", mci->ctl_name); } static ssize_t mci_size_mb_show(struct mem_ctl_info *mci, char *data) @@ -696,7 +649,7 @@ static ssize_t mci_size_mb_show(struct mem_ctl_info *mci, char *data) int total_pages, csrow_idx; for (total_pages = csrow_idx = 0; csrow_idx < mci->nr_csrows; - csrow_idx++) { + csrow_idx++) { struct csrow_info *csrow = &mci->csrows[csrow_idx]; if (!csrow->nr_pages) @@ -705,13 +658,13 @@ static ssize_t mci_size_mb_show(struct mem_ctl_info *mci, char *data) total_pages += csrow->nr_pages; } - return sprintf(data,"%u\n", PAGES_TO_MiB(total_pages)); + return sprintf(data, "%u\n", PAGES_TO_MiB(total_pages)); } struct mcidev_attribute { struct attribute attr; - ssize_t (*show)(struct mem_ctl_info *,char *); - ssize_t (*store)(struct mem_ctl_info *, const char *,size_t); + ssize_t(*show) (struct mem_ctl_info *, char *); + ssize_t(*store) (struct mem_ctl_info *, const char *, size_t); }; #define to_mci(k) container_of(k, struct mem_ctl_info, edac_mci_kobj) @@ -719,10 +672,10 @@ struct mcidev_attribute { /* MCI show/store functions for top most object */ static ssize_t mcidev_show(struct kobject *kobj, struct attribute *attr, - char *buffer) + char *buffer) { struct mem_ctl_info *mem_ctl_info = to_mci(kobj); - struct mcidev_attribute * mcidev_attr = to_mcidev_attr(attr); + struct mcidev_attribute *mcidev_attr = to_mcidev_attr(attr); if (mcidev_attr->show) return mcidev_attr->show(mem_ctl_info, buffer); @@ -731,10 +684,10 @@ static ssize_t mcidev_show(struct kobject *kobj, struct attribute *attr, } static ssize_t mcidev_store(struct kobject *kobj, struct attribute *attr, - const char *buffer, size_t count) + const char *buffer, size_t count) { struct mem_ctl_info *mem_ctl_info = to_mci(kobj); - struct mcidev_attribute * mcidev_attr = to_mcidev_attr(attr); + struct mcidev_attribute *mcidev_attr = to_mcidev_attr(attr); if (mcidev_attr->store) return mcidev_attr->store(mem_ctl_info, buffer, count); @@ -755,20 +708,20 @@ static struct mcidev_attribute mci_attr_##_name = { \ }; /* default Control file */ -MCIDEV_ATTR(reset_counters,S_IWUSR,NULL,mci_reset_counters_store); +MCIDEV_ATTR(reset_counters, S_IWUSR, NULL, mci_reset_counters_store); /* default Attribute files */ -MCIDEV_ATTR(mc_name,S_IRUGO,mci_ctl_name_show,NULL); -MCIDEV_ATTR(size_mb,S_IRUGO,mci_size_mb_show,NULL); -MCIDEV_ATTR(seconds_since_reset,S_IRUGO,mci_seconds_show,NULL); -MCIDEV_ATTR(ue_noinfo_count,S_IRUGO,mci_ue_noinfo_show,NULL); -MCIDEV_ATTR(ce_noinfo_count,S_IRUGO,mci_ce_noinfo_show,NULL); -MCIDEV_ATTR(ue_count,S_IRUGO,mci_ue_count_show,NULL); -MCIDEV_ATTR(ce_count,S_IRUGO,mci_ce_count_show,NULL); +MCIDEV_ATTR(mc_name, S_IRUGO, mci_ctl_name_show, NULL); +MCIDEV_ATTR(size_mb, S_IRUGO, mci_size_mb_show, NULL); +MCIDEV_ATTR(seconds_since_reset, S_IRUGO, mci_seconds_show, NULL); +MCIDEV_ATTR(ue_noinfo_count, S_IRUGO, mci_ue_noinfo_show, NULL); +MCIDEV_ATTR(ce_noinfo_count, S_IRUGO, mci_ce_noinfo_show, NULL); +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, @@ -798,10 +751,9 @@ static void edac_mci_instance_release(struct kobject *kobj) static struct kobj_type ktype_mci = { .release = edac_mci_instance_release, .sysfs_ops = &mci_ops, - .default_attrs = (struct attribute **) mci_attr, + .default_attrs = (struct attribute **)mci_attr, }; - #define EDAC_DEVICE_SYMLINK "device" /* @@ -817,13 +769,13 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) int i; int err; struct csrow_info *csrow; - struct kobject *edac_mci_kobj=&mci->edac_mci_kobj; + struct kobject *edac_mci_kobj = &mci->edac_mci_kobj; debugf0("%s() idx=%d\n", __func__, mci->mc_idx); memset(edac_mci_kobj, 0, sizeof(*edac_mci_kobj)); /* set the name of the mc<id> object */ - err = kobject_set_name(edac_mci_kobj,"mc%d",mci->mc_idx); + err = kobject_set_name(edac_mci_kobj, "mc%d", mci->mc_idx); if (err) return err; @@ -850,7 +802,7 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) /* Only expose populated CSROWs */ if (csrow->nr_pages > 0) { - err = edac_create_csrow_object(edac_mci_kobj,csrow,i); + err = edac_create_csrow_object(edac_mci_kobj, csrow, i); if (err) goto fail1; } @@ -859,8 +811,8 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) return 0; /* CSROW error: backout what has already been registered, */ -fail1: - for ( i--; i >= 0; i--) { + fail1: + for (i--; i >= 0; i--) { if (csrow->nr_pages > 0) { init_completion(&csrow->kobj_complete); kobject_unregister(&mci->csrows[i].kobj); @@ -868,7 +820,7 @@ fail1: } } -fail0: + fail0: init_completion(&mci->kobj_complete); kobject_unregister(edac_mci_kobj); wait_for_completion(&mci->kobj_complete); @@ -898,5 +850,3 @@ void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci) kobject_unregister(&mci->edac_mci_kobj); wait_for_completion(&mci->kobj_complete); } - - |