aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2021-04-12 21:40:35 +0100
committerDaniel Golle <daniel@makrotopia.org>2021-04-12 22:19:49 +0100
commite9c8c834de60a9199a41664c06430e74d15f2973 (patch)
tree7229a679f0987f3c34eb8f8476130fd326a08dfe /target/linux/generic
parent9aa66b8ce730aebff76d353392151708a897a3a0 (diff)
downloadupstream-e9c8c834de60a9199a41664c06430e74d15f2973.tar.gz
upstream-e9c8c834de60a9199a41664c06430e74d15f2973.tar.bz2
upstream-e9c8c834de60a9199a41664c06430e74d15f2973.zip
kernel: fix deferred mtdblock registration
Check if gendisk is already up instead of trying to figure out parent mtd device (which didn't work well). Reported-by: DENG Qingfang <dqfext@gmail.com> Reported-by: Koen Vandeputte <koen.vandeputte@citymesh.com> Fixes: 2809d0000744 ("kernel: support FIT partition parser on mtdblock devices") Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'target/linux/generic')
-rw-r--r--target/linux/generic/hack-5.10/402-mtd-blktrans-call-add-disks-after-mtd-device.patch19
1 files changed, 7 insertions, 12 deletions
diff --git a/target/linux/generic/hack-5.10/402-mtd-blktrans-call-add-disks-after-mtd-device.patch b/target/linux/generic/hack-5.10/402-mtd-blktrans-call-add-disks-after-mtd-device.patch
index 77ecd9b72f..c8c86ad255 100644
--- a/target/linux/generic/hack-5.10/402-mtd-blktrans-call-add-disks-after-mtd-device.patch
+++ b/target/linux/generic/hack-5.10/402-mtd-blktrans-call-add-disks-after-mtd-device.patch
@@ -39,24 +39,19 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
return 0;
error4:
kfree(new->tag_set);
-@@ -475,6 +468,32 @@ error1:
+@@ -475,6 +468,27 @@ error1:
return ret;
}
-+void register_mtd_blktrans_devs(struct mtd_info *mtd)
++void register_mtd_blktrans_devs(void)
+{
+ struct mtd_blktrans_ops *tr;
+ struct mtd_blktrans_dev *dev, *next;
-+ struct mtd_info *top_mtd;
+ int ret;
+
+ list_for_each_entry(tr, &blktrans_majors, list) {
+ list_for_each_entry_safe(dev, next, &tr->devs, list) {
-+ top_mtd = dev->mtd;
-+ while (top_mtd->parent)
-+ top_mtd = top_mtd->parent;
-+
-+ if (mtd->index != top_mtd->index)
++ if (dev->disk->flags & GENHD_FL_UP)
+ continue;
+
+ device_add_disk(&dev->mtd->dev, dev->disk, NULL);
@@ -86,18 +81,18 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
register_reboot_notifier(&mtd->reboot_notifier);
}
-+ register_mtd_blktrans_devs(mtd);
++ register_mtd_blktrans_devs();
+
out:
if (ret && device_is_registered(&mtd->dev))
del_mtd_device(mtd);
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
-@@ -76,6 +76,7 @@ extern int deregister_mtd_blktrans(struc
+@@ -76,6 +76,6 @@ extern int deregister_mtd_blktrans(struc
extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
extern int mtd_blktrans_cease_background(struct mtd_blktrans_dev *dev);
-+extern void register_mtd_blktrans_devs(struct mtd_info *mtd);
-
+-
++extern void register_mtd_blktrans_devs(void);
#endif /* __MTD_TRANS_H__ */