OpenWrt – Blame information for rev 2
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | From: Gabor Juhos <juhosg@openwrt.org> |
2 | Subject: kernel/3.1[02]: move MTD root device setup code to mtdcore |
||
3 | |||
4 | The current code only allows to automatically set |
||
5 | root device on MTD partitions. Move the code to MTD |
||
6 | core to allow to use it with all MTD devices. |
||
7 | |||
8 | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> |
||
9 | --- |
||
10 | drivers/mtd/mtdcore.c | 10 ++++++++++ |
||
11 | 1 file changed, 10 insertions(+) |
||
12 | |||
13 | --- a/drivers/mtd/mtdcore.c |
||
14 | +++ b/drivers/mtd/mtdcore.c |
||
15 | @@ -40,6 +40,7 @@ |
||
16 | #include <linux/slab.h> |
||
17 | #include <linux/reboot.h> |
||
18 | #include <linux/leds.h> |
||
19 | +#include <linux/root_dev.h> |
||
20 | |||
21 | #include <linux/mtd/mtd.h> |
||
22 | #include <linux/mtd/partitions.h> |
||
23 | @@ -570,6 +571,15 @@ int add_mtd_device(struct mtd_info *mtd) |
||
24 | of this try_ nonsense, and no bitching about it |
||
25 | either. :) */ |
||
26 | __module_get(THIS_MODULE); |
||
27 | + |
||
28 | + if (!strcmp(mtd->name, "rootfs") && |
||
29 | + IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) && |
||
30 | + ROOT_DEV == 0) { |
||
31 | + pr_notice("mtd: device %d (%s) set to be root filesystem\n", |
||
32 | + mtd->index, mtd->name); |
||
33 | + ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index); |
||
34 | + } |
||
35 | + |
||
36 | return 0; |
||
37 | |||
38 | fail_added: |