kernel/3.1[02]: move MTD root device setup code to mtdcore
[openwrt/svn-archive/archive.git] / target / linux / generic / patches-3.10 / 480-mtd-set-rootfs-to-be-root-dev.patch
1 --- a/drivers/mtd/mtdcore.c
2 +++ b/drivers/mtd/mtdcore.c
3 @@ -37,6 +37,7 @@
4 #include <linux/backing-dev.h>
5 #include <linux/gfp.h>
6 #include <linux/slab.h>
7 +#include <linux/root_dev.h>
8
9 #include <linux/mtd/mtd.h>
10 #include <linux/mtd/partitions.h>
11 @@ -408,6 +409,15 @@ int add_mtd_device(struct mtd_info *mtd)
12 of this try_ nonsense, and no bitching about it
13 either. :) */
14 __module_get(THIS_MODULE);
15 +
16 + if (!strcmp(mtd->name, "rootfs") &&
17 + config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) &&
18 + ROOT_DEV == 0) {
19 + pr_notice("mtd: device %d (%s) set to be root filesystem\n",
20 + mtd->index, mtd->name);
21 + ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index);
22 + }
23 +
24 return 0;
25
26 fail_added: