edac_mc_sysfs.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. /*
  2. * edac_mc kernel module
  3. * (C) 2005-2007 Linux Networx (http://lnxi.com)
  4. *
  5. * This file may be distributed under the terms of the
  6. * GNU General Public License.
  7. *
  8. * Written Doug Thompson <norsk5@xmission.com> www.softwarebitmaker.com
  9. *
  10. * (c) 2012-2013 - Mauro Carvalho Chehab
  11. * The entire API were re-written, and ported to use struct device
  12. *
  13. */
  14. #include <linux/ctype.h>
  15. #include <linux/slab.h>
  16. #include <linux/edac.h>
  17. #include <linux/bug.h>
  18. #include <linux/pm_runtime.h>
  19. #include <linux/uaccess.h>
  20. #include "edac_mc.h"
  21. #include "edac_module.h"
  22. /* MC EDAC Controls, setable by module parameter, and sysfs */
  23. static int edac_mc_log_ue = 1;
  24. static int edac_mc_log_ce = 1;
  25. static int edac_mc_panic_on_ue;
  26. static unsigned int edac_mc_poll_msec = 1000;
  27. /* Getter functions for above */
  28. int edac_mc_get_log_ue(void)
  29. {
  30. return edac_mc_log_ue;
  31. }
  32. int edac_mc_get_log_ce(void)
  33. {
  34. return edac_mc_log_ce;
  35. }
  36. int edac_mc_get_panic_on_ue(void)
  37. {
  38. return edac_mc_panic_on_ue;
  39. }
  40. /* this is temporary */
  41. unsigned int edac_mc_get_poll_msec(void)
  42. {
  43. return edac_mc_poll_msec;
  44. }
  45. static int edac_set_poll_msec(const char *val, const struct kernel_param *kp)
  46. {
  47. unsigned int i;
  48. int ret;
  49. if (!val)
  50. return -EINVAL;
  51. ret = kstrtouint(val, 0, &i);
  52. if (ret)
  53. return ret;
  54. if (i < 1000)
  55. return -EINVAL;
  56. *((unsigned int *)kp->arg) = i;
  57. /* notify edac_mc engine to reset the poll period */
  58. edac_mc_reset_delay_period(i);
  59. return 0;
  60. }
  61. /* Parameter declarations for above */
  62. module_param(edac_mc_panic_on_ue, int, 0644);
  63. MODULE_PARM_DESC(edac_mc_panic_on_ue, "Panic on uncorrected error: 0=off 1=on");
  64. module_param(edac_mc_log_ue, int, 0644);
  65. MODULE_PARM_DESC(edac_mc_log_ue,
  66. "Log uncorrectable error to console: 0=off 1=on");
  67. module_param(edac_mc_log_ce, int, 0644);
  68. MODULE_PARM_DESC(edac_mc_log_ce,
  69. "Log correctable error to console: 0=off 1=on");
  70. module_param_call(edac_mc_poll_msec, edac_set_poll_msec, param_get_uint,
  71. &edac_mc_poll_msec, 0644);
  72. MODULE_PARM_DESC(edac_mc_poll_msec, "Polling period in milliseconds");
  73. static struct device *mci_pdev;
  74. /*
  75. * various constants for Memory Controllers
  76. */
  77. static const char * const dev_types[] = {
  78. [DEV_UNKNOWN] = "Unknown",
  79. [DEV_X1] = "x1",
  80. [DEV_X2] = "x2",
  81. [DEV_X4] = "x4",
  82. [DEV_X8] = "x8",
  83. [DEV_X16] = "x16",
  84. [DEV_X32] = "x32",
  85. [DEV_X64] = "x64"
  86. };
  87. static const char * const edac_caps[] = {
  88. [EDAC_UNKNOWN] = "Unknown",
  89. [EDAC_NONE] = "None",
  90. [EDAC_RESERVED] = "Reserved",
  91. [EDAC_PARITY] = "PARITY",
  92. [EDAC_EC] = "EC",
  93. [EDAC_SECDED] = "SECDED",
  94. [EDAC_S2ECD2ED] = "S2ECD2ED",
  95. [EDAC_S4ECD4ED] = "S4ECD4ED",
  96. [EDAC_S8ECD8ED] = "S8ECD8ED",
  97. [EDAC_S16ECD16ED] = "S16ECD16ED"
  98. };
  99. /*
  100. * Per-dimm (or per-rank) devices
  101. */
  102. #define to_dimm(k) container_of(k, struct dimm_info, dev)
  103. /* show/store functions for DIMM Label attributes */
  104. static ssize_t dimmdev_location_show(struct device *dev,
  105. struct device_attribute *mattr, char *data)
  106. {
  107. struct dimm_info *dimm = to_dimm(dev);
  108. ssize_t count;
  109. count = edac_dimm_info_location(dimm, data, PAGE_SIZE);
  110. count += scnprintf(data + count, PAGE_SIZE - count, "\n");
  111. return count;
  112. }
  113. static ssize_t dimmdev_label_show(struct device *dev,
  114. struct device_attribute *mattr, char *data)
  115. {
  116. struct dimm_info *dimm = to_dimm(dev);
  117. /* if field has not been initialized, there is nothing to send */
  118. if (!dimm->label[0])
  119. return 0;
  120. return sysfs_emit(data, "%s\n", dimm->label);
  121. }
  122. static ssize_t dimmdev_label_store(struct device *dev,
  123. struct device_attribute *mattr,
  124. const char *data,
  125. size_t count)
  126. {
  127. struct dimm_info *dimm = to_dimm(dev);
  128. size_t copy_count = count;
  129. if (count == 0)
  130. return -EINVAL;
  131. if (data[count - 1] == '\0' || data[count - 1] == '\n')
  132. copy_count -= 1;
  133. if (copy_count == 0 || copy_count >= sizeof(dimm->label))
  134. return -EINVAL;
  135. memcpy(dimm->label, data, copy_count);
  136. dimm->label[copy_count] = '\0';
  137. return count;
  138. }
  139. static ssize_t dimmdev_size_show(struct device *dev,
  140. struct device_attribute *mattr, char *data)
  141. {
  142. struct dimm_info *dimm = to_dimm(dev);
  143. return sysfs_emit(data, "%u\n", PAGES_TO_MiB(dimm->nr_pages));
  144. }
  145. static ssize_t dimmdev_mem_type_show(struct device *dev,
  146. struct device_attribute *mattr, char *data)
  147. {
  148. struct dimm_info *dimm = to_dimm(dev);
  149. return sysfs_emit(data, "%s\n", edac_mem_types[dimm->mtype]);
  150. }
  151. static ssize_t dimmdev_dev_type_show(struct device *dev,
  152. struct device_attribute *mattr, char *data)
  153. {
  154. struct dimm_info *dimm = to_dimm(dev);
  155. return sysfs_emit(data, "%s\n", dev_types[dimm->dtype]);
  156. }
  157. static ssize_t dimmdev_edac_mode_show(struct device *dev,
  158. struct device_attribute *mattr,
  159. char *data)
  160. {
  161. struct dimm_info *dimm = to_dimm(dev);
  162. return sysfs_emit(data, "%s\n", edac_caps[dimm->edac_mode]);
  163. }
  164. static ssize_t dimmdev_ce_count_show(struct device *dev,
  165. struct device_attribute *mattr,
  166. char *data)
  167. {
  168. struct dimm_info *dimm = to_dimm(dev);
  169. return sysfs_emit(data, "%u\n", dimm->ce_count);
  170. }
  171. static ssize_t dimmdev_ue_count_show(struct device *dev,
  172. struct device_attribute *mattr,
  173. char *data)
  174. {
  175. struct dimm_info *dimm = to_dimm(dev);
  176. return sysfs_emit(data, "%u\n", dimm->ue_count);
  177. }
  178. /* dimm/rank attribute files */
  179. static DEVICE_ATTR(dimm_label, S_IRUGO | S_IWUSR,
  180. dimmdev_label_show, dimmdev_label_store);
  181. static DEVICE_ATTR(dimm_location, S_IRUGO, dimmdev_location_show, NULL);
  182. static DEVICE_ATTR(size, S_IRUGO, dimmdev_size_show, NULL);
  183. static DEVICE_ATTR(dimm_mem_type, S_IRUGO, dimmdev_mem_type_show, NULL);
  184. static DEVICE_ATTR(dimm_dev_type, S_IRUGO, dimmdev_dev_type_show, NULL);
  185. static DEVICE_ATTR(dimm_edac_mode, S_IRUGO, dimmdev_edac_mode_show, NULL);
  186. static DEVICE_ATTR(dimm_ce_count, S_IRUGO, dimmdev_ce_count_show, NULL);
  187. static DEVICE_ATTR(dimm_ue_count, S_IRUGO, dimmdev_ue_count_show, NULL);
  188. /* attributes of the dimm<id>/rank<id> object */
  189. static struct attribute *dimm_attrs[] = {
  190. &dev_attr_dimm_label.attr,
  191. &dev_attr_dimm_location.attr,
  192. &dev_attr_size.attr,
  193. &dev_attr_dimm_mem_type.attr,
  194. &dev_attr_dimm_dev_type.attr,
  195. &dev_attr_dimm_edac_mode.attr,
  196. &dev_attr_dimm_ce_count.attr,
  197. &dev_attr_dimm_ue_count.attr,
  198. NULL,
  199. };
  200. static const struct attribute_group dimm_attr_grp = {
  201. .attrs = dimm_attrs,
  202. };
  203. static const struct attribute_group *dimm_attr_groups[] = {
  204. &dimm_attr_grp,
  205. NULL
  206. };
  207. static const struct device_type dimm_attr_type = {
  208. .groups = dimm_attr_groups,
  209. };
  210. static void dimm_release(struct device *dev)
  211. {
  212. /*
  213. * Nothing to do, just unregister sysfs here. The mci
  214. * device owns the data and will also release it.
  215. */
  216. }
  217. /* Create a DIMM object under specified memory controller device */
  218. static int edac_create_dimm_object(struct mem_ctl_info *mci,
  219. struct dimm_info *dimm)
  220. {
  221. int err;
  222. dimm->mci = mci;
  223. dimm->dev.type = &dimm_attr_type;
  224. dimm->dev.release = dimm_release;
  225. device_initialize(&dimm->dev);
  226. dimm->dev.parent = &mci->dev;
  227. if (mci->csbased)
  228. dev_set_name(&dimm->dev, "rank%d", dimm->idx);
  229. else
  230. dev_set_name(&dimm->dev, "dimm%d", dimm->idx);
  231. dev_set_drvdata(&dimm->dev, dimm);
  232. pm_runtime_forbid(&mci->dev);
  233. err = device_add(&dimm->dev);
  234. if (err) {
  235. edac_dbg(1, "failure: create device %s\n", dev_name(&dimm->dev));
  236. put_device(&dimm->dev);
  237. return err;
  238. }
  239. if (IS_ENABLED(CONFIG_EDAC_DEBUG)) {
  240. char location[80];
  241. edac_dimm_info_location(dimm, location, sizeof(location));
  242. edac_dbg(0, "device %s created at location %s\n",
  243. dev_name(&dimm->dev), location);
  244. }
  245. return 0;
  246. }
  247. /*
  248. * Memory controller device
  249. */
  250. #define to_mci(k) container_of(k, struct mem_ctl_info, dev)
  251. static ssize_t mci_reset_counters_store(struct device *dev,
  252. struct device_attribute *mattr,
  253. const char *data, size_t count)
  254. {
  255. struct mem_ctl_info *mci = to_mci(dev);
  256. struct dimm_info *dimm;
  257. int row, chan;
  258. mci->ue_mc = 0;
  259. mci->ce_mc = 0;
  260. mci->ue_noinfo_count = 0;
  261. mci->ce_noinfo_count = 0;
  262. for (row = 0; row < mci->nr_csrows; row++) {
  263. struct csrow_info *ri = mci->csrows[row];
  264. ri->ue_count = 0;
  265. ri->ce_count = 0;
  266. for (chan = 0; chan < ri->nr_channels; chan++)
  267. ri->channels[chan]->ce_count = 0;
  268. }
  269. mci_for_each_dimm(mci, dimm) {
  270. dimm->ue_count = 0;
  271. dimm->ce_count = 0;
  272. }
  273. mci->start_time = jiffies;
  274. return count;
  275. }
  276. /* Memory scrubbing interface:
  277. *
  278. * A MC driver can limit the scrubbing bandwidth based on the CPU type.
  279. * Therefore, ->set_sdram_scrub_rate should be made to return the actual
  280. * bandwidth that is accepted or 0 when scrubbing is to be disabled.
  281. *
  282. * Negative value still means that an error has occurred while setting
  283. * the scrub rate.
  284. */
  285. static ssize_t mci_sdram_scrub_rate_store(struct device *dev,
  286. struct device_attribute *mattr,
  287. const char *data, size_t count)
  288. {
  289. struct mem_ctl_info *mci = to_mci(dev);
  290. unsigned long bandwidth = 0;
  291. int new_bw = 0;
  292. if (kstrtoul(data, 10, &bandwidth) < 0)
  293. return -EINVAL;
  294. new_bw = mci->set_sdram_scrub_rate(mci, bandwidth);
  295. if (new_bw < 0) {
  296. edac_printk(KERN_WARNING, EDAC_MC,
  297. "Error setting scrub rate to: %lu\n", bandwidth);
  298. return -EINVAL;
  299. }
  300. return count;
  301. }
  302. /*
  303. * ->get_sdram_scrub_rate() return value semantics same as above.
  304. */
  305. static ssize_t mci_sdram_scrub_rate_show(struct device *dev,
  306. struct device_attribute *mattr,
  307. char *data)
  308. {
  309. struct mem_ctl_info *mci = to_mci(dev);
  310. int bandwidth = 0;
  311. bandwidth = mci->get_sdram_scrub_rate(mci);
  312. if (bandwidth < 0) {
  313. edac_printk(KERN_DEBUG, EDAC_MC, "Error reading scrub rate\n");
  314. return bandwidth;
  315. }
  316. return sysfs_emit(data, "%d\n", bandwidth);
  317. }
  318. /* default attribute files for the MCI object */
  319. static ssize_t mci_ue_count_show(struct device *dev,
  320. struct device_attribute *mattr,
  321. char *data)
  322. {
  323. struct mem_ctl_info *mci = to_mci(dev);
  324. return sysfs_emit(data, "%u\n", mci->ue_mc);
  325. }
  326. static ssize_t mci_ce_count_show(struct device *dev,
  327. struct device_attribute *mattr,
  328. char *data)
  329. {
  330. struct mem_ctl_info *mci = to_mci(dev);
  331. return sysfs_emit(data, "%u\n", mci->ce_mc);
  332. }
  333. static ssize_t mci_ce_noinfo_show(struct device *dev,
  334. struct device_attribute *mattr,
  335. char *data)
  336. {
  337. struct mem_ctl_info *mci = to_mci(dev);
  338. return sysfs_emit(data, "%u\n", mci->ce_noinfo_count);
  339. }
  340. static ssize_t mci_ue_noinfo_show(struct device *dev,
  341. struct device_attribute *mattr,
  342. char *data)
  343. {
  344. struct mem_ctl_info *mci = to_mci(dev);
  345. return sysfs_emit(data, "%u\n", mci->ue_noinfo_count);
  346. }
  347. static ssize_t mci_seconds_show(struct device *dev,
  348. struct device_attribute *mattr,
  349. char *data)
  350. {
  351. struct mem_ctl_info *mci = to_mci(dev);
  352. return sysfs_emit(data, "%ld\n", (jiffies - mci->start_time) / HZ);
  353. }
  354. static ssize_t mci_ctl_name_show(struct device *dev,
  355. struct device_attribute *mattr,
  356. char *data)
  357. {
  358. struct mem_ctl_info *mci = to_mci(dev);
  359. return sysfs_emit(data, "%s\n", mci->ctl_name);
  360. }
  361. static ssize_t mci_size_mb_show(struct device *dev,
  362. struct device_attribute *mattr,
  363. char *data)
  364. {
  365. struct mem_ctl_info *mci = to_mci(dev);
  366. int total_pages = 0, csrow_idx, j;
  367. for (csrow_idx = 0; csrow_idx < mci->nr_csrows; csrow_idx++) {
  368. struct csrow_info *csrow = mci->csrows[csrow_idx];
  369. for (j = 0; j < csrow->nr_channels; j++) {
  370. struct dimm_info *dimm = csrow->channels[j]->dimm;
  371. total_pages += dimm->nr_pages;
  372. }
  373. }
  374. return sysfs_emit(data, "%u\n", PAGES_TO_MiB(total_pages));
  375. }
  376. static ssize_t mci_max_location_show(struct device *dev,
  377. struct device_attribute *mattr,
  378. char *data)
  379. {
  380. struct mem_ctl_info *mci = to_mci(dev);
  381. int len = PAGE_SIZE;
  382. char *p = data;
  383. int i, n;
  384. for (i = 0; i < mci->n_layers; i++) {
  385. n = scnprintf(p, len, "%s %d ",
  386. edac_layer_name[mci->layers[i].type],
  387. mci->layers[i].size - 1);
  388. len -= n;
  389. if (len <= 0)
  390. goto out;
  391. p += n;
  392. }
  393. p += scnprintf(p, len, "\n");
  394. out:
  395. return p - data;
  396. }
  397. /* default Control file */
  398. static DEVICE_ATTR(reset_counters, S_IWUSR, NULL, mci_reset_counters_store);
  399. /* default Attribute files */
  400. static DEVICE_ATTR(mc_name, S_IRUGO, mci_ctl_name_show, NULL);
  401. static DEVICE_ATTR(size_mb, S_IRUGO, mci_size_mb_show, NULL);
  402. static DEVICE_ATTR(seconds_since_reset, S_IRUGO, mci_seconds_show, NULL);
  403. static DEVICE_ATTR(ue_noinfo_count, S_IRUGO, mci_ue_noinfo_show, NULL);
  404. static DEVICE_ATTR(ce_noinfo_count, S_IRUGO, mci_ce_noinfo_show, NULL);
  405. static DEVICE_ATTR(ue_count, S_IRUGO, mci_ue_count_show, NULL);
  406. static DEVICE_ATTR(ce_count, S_IRUGO, mci_ce_count_show, NULL);
  407. static DEVICE_ATTR(max_location, S_IRUGO, mci_max_location_show, NULL);
  408. /* memory scrubber attribute file */
  409. static DEVICE_ATTR(sdram_scrub_rate, 0, mci_sdram_scrub_rate_show,
  410. mci_sdram_scrub_rate_store); /* umode set later in is_visible */
  411. static struct attribute *mci_attrs[] = {
  412. &dev_attr_reset_counters.attr,
  413. &dev_attr_mc_name.attr,
  414. &dev_attr_size_mb.attr,
  415. &dev_attr_seconds_since_reset.attr,
  416. &dev_attr_ue_noinfo_count.attr,
  417. &dev_attr_ce_noinfo_count.attr,
  418. &dev_attr_ue_count.attr,
  419. &dev_attr_ce_count.attr,
  420. &dev_attr_max_location.attr,
  421. &dev_attr_sdram_scrub_rate.attr,
  422. NULL
  423. };
  424. static umode_t mci_attr_is_visible(struct kobject *kobj,
  425. struct attribute *attr, int idx)
  426. {
  427. struct device *dev = kobj_to_dev(kobj);
  428. struct mem_ctl_info *mci = to_mci(dev);
  429. umode_t mode = 0;
  430. if (attr != &dev_attr_sdram_scrub_rate.attr)
  431. return attr->mode;
  432. if (mci->get_sdram_scrub_rate)
  433. mode |= S_IRUGO;
  434. if (mci->set_sdram_scrub_rate)
  435. mode |= S_IWUSR;
  436. return mode;
  437. }
  438. static const struct attribute_group mci_attr_grp = {
  439. .attrs = mci_attrs,
  440. .is_visible = mci_attr_is_visible,
  441. };
  442. static const struct attribute_group *mci_attr_groups[] = {
  443. &mci_attr_grp,
  444. NULL
  445. };
  446. static const struct device_type mci_attr_type = {
  447. .groups = mci_attr_groups,
  448. };
  449. /*
  450. * Create a new Memory Controller kobject instance,
  451. * mc<id> under the 'mc' directory
  452. *
  453. * Return:
  454. * 0 Success
  455. * !0 Failure
  456. */
  457. int edac_create_sysfs_mci_device(struct mem_ctl_info *mci,
  458. const struct attribute_group **groups)
  459. {
  460. struct dimm_info *dimm;
  461. int err;
  462. /* get the /sys/devices/system/edac subsys reference */
  463. mci->dev.type = &mci_attr_type;
  464. mci->dev.parent = mci_pdev;
  465. mci->dev.groups = groups;
  466. dev_set_name(&mci->dev, "mc%d", mci->mc_idx);
  467. dev_set_drvdata(&mci->dev, mci);
  468. pm_runtime_forbid(&mci->dev);
  469. err = device_add(&mci->dev);
  470. if (err < 0) {
  471. edac_dbg(1, "failure: create device %s\n", dev_name(&mci->dev));
  472. /* no put_device() here, free mci with _edac_mc_free() */
  473. return err;
  474. }
  475. edac_dbg(0, "device %s created\n", dev_name(&mci->dev));
  476. /*
  477. * Create the dimm/rank devices
  478. */
  479. mci_for_each_dimm(mci, dimm) {
  480. /* Only expose populated DIMMs */
  481. if (!dimm->nr_pages)
  482. continue;
  483. err = edac_create_dimm_object(mci, dimm);
  484. if (err)
  485. goto fail;
  486. }
  487. edac_create_debugfs_nodes(mci);
  488. return 0;
  489. fail:
  490. edac_remove_sysfs_mci_device(mci);
  491. return err;
  492. }
  493. /*
  494. * remove a Memory Controller instance
  495. */
  496. void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci)
  497. {
  498. struct dimm_info *dimm;
  499. if (!device_is_registered(&mci->dev))
  500. return;
  501. edac_dbg(0, "\n");
  502. #ifdef CONFIG_EDAC_DEBUG
  503. edac_debugfs_remove_recursive(mci->debugfs);
  504. #endif
  505. mci_for_each_dimm(mci, dimm) {
  506. if (!device_is_registered(&dimm->dev))
  507. continue;
  508. edac_dbg(1, "unregistering device %s\n", dev_name(&dimm->dev));
  509. device_unregister(&dimm->dev);
  510. }
  511. /* only remove the device, but keep mci */
  512. device_del(&mci->dev);
  513. }
  514. static void mc_attr_release(struct device *dev)
  515. {
  516. /*
  517. * There's no container structure here, as this is just the mci
  518. * parent device, used to create the /sys/devices/mc sysfs node.
  519. * So, there are no attributes on it.
  520. */
  521. edac_dbg(1, "device %s released\n", dev_name(dev));
  522. kfree(dev);
  523. }
  524. /*
  525. * Init/exit code for the module. Basically, creates/removes /sys/class/rc
  526. */
  527. int __init edac_mc_sysfs_init(void)
  528. {
  529. int err;
  530. mci_pdev = kzalloc_obj(*mci_pdev);
  531. if (!mci_pdev)
  532. return -ENOMEM;
  533. mci_pdev->bus = edac_get_sysfs_subsys();
  534. mci_pdev->release = mc_attr_release;
  535. mci_pdev->init_name = "mc";
  536. err = device_register(mci_pdev);
  537. if (err < 0) {
  538. edac_dbg(1, "failure: create device %s\n", dev_name(mci_pdev));
  539. put_device(mci_pdev);
  540. return err;
  541. }
  542. edac_dbg(0, "device %s created\n", dev_name(mci_pdev));
  543. return 0;
  544. }
  545. void edac_mc_sysfs_exit(void)
  546. {
  547. device_unregister(mci_pdev);
  548. }