diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2020-10-30 08:36:00 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-11-09 13:00:24 +0100 |
commit | 10227d518c8a967e5cc552d24545e0ca2c59f84e (patch) | |
tree | 8339f75472620aab767f8e6de090df0418800393 /drivers/mtd/core.c | |
parent | 4d3c779dfcc7a0ae45e957a521307d731d90d742 (diff) | |
download | barebox-10227d518c8a967e5cc552d24545e0ca2c59f84e.tar.gz barebox-10227d518c8a967e5cc552d24545e0ca2c59f84e.tar.xz |
mtd: Use classdev->parent
Instead of mtd->parent we can use mtd->classdev.parent which points to
the same device. With this we can remove the 'parent' member of struct
mtd_info. This member exists in the Linux kernel as well, but is of type
struct mtd_info, so this is done as preparation to re-add mtd->parent
with the same type as in Linux.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mtd/core.c')
-rw-r--r-- | drivers/mtd/core.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c index 71c602dbb7..fe7952c803 100644 --- a/drivers/mtd/core.c +++ b/drivers/mtd/core.c @@ -619,8 +619,6 @@ int add_mtd_device(struct mtd_info *mtd, const char *devname, int device_id) devname = "mtd"; dev_set_name(&mtd->class_dev, devname); mtd->class_dev.id = device_id; - if (mtd->parent) - mtd->class_dev.parent = mtd->parent; if (IS_ENABLED(CONFIG_MTD_UBI)) mtd->class_dev.detect = mtd_detect; @@ -673,11 +671,11 @@ int add_mtd_device(struct mtd_info *mtd, const char *devname, int device_id) if (mtd_can_have_bb(mtd)) mtd->cdev_bb = mtd_add_bb(mtd, NULL); - if (mtd->parent && !mtd->master) { + if (mtd->class_dev.parent && !mtd->master) { dev_add_param_string(&mtd->class_dev, "partitions", mtd_partition_set, mtd_partition_get, &mtd->partition_string, mtd); - of_parse_partitions(&mtd->cdev, mtd->parent->device_node); - if (IS_ENABLED(CONFIG_OFDEVICE) && mtd->parent->device_node) { - mtd->of_path = xstrdup(mtd->parent->device_node->full_name); + of_parse_partitions(&mtd->cdev, mtd->class_dev.parent->device_node); + if (IS_ENABLED(CONFIG_OFDEVICE) && mtd->class_dev.parent->device_node) { + mtd->of_path = xstrdup(mtd->class_dev.parent->device_node->full_name); ret = of_partitions_register_fixup(&mtd->cdev); if (ret) goto err1; |