aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/vtbl.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-17 05:46:48 -0500
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-26 12:15:15 -0500
commitcae0a77125467c42f0918e78457913ee4a2f925b (patch)
tree92ce552bb67d6e0d44e1144e08260ea0bbcee80a /drivers/mtd/ubi/vtbl.c
parent89b96b69290668351a33b09372ec1c94cb5748e5 (diff)
UBI: tweak volumes locking
Transform vtbl_mutex to volumes_mutex - this just makes code easier to understand. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/vtbl.c')
-rw-r--r--drivers/mtd/ubi/vtbl.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index 3349c281bf9e..5879fdb3e6d5 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -89,7 +89,7 @@ int ubi_change_vtbl_record(struct ubi_device *ubi, int idx,
89 struct ubi_volume *layout_vol; 89 struct ubi_volume *layout_vol;
90 90
91 ubi_assert(idx >= 0 && idx < ubi->vtbl_slots); 91 ubi_assert(idx >= 0 && idx < ubi->vtbl_slots);
92 layout_vol = ubi->volumes[vol_id2idx(UBI_LAYOUT_VOL_ID)]; 92 layout_vol = ubi->volumes[vol_id2idx(ubi, UBI_LAYOUT_VOL_ID)];
93 93
94 if (!vtbl_rec) 94 if (!vtbl_rec)
95 vtbl_rec = &empty_vtbl_record; 95 vtbl_rec = &empty_vtbl_record;
@@ -98,24 +98,19 @@ int ubi_change_vtbl_record(struct ubi_device *ubi, int idx,
98 vtbl_rec->crc = cpu_to_be32(crc); 98 vtbl_rec->crc = cpu_to_be32(crc);
99 } 99 }
100 100
101 mutex_lock(&ubi->vtbl_mutex);
102 memcpy(&ubi->vtbl[idx], vtbl_rec, sizeof(struct ubi_vtbl_record)); 101 memcpy(&ubi->vtbl[idx], vtbl_rec, sizeof(struct ubi_vtbl_record));
103 for (i = 0; i < UBI_LAYOUT_VOLUME_EBS; i++) { 102 for (i = 0; i < UBI_LAYOUT_VOLUME_EBS; i++) {
104 err = ubi_eba_unmap_leb(ubi, layout_vol, i); 103 err = ubi_eba_unmap_leb(ubi, layout_vol, i);
105 if (err) { 104 if (err)
106 mutex_unlock(&ubi->vtbl_mutex);
107 return err; 105 return err;
108 } 106
109 err = ubi_eba_write_leb(ubi, layout_vol, i, ubi->vtbl, 0, 107 err = ubi_eba_write_leb(ubi, layout_vol, i, ubi->vtbl, 0,
110 ubi->vtbl_size, UBI_LONGTERM); 108 ubi->vtbl_size, UBI_LONGTERM);
111 if (err) { 109 if (err)
112 mutex_unlock(&ubi->vtbl_mutex);
113 return err; 110 return err;
114 }
115 } 111 }
116 112
117 paranoid_vtbl_check(ubi); 113 paranoid_vtbl_check(ubi);
118 mutex_unlock(&ubi->vtbl_mutex);
119 return ubi_wl_flush(ubi); 114 return ubi_wl_flush(ubi);
120} 115}
121 116