diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/ubi/build.c | 1 | ||||
-rw-r--r-- | drivers/mtd/ubi/kapi.c | 11 | ||||
-rw-r--r-- | drivers/mtd/ubi/ubi.h | 1 |
3 files changed, 5 insertions, 8 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 70c0b9a9e6e3..6ac133994f94 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c | |||
@@ -703,6 +703,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset) | |||
703 | goto out_free; | 703 | goto out_free; |
704 | 704 | ||
705 | mutex_init(&ubi->buf_mutex); | 705 | mutex_init(&ubi->buf_mutex); |
706 | mutex_init(&ubi->ckvol_mutex); | ||
706 | ubi->peb_buf1 = vmalloc(ubi->peb_size); | 707 | ubi->peb_buf1 = vmalloc(ubi->peb_size); |
707 | if (!ubi->peb_buf1) | 708 | if (!ubi->peb_buf1) |
708 | goto out_free; | 709 | goto out_free; |
diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c index 4ec3a33b2577..146957c3380d 100644 --- a/drivers/mtd/ubi/kapi.c +++ b/drivers/mtd/ubi/kapi.c | |||
@@ -169,17 +169,12 @@ struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode) | |||
169 | desc->vol = vol; | 169 | desc->vol = vol; |
170 | desc->mode = mode; | 170 | desc->mode = mode; |
171 | 171 | ||
172 | /* | 172 | mutex_lock(&ubi->ckvol_mutex); |
173 | * To prevent simultaneous checks of the same volume we use | ||
174 | * @volumes_mutex, although it is not the purpose it was introduced | ||
175 | * for. | ||
176 | */ | ||
177 | mutex_lock(&ubi->volumes_mutex); | ||
178 | if (!vol->checked) { | 173 | if (!vol->checked) { |
179 | /* This is the first open - check the volume */ | 174 | /* This is the first open - check the volume */ |
180 | err = ubi_check_volume(ubi, vol_id); | 175 | err = ubi_check_volume(ubi, vol_id); |
181 | if (err < 0) { | 176 | if (err < 0) { |
182 | mutex_unlock(&ubi->volumes_mutex); | 177 | mutex_unlock(&ubi->ckvol_mutex); |
183 | ubi_close_volume(desc); | 178 | ubi_close_volume(desc); |
184 | return ERR_PTR(err); | 179 | return ERR_PTR(err); |
185 | } | 180 | } |
@@ -190,7 +185,7 @@ struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode) | |||
190 | } | 185 | } |
191 | vol->checked = 1; | 186 | vol->checked = 1; |
192 | } | 187 | } |
193 | mutex_unlock(&ubi->volumes_mutex); | 188 | mutex_unlock(&ubi->ckvol_mutex); |
194 | 189 | ||
195 | return desc; | 190 | return desc; |
196 | 191 | ||
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index 2a6171226f1f..ef22f922f580 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h | |||
@@ -392,6 +392,7 @@ struct ubi_device { | |||
392 | void *peb_buf1; | 392 | void *peb_buf1; |
393 | void *peb_buf2; | 393 | void *peb_buf2; |
394 | struct mutex buf_mutex; | 394 | struct mutex buf_mutex; |
395 | struct mutex ckvol_mutex; | ||
395 | #ifdef CONFIG_MTD_UBI_DEBUG | 396 | #ifdef CONFIG_MTD_UBI_DEBUG |
396 | void *dbg_peb_buf; | 397 | void *dbg_peb_buf; |
397 | struct mutex dbg_buf_mutex; | 398 | struct mutex dbg_buf_mutex; |