summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-06-26 08:31:14 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-06-26 09:21:36 +0200
commitadb3c6359d3514596e980199edbd311ed2d0de5e (patch)
tree2bf427a6ace749ab6ee2833f1548c16070a8d1a2 /drivers/mtd/ubi
parent292c9e655a8493f7decf14343542cac387c5999a (diff)
downloadbarebox-adb3c6359d3514596e980199edbd311ed2d0de5e.tar.gz
barebox-adb3c6359d3514596e980199edbd311ed2d0de5e.tar.xz
ubi: Use preditable device names
Instead of naming all ubi devices and cdev names ubi<num> append '.ubi' to the original mtd name. This makes ubi device and cdev names predictable. With this ubi0 becomes nand0.root.ubi. Also do the same for volume names, so ubi0.root becomes nand0.root.ubi.root. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mtd/ubi')
-rw-r--r--drivers/mtd/ubi/build.c7
-rw-r--r--drivers/mtd/ubi/cdev.c4
2 files changed, 4 insertions, 7 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index b02880eb79..1074feb4b8 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -155,8 +155,8 @@ static int uif_init(struct ubi_device *ubi, int *ref)
*ref = 0;
sprintf(ubi->ubi_name, UBI_NAME_STR "%d", ubi->ubi_num);
- sprintf(ubi->dev.name, "ubi");
- ubi->dev.id = DEVICE_ID_DYNAMIC;
+ sprintf(ubi->dev.name, "%s.ubi", ubi->mtd->cdev.name);
+ ubi->dev.id = DEVICE_ID_SINGLE;
ubi->dev.parent = &ubi->mtd->class_dev;
err = register_device(&ubi->dev);
@@ -596,9 +596,6 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
#else
ubi->fm_disabled = 1;
#endif
-
- ubi_msg("attaching mtd%d to ubi%d", mtd->index, ubi_num);
-
err = io_init(ubi, max_beb_per1024);
if (err)
goto out_free;
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index 90d5b2dd66..fe71a8d609 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -176,7 +176,7 @@ int ubi_volume_cdev_add(struct ubi_device *ubi, struct ubi_volume *vol)
priv->ubi = ubi;
cdev->ops = &ubi_volume_fops;
- cdev->name = asprintf("ubi%d.%s", ubi->ubi_num, vol->name);
+ cdev->name = asprintf("%s.%s", ubi->cdev.name, vol->name);
cdev->priv = priv;
cdev->size = vol->used_bytes;
cdev->dev = &vol->dev;
@@ -239,7 +239,7 @@ int ubi_cdev_add(struct ubi_device *ubi)
int ret;
cdev->ops = &ubi_fops;
- cdev->name = asprintf("ubi%d", ubi->ubi_num);
+ cdev->name = asprintf("%s.ubi", ubi->mtd->cdev.name);
cdev->priv = ubi;
cdev->size = 0;