]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/mtd/ubi/vmt.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/vegard...
[karo-tx-linux.git] / drivers / mtd / ubi / vmt.c
index 8e8d6fae7a02962ea1a59c9399388e9a6a0d4910..ab64cb56df6e11c3bce686035bc5ac34251a6374 100644 (file)
@@ -317,10 +317,6 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
                goto out_mapping;
        }
 
-       err = ubi_create_gluebi(ubi, vol);
-       if (err)
-               goto out_cdev;
-
        vol->dev.release = vol_release;
        vol->dev.parent = &ubi->dev;
        vol->dev.devt = dev;
@@ -330,7 +326,7 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
        err = device_register(&vol->dev);
        if (err) {
                ubi_err("cannot register device");
-               goto out_gluebi;
+               goto out_cdev;
        }
 
        err = volume_sysfs_init(ubi, vol);
@@ -358,6 +354,7 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
        ubi->vol_count += 1;
        spin_unlock(&ubi->volumes_lock);
 
+       ubi_volume_notify(ubi, vol, UBI_VOLUME_ADDED);
        if (paranoid_check_volumes(ubi))
                dbg_err("check failed while creating volume %d", vol_id);
        return err;
@@ -374,10 +371,6 @@ out_sysfs:
        do_free = 0;
        get_device(&vol->dev);
        volume_sysfs_close(vol);
-out_gluebi:
-       if (ubi_destroy_gluebi(vol))
-               dbg_err("cannot destroy gluebi for volume %d:%d",
-                       ubi->ubi_num, vol_id);
 out_cdev:
        cdev_del(&vol->cdev);
 out_mapping:
@@ -432,10 +425,6 @@ int ubi_remove_volume(struct ubi_volume_desc *desc, int no_vtbl)
        ubi->volumes[vol_id] = NULL;
        spin_unlock(&ubi->volumes_lock);
 
-       err = ubi_destroy_gluebi(vol);
-       if (err)
-               goto out_err;
-
        if (!no_vtbl) {
                err = ubi_change_vtbl_record(ubi, vol_id, NULL);
                if (err)
@@ -466,6 +455,7 @@ int ubi_remove_volume(struct ubi_volume_desc *desc, int no_vtbl)
        ubi->vol_count -= 1;
        spin_unlock(&ubi->volumes_lock);
 
+       ubi_volume_notify(ubi, vol, UBI_VOLUME_REMOVED);
        if (!no_vtbl && paranoid_check_volumes(ubi))
                dbg_err("check failed while removing volume %d", vol_id);
 
@@ -589,6 +579,7 @@ int ubi_resize_volume(struct ubi_volume_desc *desc, int reserved_pebs)
                        (long long)vol->used_ebs * vol->usable_leb_size;
        }
 
+       ubi_volume_notify(ubi, vol, UBI_VOLUME_RESIZED);
        if (paranoid_check_volumes(ubi))
                dbg_err("check failed while re-sizing volume %d", vol_id);
        return err;
@@ -635,6 +626,7 @@ int ubi_rename_volumes(struct ubi_device *ubi, struct list_head *rename_list)
                        vol->name_len = re->new_name_len;
                        memcpy(vol->name, re->new_name, re->new_name_len + 1);
                        spin_unlock(&ubi->volumes_lock);
+                       ubi_volume_notify(ubi, vol, UBI_VOLUME_RENAMED);
                }
        }
 
@@ -670,10 +662,6 @@ int ubi_add_volume(struct ubi_device *ubi, struct ubi_volume *vol)
                return err;
        }
 
-       err = ubi_create_gluebi(ubi, vol);
-       if (err)
-               goto out_cdev;
-
        vol->dev.release = vol_release;
        vol->dev.parent = &ubi->dev;
        vol->dev.devt = dev;
@@ -681,12 +669,11 @@ int ubi_add_volume(struct ubi_device *ubi, struct ubi_volume *vol)
        dev_set_name(&vol->dev, "%s_%d", ubi->ubi_name, vol->vol_id);
        err = device_register(&vol->dev);
        if (err)
-               goto out_gluebi;
+               goto out_cdev;
 
        err = volume_sysfs_init(ubi, vol);
        if (err) {
                cdev_del(&vol->cdev);
-               err = ubi_destroy_gluebi(vol);
                volume_sysfs_close(vol);
                return err;
        }
@@ -695,8 +682,6 @@ int ubi_add_volume(struct ubi_device *ubi, struct ubi_volume *vol)
                dbg_err("check failed while adding volume %d", vol_id);
        return err;
 
-out_gluebi:
-       err = ubi_destroy_gluebi(vol);
 out_cdev:
        cdev_del(&vol->cdev);
        return err;
@@ -712,12 +697,9 @@ out_cdev:
  */
 void ubi_free_volume(struct ubi_device *ubi, struct ubi_volume *vol)
 {
-       int err;
-
        dbg_gen("free volume %d", vol->vol_id);
 
        ubi->volumes[vol->vol_id] = NULL;
-       err = ubi_destroy_gluebi(vol);
        cdev_del(&vol->cdev);
        volume_sysfs_close(vol);
 }