Skip to content

Commit 05b8773

Browse files
dangowrtrichardweinberger
authored andcommitted
mtd: ubi: block: wire-up device parent
ubiblock devices were previously only identifyable by their name, but not connected to their parent UBI volume device e.g. in sysfs. Properly parent ubiblock device as descendant of a UBI volume device to reflect device model hierachy. Signed-off-by: Daniel Golle <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent 1ecf9e3 commit 05b8773

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

drivers/mtd/ubi/block.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ int ubiblock_create(struct ubi_volume_info *vi)
419419
list_add_tail(&dev->list, &ubiblock_devices);
420420

421421
/* Must be the last step: anyone can call file ops from now on */
422-
ret = add_disk(dev->gd);
422+
ret = device_add_disk(vi->dev, dev->gd, NULL);
423423
if (ret)
424424
goto out_remove_minor;
425425

drivers/mtd/ubi/kapi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ void ubi_do_get_volume_info(struct ubi_device *ubi, struct ubi_volume *vol,
7979
vi->name_len = vol->name_len;
8080
vi->name = vol->name;
8181
vi->cdev = vol->cdev.dev;
82+
vi->dev = &vol->dev;
8283
}
8384

8485
/**

include/linux/mtd/ubi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ struct ubi_volume_info {
110110
int name_len;
111111
const char *name;
112112
dev_t cdev;
113+
struct device *dev;
113114
};
114115

115116
/**

0 commit comments

Comments
 (0)