File tree Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -899,13 +899,33 @@ static struct device_type mci_attr_type = {
899899};
900900
901901#ifdef CONFIG_EDAC_DEBUG
902+ static struct dentry * edac_debugfs ;
903+
904+ int __init edac_debugfs_init (void )
905+ {
906+ edac_debugfs = debugfs_create_dir ("edac" , NULL );
907+ if (IS_ERR (edac_debugfs )) {
908+ edac_debugfs = NULL ;
909+ return - ENOMEM ;
910+ }
911+ return 0 ;
912+ }
913+
914+ void __exit edac_debugfs_exit (void )
915+ {
916+ debugfs_remove (edac_debugfs );
917+ }
918+
902919int edac_create_debug_nodes (struct mem_ctl_info * mci )
903920{
904921 struct dentry * d , * parent ;
905922 char name [80 ];
906923 int i ;
907924
908- d = debugfs_create_dir (mci -> dev .kobj .name , mci -> debugfs );
925+ if (!edac_debugfs )
926+ return - ENODEV ;
927+
928+ d = debugfs_create_dir (mci -> dev .kobj .name , edac_debugfs );
909929 if (!d )
910930 return - ENOMEM ;
911931 parent = d ;
@@ -930,6 +950,7 @@ int edac_create_debug_nodes(struct mem_ctl_info *mci)
930950 if (!d )
931951 goto nomem ;
932952
953+ mci -> debugfs = parent ;
933954 return 0 ;
934955nomem :
935956 debugfs_remove (mci -> debugfs );
Original file line number Diff line number Diff line change @@ -94,6 +94,8 @@ static int __init edac_init(void)
9494 if (err )
9595 goto error ;
9696
97+ edac_debugfs_init ();
98+
9799 /* Setup/Initialize the workq for this core */
98100 err = edac_workqueue_setup ();
99101 if (err ) {
@@ -118,6 +120,7 @@ static void __exit edac_exit(void)
118120 /* tear down the various subsystems */
119121 edac_workqueue_teardown ();
120122 edac_mc_sysfs_exit ();
123+ edac_debugfs_exit ();
121124}
122125
123126/*
Original file line number Diff line number Diff line change @@ -56,6 +56,20 @@ extern void edac_mc_reset_delay_period(int value);
5656
5757extern void * edac_align_ptr (void * * p , unsigned size , int n_elems );
5858
59+ /*
60+ * EDAC debugfs functions
61+ */
62+ #ifdef CONFIG_EDAC_DEBUG
63+ int edac_debugfs_init (void );
64+ void edac_debugfs_exit (void );
65+ #else
66+ static inline int edac_debugfs_init (void )
67+ {
68+ return - ENODEV ;
69+ }
70+ static inline void edac_debugfs_exit (void ) {}
71+ #endif
72+
5973/*
6074 * EDAC PCI functions
6175 */
You can’t perform that action at this time.
0 commit comments