mtd: ubi: create device with persistent names
UBI devices used to show up with a dynamically assigned number which is bad for scripting. After a 'ubiattach' a script cannot know the number of the ubi to continue with. Change this to use the parent mtd name and extend it with ".ubi". Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
824f84b6bc
commit
42754c2345
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue