ath79: add support for Huawei AP5030DN
[openwrt/openwrt.git] / target / linux / generic / backport-6.1 / 424-v6.3-mtd-ubi-wire-up-parent-MTD-device.patch
1 From 1ecf9e390452e73a362ea7fbde8f3f0db83de856 Mon Sep 17 00:00:00 2001
2 From: Daniel Golle <daniel@makrotopia.org>
3 Date: Thu, 22 Dec 2022 19:33:04 +0000
4 Subject: [PATCH] mtd: ubi: wire-up parent MTD device
5
6 Wire up the device parent pointer of UBI devices to their lower MTD
7 device, typically an MTD partition or whole-chip device.
8
9 The most noticeable change is that in sysfs, previously ubi devices
10 would be could in /sys/devices/virtual/ubi while after this change they
11 would be correctly attached to their parent MTD device, e.g.
12
13 /sys/devices/platform/1100d000.spi/spi_master/spi1/spi1.0/mtd/mtd2/ubi0.
14
15 Locating UBI devices using /sys/class/ubi/ of course still works as
16 well.
17
18 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
19 Signed-off-by: Richard Weinberger <richard@nod.at>
20 ---
21 drivers/mtd/ubi/build.c | 1 +
22 1 file changed, 1 insertion(+)
23
24 --- a/drivers/mtd/ubi/build.c
25 +++ b/drivers/mtd/ubi/build.c
26 @@ -929,6 +929,7 @@ int ubi_attach_mtd_dev(struct mtd_info *
27 ubi->dev.release = dev_release;
28 ubi->dev.class = &ubi_class;
29 ubi->dev.groups = ubi_dev_groups;
30 + ubi->dev.parent = &mtd->dev;
31
32 ubi->mtd = mtd;
33 ubi->ubi_num = ubi_num;