kernel: generic: add kernel 4.3
[openwrt.git] / target / linux / generic / patches-4.3 / 480-mtd-set-rootfs-to-be-root-dev.patch
1 --- a/drivers/mtd/mtdcore.c
2 +++ b/drivers/mtd/mtdcore.c
3 @@ -39,6 +39,7 @@
4  #include <linux/slab.h>
5  #include <linux/reboot.h>
6  #include <linux/kconfig.h>
7 +#include <linux/root_dev.h>
8  
9  #include <linux/mtd/mtd.h>
10  #include <linux/mtd/partitions.h>
11 @@ -456,6 +457,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: