Skip to content

Commit 45b0907

Browse files
Kevin CernekeeDavid Woodhouse
authored andcommitted
[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/107 Signed-off-by: Kevin Cernekee <kpc.mtd@gmail.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent c451c7c commit 45b0907

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎drivers/mtd/mtdcore.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,8 @@ static int mtd_read_proc (char *page, char **start, off_t off, int count,
585585
return ((count < begin+len-off) ? count : begin+len-off);
586586
}
587587

588+
#endif /* CONFIG_PROC_FS */
589+
588590
/*====================================================================*/
589591
/* Init code */
590592

@@ -596,24 +598,25 @@ static int __init init_mtd(void)
596598
pr_err("Error creating mtd class.\n");
597599
return PTR_ERR(mtd_class);
598600
}
601+
#ifdef CONFIG_PROC_FS
599602
if ((proc_mtd = create_proc_entry( "mtd", 0, NULL )))
600603
proc_mtd->read_proc = mtd_read_proc;
604+
#endif /* CONFIG_PROC_FS */
601605
return 0;
602606
}
603607

604608
static void __exit cleanup_mtd(void)
605609
{
610+
#ifdef CONFIG_PROC_FS
606611
if (proc_mtd)
607612
remove_proc_entry( "mtd", NULL);
613+
#endif /* CONFIG_PROC_FS */
608614
class_destroy(mtd_class);
609615
}
610616

611617
module_init(init_mtd);
612618
module_exit(cleanup_mtd);
613619

614-
#endif /* CONFIG_PROC_FS */
615-
616-
617620
MODULE_LICENSE("GPL");
618621
MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
619622
MODULE_DESCRIPTION("Core MTD registration and access routines");

0 commit comments

Comments
 (0)