aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_mc_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/edac/edac_mc_sysfs.c')
-rw-r--r--drivers/edac/edac_mc_sysfs.c84
1 files changed, 42 insertions, 42 deletions
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index 029ce8979a71..bbd845885d4f 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -183,16 +183,16 @@ static struct memctrl_dev_attribute attr_##_name = { \
183 183
184/* csrow<id> control files */ 184/* csrow<id> control files */
185MEMCTRL_ATTR(edac_mc_panic_on_ue, 185MEMCTRL_ATTR(edac_mc_panic_on_ue,
186 S_IRUGO | S_IWUSR, memctrl_int_show, memctrl_int_store); 186 S_IRUGO | S_IWUSR, memctrl_int_show, memctrl_int_store);
187 187
188MEMCTRL_ATTR(edac_mc_log_ue, 188MEMCTRL_ATTR(edac_mc_log_ue,
189 S_IRUGO | S_IWUSR, memctrl_int_show, memctrl_int_store); 189 S_IRUGO | S_IWUSR, memctrl_int_show, memctrl_int_store);
190 190
191MEMCTRL_ATTR(edac_mc_log_ce, 191MEMCTRL_ATTR(edac_mc_log_ce,
192 S_IRUGO | S_IWUSR, memctrl_int_show, memctrl_int_store); 192 S_IRUGO | S_IWUSR, memctrl_int_show, memctrl_int_store);
193 193
194MEMCTRL_ATTR(edac_mc_poll_msec, 194MEMCTRL_ATTR(edac_mc_poll_msec,
195 S_IRUGO | S_IWUSR, memctrl_int_show, memctrl_int_store); 195 S_IRUGO | S_IWUSR, memctrl_int_show, memctrl_int_store);
196 196
197/* Base Attributes of the memory ECC object */ 197/* Base Attributes of the memory ECC object */
198static struct memctrl_dev_attribute *memctrl_attr[] = { 198static struct memctrl_dev_attribute *memctrl_attr[] = {
@@ -281,44 +281,44 @@ void edac_sysfs_memctrl_teardown(void)
281 281
282/* Set of more default csrow<id> attribute show/store functions */ 282/* Set of more default csrow<id> attribute show/store functions */
283static ssize_t csrow_ue_count_show(struct csrow_info *csrow, char *data, 283static ssize_t csrow_ue_count_show(struct csrow_info *csrow, char *data,
284 int private) 284 int private)
285{ 285{
286 return sprintf(data, "%u\n", csrow->ue_count); 286 return sprintf(data, "%u\n", csrow->ue_count);
287} 287}
288 288
289static ssize_t csrow_ce_count_show(struct csrow_info *csrow, char *data, 289static ssize_t csrow_ce_count_show(struct csrow_info *csrow, char *data,
290 int private) 290 int private)
291{ 291{
292 return sprintf(data, "%u\n", csrow->ce_count); 292 return sprintf(data, "%u\n", csrow->ce_count);
293} 293}
294 294
295static ssize_t csrow_size_show(struct csrow_info *csrow, char *data, 295static ssize_t csrow_size_show(struct csrow_info *csrow, char *data,
296 int private) 296 int private)
297{ 297{
298 return sprintf(data, "%u\n", PAGES_TO_MiB(csrow->nr_pages)); 298 return sprintf(data, "%u\n", PAGES_TO_MiB(csrow->nr_pages));
299} 299}
300 300
301static ssize_t csrow_mem_type_show(struct csrow_info *csrow, char *data, 301static ssize_t csrow_mem_type_show(struct csrow_info *csrow, char *data,
302 int private) 302 int private)
303{ 303{
304 return sprintf(data, "%s\n", mem_types[csrow->mtype]); 304 return sprintf(data, "%s\n", mem_types[csrow->mtype]);
305} 305}
306 306
307static ssize_t csrow_dev_type_show(struct csrow_info *csrow, char *data, 307static ssize_t csrow_dev_type_show(struct csrow_info *csrow, char *data,
308 int private) 308 int private)
309{ 309{
310 return sprintf(data, "%s\n", dev_types[csrow->dtype]); 310 return sprintf(data, "%s\n", dev_types[csrow->dtype]);
311} 311}
312 312
313static ssize_t csrow_edac_mode_show(struct csrow_info *csrow, char *data, 313static ssize_t csrow_edac_mode_show(struct csrow_info *csrow, char *data,
314 int private) 314 int private)
315{ 315{
316 return sprintf(data, "%s\n", edac_caps[csrow->edac_mode]); 316 return sprintf(data, "%s\n", edac_caps[csrow->edac_mode]);
317} 317}
318 318
319/* show/store functions for DIMM Label attributes */ 319/* show/store functions for DIMM Label attributes */
320static ssize_t channel_dimm_label_show(struct csrow_info *csrow, 320static ssize_t channel_dimm_label_show(struct csrow_info *csrow,
321 char *data, int channel) 321 char *data, int channel)
322{ 322{
323 return snprintf(data, EDAC_MC_LABEL_LEN, "%s", 323 return snprintf(data, EDAC_MC_LABEL_LEN, "%s",
324 csrow->channels[channel].label); 324 csrow->channels[channel].label);
@@ -339,7 +339,7 @@ static ssize_t channel_dimm_label_store(struct csrow_info *csrow,
339 339
340/* show function for dynamic chX_ce_count attribute */ 340/* show function for dynamic chX_ce_count attribute */
341static ssize_t channel_ce_count_show(struct csrow_info *csrow, 341static ssize_t channel_ce_count_show(struct csrow_info *csrow,
342 char *data, int channel) 342 char *data, int channel)
343{ 343{
344 return sprintf(data, "%u\n", csrow->channels[channel].ce_count); 344 return sprintf(data, "%u\n", csrow->channels[channel].ce_count);
345} 345}
@@ -357,27 +357,27 @@ struct csrowdev_attribute {
357 357
358/* Set of show/store higher level functions for default csrow attributes */ 358/* Set of show/store higher level functions for default csrow attributes */
359static ssize_t csrowdev_show(struct kobject *kobj, 359static ssize_t csrowdev_show(struct kobject *kobj,
360 struct attribute *attr, char *buffer) 360 struct attribute *attr, char *buffer)
361{ 361{
362 struct csrow_info *csrow = to_csrow(kobj); 362 struct csrow_info *csrow = to_csrow(kobj);
363 struct csrowdev_attribute *csrowdev_attr = to_csrowdev_attr(attr); 363 struct csrowdev_attribute *csrowdev_attr = to_csrowdev_attr(attr);
364 364
365 if (csrowdev_attr->show) 365 if (csrowdev_attr->show)
366 return csrowdev_attr->show(csrow, 366 return csrowdev_attr->show(csrow,
367 buffer, csrowdev_attr->private); 367 buffer, csrowdev_attr->private);
368 return -EIO; 368 return -EIO;
369} 369}
370 370
371static ssize_t csrowdev_store(struct kobject *kobj, struct attribute *attr, 371static ssize_t csrowdev_store(struct kobject *kobj, struct attribute *attr,
372 const char *buffer, size_t count) 372 const char *buffer, size_t count)
373{ 373{
374 struct csrow_info *csrow = to_csrow(kobj); 374 struct csrow_info *csrow = to_csrow(kobj);
375 struct csrowdev_attribute *csrowdev_attr = to_csrowdev_attr(attr); 375 struct csrowdev_attribute *csrowdev_attr = to_csrowdev_attr(attr);
376 376
377 if (csrowdev_attr->store) 377 if (csrowdev_attr->store)
378 return csrowdev_attr->store(csrow, 378 return csrowdev_attr->store(csrow,
379 buffer, 379 buffer,
380 count, csrowdev_attr->private); 380 count, csrowdev_attr->private);
381 return -EIO; 381 return -EIO;
382} 382}
383 383
@@ -415,17 +415,17 @@ static struct csrowdev_attribute *default_csrow_attr[] = {
415 415
416/* possible dynamic channel DIMM Label attribute files */ 416/* possible dynamic channel DIMM Label attribute files */
417CSROWDEV_ATTR(ch0_dimm_label, S_IRUGO | S_IWUSR, 417CSROWDEV_ATTR(ch0_dimm_label, S_IRUGO | S_IWUSR,
418 channel_dimm_label_show, channel_dimm_label_store, 0); 418 channel_dimm_label_show, channel_dimm_label_store, 0);
419CSROWDEV_ATTR(ch1_dimm_label, S_IRUGO | S_IWUSR, 419CSROWDEV_ATTR(ch1_dimm_label, S_IRUGO | S_IWUSR,
420 channel_dimm_label_show, channel_dimm_label_store, 1); 420 channel_dimm_label_show, channel_dimm_label_store, 1);
421CSROWDEV_ATTR(ch2_dimm_label, S_IRUGO | S_IWUSR, 421CSROWDEV_ATTR(ch2_dimm_label, S_IRUGO | S_IWUSR,
422 channel_dimm_label_show, channel_dimm_label_store, 2); 422 channel_dimm_label_show, channel_dimm_label_store, 2);
423CSROWDEV_ATTR(ch3_dimm_label, S_IRUGO | S_IWUSR, 423CSROWDEV_ATTR(ch3_dimm_label, S_IRUGO | S_IWUSR,
424 channel_dimm_label_show, channel_dimm_label_store, 3); 424 channel_dimm_label_show, channel_dimm_label_store, 3);
425CSROWDEV_ATTR(ch4_dimm_label, S_IRUGO | S_IWUSR, 425CSROWDEV_ATTR(ch4_dimm_label, S_IRUGO | S_IWUSR,
426 channel_dimm_label_show, channel_dimm_label_store, 4); 426 channel_dimm_label_show, channel_dimm_label_store, 4);
427CSROWDEV_ATTR(ch5_dimm_label, S_IRUGO | S_IWUSR, 427CSROWDEV_ATTR(ch5_dimm_label, S_IRUGO | S_IWUSR,
428 channel_dimm_label_show, channel_dimm_label_store, 5); 428 channel_dimm_label_show, channel_dimm_label_store, 5);
429 429
430/* Total possible dynamic DIMM Label attribute file table */ 430/* Total possible dynamic DIMM Label attribute file table */
431static struct csrowdev_attribute *dynamic_csrow_dimm_attr[] = { 431static struct csrowdev_attribute *dynamic_csrow_dimm_attr[] = {
@@ -501,7 +501,7 @@ static struct kobj_type ktype_csrow = {
501 501
502/* Create a CSROW object under specifed edac_mc_device */ 502/* Create a CSROW object under specifed edac_mc_device */
503static int edac_create_csrow_object(struct kobject *edac_mci_kobj, 503static int edac_create_csrow_object(struct kobject *edac_mci_kobj,
504 struct csrow_info *csrow, int index) 504 struct csrow_info *csrow, int index)
505{ 505{
506 int err = 0; 506 int err = 0;
507 int chan; 507 int chan;
@@ -531,7 +531,7 @@ static int edac_create_csrow_object(struct kobject *edac_mci_kobj,
531 } 531 }
532 } 532 }
533 533
534 error_exit: 534error_exit:
535 return err; 535 return err;
536} 536}
537 537
@@ -563,7 +563,7 @@ static ssize_t mci_reset_counters_store(struct mem_ctl_info *mci,
563 563
564/* memory scrubbing */ 564/* memory scrubbing */
565static ssize_t mci_sdram_scrub_rate_store(struct mem_ctl_info *mci, 565static ssize_t mci_sdram_scrub_rate_store(struct mem_ctl_info *mci,
566 const char *data, size_t count) 566 const char *data, size_t count)
567{ 567{
568 u32 bandwidth = -1; 568 u32 bandwidth = -1;
569 569
@@ -573,18 +573,18 @@ static ssize_t mci_sdram_scrub_rate_store(struct mem_ctl_info *mci,
573 573
574 if (!(*mci->set_sdram_scrub_rate) (mci, &bandwidth)) { 574 if (!(*mci->set_sdram_scrub_rate) (mci, &bandwidth)) {
575 edac_printk(KERN_DEBUG, EDAC_MC, 575 edac_printk(KERN_DEBUG, EDAC_MC,
576 "Scrub rate set successfully, applied: %d\n", 576 "Scrub rate set successfully, applied: %d\n",
577 bandwidth); 577 bandwidth);
578 } else { 578 } else {
579 /* FIXME: error codes maybe? */ 579 /* FIXME: error codes maybe? */
580 edac_printk(KERN_DEBUG, EDAC_MC, 580 edac_printk(KERN_DEBUG, EDAC_MC,
581 "Scrub rate set FAILED, could not apply: %d\n", 581 "Scrub rate set FAILED, could not apply: %d\n",
582 bandwidth); 582 bandwidth);
583 } 583 }
584 } else { 584 } else {
585 /* FIXME: produce "not implemented" ERROR for user-side. */ 585 /* FIXME: produce "not implemented" ERROR for user-side. */
586 edac_printk(KERN_WARNING, EDAC_MC, 586 edac_printk(KERN_WARNING, EDAC_MC,
587 "Memory scrubbing 'set'control is not implemented!\n"); 587 "Memory scrubbing 'set'control is not implemented!\n");
588 } 588 }
589 return count; 589 return count;
590} 590}
@@ -596,18 +596,18 @@ static ssize_t mci_sdram_scrub_rate_show(struct mem_ctl_info *mci, char *data)
596 if (mci->get_sdram_scrub_rate) { 596 if (mci->get_sdram_scrub_rate) {
597 if (!(*mci->get_sdram_scrub_rate) (mci, &bandwidth)) { 597 if (!(*mci->get_sdram_scrub_rate) (mci, &bandwidth)) {
598 edac_printk(KERN_DEBUG, EDAC_MC, 598 edac_printk(KERN_DEBUG, EDAC_MC,
599 "Scrub rate successfully, fetched: %d\n", 599 "Scrub rate successfully, fetched: %d\n",
600 bandwidth); 600 bandwidth);
601 } else { 601 } else {
602 /* FIXME: error codes maybe? */ 602 /* FIXME: error codes maybe? */
603 edac_printk(KERN_DEBUG, EDAC_MC, 603 edac_printk(KERN_DEBUG, EDAC_MC,
604 "Scrub rate fetch FAILED, got: %d\n", 604 "Scrub rate fetch FAILED, got: %d\n",
605 bandwidth); 605 bandwidth);
606 } 606 }
607 } else { 607 } else {
608 /* FIXME: produce "not implemented" ERROR for user-side. */ 608 /* FIXME: produce "not implemented" ERROR for user-side. */
609 edac_printk(KERN_WARNING, EDAC_MC, 609 edac_printk(KERN_WARNING, EDAC_MC,
610 "Memory scrubbing 'get' control is not implemented\n"); 610 "Memory scrubbing 'get' control is not implemented\n");
611 } 611 }
612 return sprintf(data, "%d\n", bandwidth); 612 return sprintf(data, "%d\n", bandwidth);
613} 613}
@@ -648,7 +648,7 @@ static ssize_t mci_size_mb_show(struct mem_ctl_info *mci, char *data)
648 int total_pages, csrow_idx; 648 int total_pages, csrow_idx;
649 649
650 for (total_pages = csrow_idx = 0; csrow_idx < mci->nr_csrows; 650 for (total_pages = csrow_idx = 0; csrow_idx < mci->nr_csrows;
651 csrow_idx++) { 651 csrow_idx++) {
652 struct csrow_info *csrow = &mci->csrows[csrow_idx]; 652 struct csrow_info *csrow = &mci->csrows[csrow_idx];
653 653
654 if (!csrow->nr_pages) 654 if (!csrow->nr_pages)
@@ -665,7 +665,7 @@ static ssize_t mci_size_mb_show(struct mem_ctl_info *mci, char *data)
665 665
666/* MCI show/store functions for top most object */ 666/* MCI show/store functions for top most object */
667static ssize_t mcidev_show(struct kobject *kobj, struct attribute *attr, 667static ssize_t mcidev_show(struct kobject *kobj, struct attribute *attr,
668 char *buffer) 668 char *buffer)
669{ 669{
670 struct mem_ctl_info *mem_ctl_info = to_mci(kobj); 670 struct mem_ctl_info *mem_ctl_info = to_mci(kobj);
671 struct mcidev_sysfs_attribute *mcidev_attr = to_mcidev_attr(attr); 671 struct mcidev_sysfs_attribute *mcidev_attr = to_mcidev_attr(attr);
@@ -677,7 +677,7 @@ static ssize_t mcidev_show(struct kobject *kobj, struct attribute *attr,
677} 677}
678 678
679static ssize_t mcidev_store(struct kobject *kobj, struct attribute *attr, 679static ssize_t mcidev_store(struct kobject *kobj, struct attribute *attr,
680 const char *buffer, size_t count) 680 const char *buffer, size_t count)
681{ 681{
682 struct mem_ctl_info *mem_ctl_info = to_mci(kobj); 682 struct mem_ctl_info *mem_ctl_info = to_mci(kobj);
683 struct mcidev_sysfs_attribute *mcidev_attr = to_mcidev_attr(attr); 683 struct mcidev_sysfs_attribute *mcidev_attr = to_mcidev_attr(attr);
@@ -714,7 +714,7 @@ MCIDEV_ATTR(ce_count, S_IRUGO, mci_ce_count_show, NULL);
714 714
715/* memory scrubber attribute file */ 715/* memory scrubber attribute file */
716MCIDEV_ATTR(sdram_scrub_rate, S_IRUGO | S_IWUSR, mci_sdram_scrub_rate_show, 716MCIDEV_ATTR(sdram_scrub_rate, S_IRUGO | S_IWUSR, mci_sdram_scrub_rate_show,
717 mci_sdram_scrub_rate_store); 717 mci_sdram_scrub_rate_store);
718 718
719static struct mcidev_sysfs_attribute *mci_attr[] = { 719static struct mcidev_sysfs_attribute *mci_attr[] = {
720 &mci_attr_reset_counters, 720 &mci_attr_reset_counters,
@@ -841,7 +841,7 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)
841 return 0; 841 return 0;
842 842
843 /* CSROW error: backout what has already been registered, */ 843 /* CSROW error: backout what has already been registered, */
844 fail1: 844fail1:
845 for (i--; i >= 0; i--) { 845 for (i--; i >= 0; i--) {
846 if (csrow->nr_pages > 0) { 846 if (csrow->nr_pages > 0) {
847 init_completion(&csrow->kobj_complete); 847 init_completion(&csrow->kobj_complete);
@@ -850,7 +850,7 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)
850 } 850 }
851 } 851 }
852 852
853 fail0: 853fail0:
854 init_completion(&mci->kobj_complete); 854 init_completion(&mci->kobj_complete);
855 kobject_unregister(edac_mci_kobj); 855 kobject_unregister(edac_mci_kobj);
856 wait_for_completion(&mci->kobj_complete); 856 wait_for_completion(&mci->kobj_complete);