aboutsummaryrefslogtreecommitdiff
path: root/drivers/mtd/ubi/vmt.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-16 20:00:38 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-26 19:15:15 +0200
commit89b96b69290668351a33b09372ec1c94cb5748e5 (patch)
treecdbb79da1c821f2155815119ded20d181c23c7c2 /drivers/mtd/ubi/vmt.c
parent77c722dde9975361051c5530475f8f92ed67a506 (diff)
UBI: improve internal interfaces
Pass volume description object to the EBA function which makes more sense, and EBA function do not have to find the volume description object by volume ID. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
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 787ce9ec17a..d2d12deead5 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)
return err;
for (i = 0; i < vol->reserved_pebs; i++) {
- err = ubi_eba_unmap_leb(ubi, vol_id, i);
+ err = ubi_eba_unmap_leb(ubi, vol, i);
if (err)
return err;
}
@@ -524,7 +524,7 @@ int ubi_resize_volume(struct ubi_volume_desc *desc, int reserved_pebs)
if (pebs < 0) {
for (i = 0; i < -pebs; i++) {
- err = ubi_eba_unmap_leb(ubi, vol_id, reserved_pebs + i);
+ err = ubi_eba_unmap_leb(ubi, vol, reserved_pebs + i);
if (err)
goto out_acc;
}
@@ -573,17 +573,16 @@ out_free:
/**
* ubi_add_volume - add volume.
* @ubi: UBI device description object
- * @vol_id: volume ID
+ * @vol: volume description object
*
* This function adds an existin volume and initializes all its data
* structures. Returnes zero in case of success and a negative error code in
* case of failure.
*/
-int ubi_add_volume(struct ubi_device *ubi, int vol_id)
+int ubi_add_volume(struct ubi_device *ubi, struct ubi_volume *vol)
{
- int err;
+ int err, vol_id = vol->vol_id;
dev_t dev;
- struct ubi_volume *vol = ubi->volumes[vol_id];
dbg_msg("add volume %d", vol_id);
ubi_dbg_dump_vol_info(vol);
@@ -634,22 +633,21 @@ out_cdev:
/**
* ubi_free_volume - free volume.
* @ubi: UBI device description object
- * @vol_id: volume ID
+ * @vol: volume description object
*
- * This function frees all resources for volume @vol_id but does not remove it.
+ * This function frees all resources for volume @vol but does not remove it.
* Used only when the UBI device is detached.
*/
-void ubi_free_volume(struct ubi_device *ubi, int vol_id)
+void ubi_free_volume(struct ubi_device *ubi, struct ubi_volume *vol)
{
int err;
- struct ubi_volume *vol = ubi->volumes[vol_id];
- dbg_msg("free volume %d", vol_id);
+ dbg_msg("free volume %d", vol->vol_id);
ubi_assert(vol);
vol->removed = 1;
err = ubi_destroy_gluebi(vol);
- ubi->volumes[vol_id] = NULL;
+ ubi->volumes[vol->vol_id] = NULL;
cdev_del(&vol->cdev);
volume_sysfs_close(vol);
}