From: Daniel Golle Date: Thu, 22 Dec 2022 19:33:31 +0000 (+0000) Subject: mtd: ubi: block: wire-up device parent X-Git-Tag: v6.6.17~5391^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=05b8773ca33253ea562be145cf3145b05ef19f86;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Richard Weinberger --- diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c index f5d0362..6a9eb2c 100644 --- a/drivers/mtd/ubi/block.c +++ b/drivers/mtd/ubi/block.c @@ -419,7 +419,7 @@ int ubiblock_create(struct ubi_volume_info *vi) list_add_tail(&dev->list, &ubiblock_devices); /* Must be the last step: anyone can call file ops from now on */ - ret = add_disk(dev->gd); + ret = device_add_disk(vi->dev, dev->gd, NULL); if (ret) goto out_remove_minor; diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c index 0fce99f..5db653e 100644 --- a/drivers/mtd/ubi/kapi.c +++ b/drivers/mtd/ubi/kapi.c @@ -79,6 +79,7 @@ void ubi_do_get_volume_info(struct ubi_device *ubi, struct ubi_volume *vol, vi->name_len = vol->name_len; vi->name = vol->name; vi->cdev = vol->cdev.dev; + vi->dev = &vol->dev; } /** diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h index 7d48ea3..a529347 100644 --- a/include/linux/mtd/ubi.h +++ b/include/linux/mtd/ubi.h @@ -110,6 +110,7 @@ struct ubi_volume_info { int name_len; const char *name; dev_t cdev; + struct device *dev; }; /**