Commit 45b09076 authored by Kevin Cernekee's avatar Kevin Cernekee Committed by David Woodhouse

[MTD] sysfs support should not depend on CONFIG_PROC_FS

Move the driver model init code out of the "#ifdef CONFIG_PROC_FS"
block.

Tested with both values of CONFIG_PROC_FS .  Tested with CONFIG_MTD=m .

Issue was reported here: http://lkml.org/lkml/2009/4/4/107Signed-off-by: default avatarKevin Cernekee <kpc.mtd@gmail.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent c451c7c4
...@@ -585,6 +585,8 @@ static int mtd_read_proc (char *page, char **start, off_t off, int count, ...@@ -585,6 +585,8 @@ static int mtd_read_proc (char *page, char **start, off_t off, int count,
return ((count < begin+len-off) ? count : begin+len-off); return ((count < begin+len-off) ? count : begin+len-off);
} }
#endif /* CONFIG_PROC_FS */
/*====================================================================*/ /*====================================================================*/
/* Init code */ /* Init code */
...@@ -596,24 +598,25 @@ static int __init init_mtd(void) ...@@ -596,24 +598,25 @@ static int __init init_mtd(void)
pr_err("Error creating mtd class.\n"); pr_err("Error creating mtd class.\n");
return PTR_ERR(mtd_class); return PTR_ERR(mtd_class);
} }
#ifdef CONFIG_PROC_FS
if ((proc_mtd = create_proc_entry( "mtd", 0, NULL ))) if ((proc_mtd = create_proc_entry( "mtd", 0, NULL )))
proc_mtd->read_proc = mtd_read_proc; proc_mtd->read_proc = mtd_read_proc;
#endif /* CONFIG_PROC_FS */
return 0; return 0;
} }
static void __exit cleanup_mtd(void) static void __exit cleanup_mtd(void)
{ {
#ifdef CONFIG_PROC_FS
if (proc_mtd) if (proc_mtd)
remove_proc_entry( "mtd", NULL); remove_proc_entry( "mtd", NULL);
#endif /* CONFIG_PROC_FS */
class_destroy(mtd_class); class_destroy(mtd_class);
} }
module_init(init_mtd); module_init(init_mtd);
module_exit(cleanup_mtd); module_exit(cleanup_mtd);
#endif /* CONFIG_PROC_FS */
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>"); MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
MODULE_DESCRIPTION("Core MTD registration and access routines"); MODULE_DESCRIPTION("Core MTD registration and access routines");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment