aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/vmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/ubi/vmt.c')
-rw-r--r--drivers/mtd/ubi/vmt.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index 787ce9ec17ae..d2d12deead5c 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -417,7 +417,7 @@ int ubi_remove_volume(struct ubi_volume_desc *desc)
417 return err; 417 return err;
418 418
419 for (i = 0; i < vol->reserved_pebs; i++) { 419 for (i = 0; i < vol->reserved_pebs; i++) {
420 err = ubi_eba_unmap_leb(ubi, vol_id, i); 420 err = ubi_eba_unmap_leb(ubi, vol, i);
421 if (err) 421 if (err)
422 return err; 422 return err;
423 } 423 }
@@ -524,7 +524,7 @@ int ubi_resize_volume(struct ubi_volume_desc *desc, int reserved_pebs)
524 524
525 if (pebs < 0) { 525 if (pebs < 0) {
526 for (i = 0; i < -pebs; i++) { 526 for (i = 0; i < -pebs; i++) {
527 err = ubi_eba_unmap_leb(ubi, vol_id, reserved_pebs + i); 527 err = ubi_eba_unmap_leb(ubi, vol, reserved_pebs + i);
528 if (err) 528 if (err)
529 goto out_acc; 529 goto out_acc;
530 } 530 }
@@ -573,17 +573,16 @@ out_free:
573/** 573/**
574 * ubi_add_volume - add volume. 574 * ubi_add_volume - add volume.
575 * @ubi: UBI device description object 575 * @ubi: UBI device description object
576 * @vol_id: volume ID 576 * @vol: volume description object
577 * 577 *
578 * This function adds an existin volume and initializes all its data 578 * This function adds an existin volume and initializes all its data
579 * structures. Returnes zero in case of success and a negative error code in 579 * structures. Returnes zero in case of success and a negative error code in
580 * case of failure. 580 * case of failure.
581 */ 581 */
582int ubi_add_volume(struct ubi_device *ubi, int vol_id) 582int ubi_add_volume(struct ubi_device *ubi, struct ubi_volume *vol)
583{ 583{
584 int err; 584 int err, vol_id = vol->vol_id;
585 dev_t dev; 585 dev_t dev;
586 struct ubi_volume *vol = ubi->volumes[vol_id];
587 586
588 dbg_msg("add volume %d", vol_id); 587 dbg_msg("add volume %d", vol_id);
589 ubi_dbg_dump_vol_info(vol); 588 ubi_dbg_dump_vol_info(vol);
@@ -634,22 +633,21 @@ out_cdev:
634/** 633/**
635 * ubi_free_volume - free volume. 634 * ubi_free_volume - free volume.
636 * @ubi: UBI device description object 635 * @ubi: UBI device description object
637 * @vol_id: volume ID 636 * @vol: volume description object
638 * 637 *
639 * This function frees all resources for volume @vol_id but does not remove it. 638 * This function frees all resources for volume @vol but does not remove it.
640 * Used only when the UBI device is detached. 639 * Used only when the UBI device is detached.
641 */ 640 */
642void ubi_free_volume(struct ubi_device *ubi, int vol_id) 641void ubi_free_volume(struct ubi_device *ubi, struct ubi_volume *vol)
643{ 642{
644 int err; 643 int err;
645 struct ubi_volume *vol = ubi->volumes[vol_id];
646 644
647 dbg_msg("free volume %d", vol_id); 645 dbg_msg("free volume %d", vol->vol_id);
648 ubi_assert(vol); 646 ubi_assert(vol);
649 647
650 vol->removed = 1; 648 vol->removed = 1;
651 err = ubi_destroy_gluebi(vol); 649 err = ubi_destroy_gluebi(vol);
652 ubi->volumes[vol_id] = NULL; 650 ubi->volumes[vol->vol_id] = NULL;
653 cdev_del(&vol->cdev); 651 cdev_del(&vol->cdev);
654 volume_sysfs_close(vol); 652 volume_sysfs_close(vol);
655} 653}