mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 4/8] ubi: Use preditable device names
Date: Fri, 26 Jun 2015 09:31:03 +0200	[thread overview]
Message-ID: <1435303867-12889-5-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1435303867-12889-1-git-send-email-s.hauer@pengutronix.de>

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>
---
 drivers/mtd/ubi/build.c | 7 ++-----
 drivers/mtd/ubi/cdev.c  | 4 ++--
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index b02880e..1074feb 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 90d5b2d..fe71a8d 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;
 
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2015-06-26  7:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-26  7:30 ubi: Make attaching UBI more convenient Sascha Hauer
2015-06-26  7:31 ` [PATCH 1/8] commands: detect: use device_detect_by_name Sascha Hauer
2015-06-26  7:31 ` [PATCH 2/8] driver: detect: detect parent devices aswell Sascha Hauer
2015-06-26  7:31 ` [PATCH 3/8] blspec: Use device_detect_by_name Sascha Hauer
2015-06-26  7:31 ` Sascha Hauer [this message]
2015-06-26  7:31 ` [PATCH 5/8] mtd: detect ubi devices automatically Sascha Hauer
2015-06-26  7:31 ` [PATCH 6/8] ubi: Lower 'already attached' message to debug level Sascha Hauer
2015-06-26  7:31 ` [PATCH 7/8] commands: mount: detect the device to be mounted Sascha Hauer
2015-06-26  7:31 ` [PATCH 8/8] ubi: Update documentation Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435303867-12889-5-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox