aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/kapi.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-17 06:09:09 -0500
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-26 12:15:15 -0500
commit450f872a8e1763c883c9f723e6937b7ed223e6d3 (patch)
tree256c2d6a485a4d5b4d38d2e591eb8c9105b38f90 /drivers/mtd/ubi/kapi.c
parentc63a491d3737aec3c47c5e785d87021752ad9fa6 (diff)
UBI: get device when opening volume
When a volume is opened, get its kref via get_device() call. And put the reference when closing the volume. With this, we may have a bit saner volume delete. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/kapi.c')
-rw-r--r--drivers/mtd/ubi/kapi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c
index 8e15002a36c3..96f5fef5f3fa 100644
--- a/drivers/mtd/ubi/kapi.c
+++ b/drivers/mtd/ubi/kapi.c
@@ -156,6 +156,7 @@ struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode)
156 vol->exclusive = 1; 156 vol->exclusive = 1;
157 break; 157 break;
158 } 158 }
159 get_device(&vol->dev);
159 spin_unlock(&ubi->volumes_lock); 160 spin_unlock(&ubi->volumes_lock);
160 161
161 desc->vol = vol; 162 desc->vol = vol;
@@ -274,6 +275,7 @@ void ubi_close_volume(struct ubi_volume_desc *desc)
274 spin_unlock(&vol->ubi->volumes_lock); 275 spin_unlock(&vol->ubi->volumes_lock);
275 276
276 kfree(desc); 277 kfree(desc);
278 put_device(&vol->dev);
277 module_put(THIS_MODULE); 279 module_put(THIS_MODULE);
278} 280}
279EXPORT_SYMBOL_GPL(ubi_close_volume); 281EXPORT_SYMBOL_GPL(ubi_close_volume);