diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-05-07 04:25:54 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-05-18 05:26:41 -0400 |
commit | 383d08e045faddd89797959786233d4c0e1ace80 (patch) | |
tree | 3f7456e3aea9b69fe18920791cf06bda6497a64f | |
parent | 1406de8e11eb043681297adf86d6892ff8efc27a (diff) |
UBI: remove redundant mutex
The @mult_mutex does not serve any purpose. We already have
@volumes_mutex and it is enough. The @volume mutex is pushed
down to the 'ubi_rename_volumes()', because we want first
to open all volumes in the exclusive mode, and then lock the
mutex, just like all other ioctl's (remove, re-size, etc) do.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r-- | drivers/mtd/ubi/build.c | 1 | ||||
-rw-r--r-- | drivers/mtd/ubi/cdev.c | 6 | ||||
-rw-r--r-- | drivers/mtd/ubi/ubi.h | 2 |
3 files changed, 2 insertions, 7 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 4048db83aef6..e0e8f47f1674 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c | |||
@@ -806,7 +806,6 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset) | |||
806 | 806 | ||
807 | mutex_init(&ubi->buf_mutex); | 807 | mutex_init(&ubi->buf_mutex); |
808 | mutex_init(&ubi->ckvol_mutex); | 808 | mutex_init(&ubi->ckvol_mutex); |
809 | mutex_init(&ubi->mult_mutex); | ||
810 | mutex_init(&ubi->volumes_mutex); | 809 | mutex_init(&ubi->volumes_mutex); |
811 | spin_lock_init(&ubi->volumes_lock); | 810 | spin_lock_init(&ubi->volumes_lock); |
812 | 811 | ||
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index f8e0f68f2186..8087b0462771 100644 --- a/drivers/mtd/ubi/cdev.c +++ b/drivers/mtd/ubi/cdev.c | |||
@@ -810,9 +810,7 @@ static int rename_volumes(struct ubi_device *ubi, | |||
810 | re->desc->vol->vol_id, re->desc->vol->name); | 810 | re->desc->vol->vol_id, re->desc->vol->name); |
811 | } | 811 | } |
812 | 812 | ||
813 | mutex_lock(&ubi->volumes_mutex); | ||
814 | err = ubi_rename_volumes(ubi, &rename_list); | 813 | err = ubi_rename_volumes(ubi, &rename_list); |
815 | mutex_unlock(&ubi->volumes_mutex); | ||
816 | 814 | ||
817 | out_free: | 815 | out_free: |
818 | list_for_each_entry_safe(re, re1, &rename_list, list) { | 816 | list_for_each_entry_safe(re, re1, &rename_list, list) { |
@@ -952,9 +950,9 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd, | |||
952 | break; | 950 | break; |
953 | } | 951 | } |
954 | 952 | ||
955 | mutex_lock(&ubi->mult_mutex); | 953 | mutex_lock(&ubi->volumes_mutex); |
956 | err = rename_volumes(ubi, req); | 954 | err = rename_volumes(ubi, req); |
957 | mutex_unlock(&ubi->mult_mutex); | 955 | mutex_unlock(&ubi->volumes_mutex); |
958 | kfree(req); | 956 | kfree(req); |
959 | break; | 957 | break; |
960 | } | 958 | } |
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index c055511bb1b2..485c73f850c1 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h | |||
@@ -366,7 +366,6 @@ struct ubi_wl_entry; | |||
366 | * @peb_buf2: another buffer of PEB size used for different purposes | 366 | * @peb_buf2: another buffer of PEB size used for different purposes |
367 | * @buf_mutex: protects @peb_buf1 and @peb_buf2 | 367 | * @buf_mutex: protects @peb_buf1 and @peb_buf2 |
368 | * @ckvol_mutex: serializes static volume checking when opening | 368 | * @ckvol_mutex: serializes static volume checking when opening |
369 | * @mult_mutex: serializes operations on multiple volumes, like re-naming | ||
370 | * @dbg_peb_buf: buffer of PEB size used for debugging | 369 | * @dbg_peb_buf: buffer of PEB size used for debugging |
371 | * @dbg_buf_mutex: protects @dbg_peb_buf | 370 | * @dbg_buf_mutex: protects @dbg_peb_buf |
372 | */ | 371 | */ |
@@ -444,7 +443,6 @@ struct ubi_device { | |||
444 | void *peb_buf2; | 443 | void *peb_buf2; |
445 | struct mutex buf_mutex; | 444 | struct mutex buf_mutex; |
446 | struct mutex ckvol_mutex; | 445 | struct mutex ckvol_mutex; |
447 | struct mutex mult_mutex; | ||
448 | #ifdef CONFIG_MTD_UBI_DEBUG | 446 | #ifdef CONFIG_MTD_UBI_DEBUG |
449 | void *dbg_peb_buf; | 447 | void *dbg_peb_buf; |
450 | struct mutex dbg_buf_mutex; | 448 | struct mutex dbg_buf_mutex; |