kernel: bump 5.4 to 5.4.92
[openwrt/openwrt.git] / target / linux / generic / pending-5.4 / 493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch
1 From: Daniel Golle <daniel@makrotopia.org>
2 Subject: ubi: set ROOT_DEV to ubiblock "rootfs" if unset
3
4 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
5 ---
6 drivers/mtd/ubi/block.c | 10 ++++++++++
7 1 file changed, 10 insertions(+)
8
9 --- a/drivers/mtd/ubi/block.c
10 +++ b/drivers/mtd/ubi/block.c
11 @@ -42,6 +42,7 @@
12 #include <linux/scatterlist.h>
13 #include <linux/idr.h>
14 #include <asm/div64.h>
15 +#include <linux/root_dev.h>
16
17 #include "ubi-media.h"
18 #include "ubi.h"
19 @@ -458,6 +459,15 @@ int ubiblock_create(struct ubi_volume_in
20 dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)",
21 dev->ubi_num, dev->vol_id, vi->name);
22 mutex_unlock(&devices_mutex);
23 +
24 + if (!strcmp(vi->name, "rootfs") &&
25 + IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) &&
26 + ROOT_DEV == 0) {
27 + pr_notice("ubiblock: device ubiblock%d_%d (%s) set to be root filesystem\n",
28 + dev->ubi_num, dev->vol_id, vi->name);
29 + ROOT_DEV = MKDEV(gd->major, gd->first_minor);
30 + }
31 +
32 return 0;
33
34 out_free_queue: