1 From 05b8773ca33253ea562be145cf3145b05ef19f86 Mon Sep 17 00:00:00 2001
2 From: Daniel Golle <daniel@makrotopia.org>
3 Date: Thu, 22 Dec 2022 19:33:31 +0000
4 Subject: [PATCH] mtd: ubi: block: wire-up device parent
6 ubiblock devices were previously only identifyable by their name, but
7 not connected to their parent UBI volume device e.g. in sysfs.
8 Properly parent ubiblock device as descendant of a UBI volume device
9 to reflect device model hierachy.
11 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
12 Signed-off-by: Richard Weinberger <richard@nod.at>
14 drivers/mtd/ubi/block.c | 2 +-
15 drivers/mtd/ubi/kapi.c | 1 +
16 include/linux/mtd/ubi.h | 1 +
17 3 files changed, 3 insertions(+), 1 deletion(-)
19 --- a/drivers/mtd/ubi/block.c
20 +++ b/drivers/mtd/ubi/block.c
21 @@ -452,7 +452,7 @@ int ubiblock_create(struct ubi_volume_in
22 list_add_tail(&dev->list, &ubiblock_devices);
24 /* Must be the last step: anyone can call file ops from now on */
25 - ret = add_disk(dev->gd);
26 + ret = device_add_disk(vi->dev, dev->gd, NULL);
30 --- a/drivers/mtd/ubi/kapi.c
31 +++ b/drivers/mtd/ubi/kapi.c
32 @@ -79,6 +79,7 @@ void ubi_do_get_volume_info(struct ubi_d
33 vi->name_len = vol->name_len;
35 vi->cdev = vol->cdev.dev;
36 + vi->dev = &vol->dev;
40 --- a/include/linux/mtd/ubi.h
41 +++ b/include/linux/mtd/ubi.h
42 @@ -110,6 +110,7 @@ struct ubi_volume_info {