aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/kapi.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-17 08:42:57 -0500
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-26 12:15:16 -0500
commitd05c77a816974c09f8c7e8f48e5b9f7b59dafdf3 (patch)
tree6263ef3ad76c654e9d2635e5145f15c2b517edeb /drivers/mtd/ubi/kapi.c
parentdb6e5770ef0ab351a403ac26e1ab1309e58f15d7 (diff)
UBI: introduce volume refcounting
Add ref_count field to UBI volumes and remove weired "vol->removed" field. This way things are better understandable and we do not have to do whold show_attr operation under spinlock. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/kapi.c')
-rw-r--r--drivers/mtd/ubi/kapi.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c
index 9c283768319f..780c273ff452 100644
--- a/drivers/mtd/ubi/kapi.c
+++ b/drivers/mtd/ubi/kapi.c
@@ -152,6 +152,7 @@ struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode)
152 break; 152 break;
153 } 153 }
154 get_device(&vol->dev); 154 get_device(&vol->dev);
155 vol->ref_count += 1;
155 spin_unlock(&ubi->volumes_lock); 156 spin_unlock(&ubi->volumes_lock);
156 157
157 desc->vol = vol; 158 desc->vol = vol;
@@ -261,10 +262,11 @@ void ubi_close_volume(struct ubi_volume_desc *desc)
261 case UBI_EXCLUSIVE: 262 case UBI_EXCLUSIVE:
262 vol->exclusive = 0; 263 vol->exclusive = 0;
263 } 264 }
265 vol->ref_count -= 1;
264 spin_unlock(&vol->ubi->volumes_lock); 266 spin_unlock(&vol->ubi->volumes_lock);
265 267
266 kfree(desc);
267 put_device(&vol->dev); 268 put_device(&vol->dev);
269 kfree(desc);
268 module_put(THIS_MODULE); 270 module_put(THIS_MODULE);
269} 271}
270EXPORT_SYMBOL_GPL(ubi_close_volume); 272EXPORT_SYMBOL_GPL(ubi_close_volume);