aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/vtbl.c
diff options
context:
space:
mode:
authorKyungmin Park <kyungmin.park@samsung.com>2008-05-21 21:32:18 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-07-24 06:32:54 -0400
commitcadb40ccc16a26a738f1cbc963e35b21edd93e79 (patch)
treeacd1d5d02ecda07634f1c49432ddb39cd9f5d7fd /drivers/mtd/ubi/vtbl.c
parenta0fd1efd488092951f310fdb777b8a540cf84dcb (diff)
UBI: avoid unnecessary division operations
UBI already checks that @min io size is the power of 2 at io_init. It is save to use bit operations then. Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/vtbl.c')
-rw-r--r--drivers/mtd/ubi/vtbl.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index 42a7815086b7..d9af11a8682b 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -170,7 +170,7 @@ static int vtbl_check(const struct ubi_device *ubi,
170 goto bad; 170 goto bad;
171 } 171 }
172 172
173 n = alignment % ubi->min_io_size; 173 n = alignment & (ubi->min_io_size - 1);
174 if (alignment != 1 && n) { 174 if (alignment != 1 && n) {
175 err = 5; 175 err = 5;
176 goto bad; 176 goto bad;
@@ -684,14 +684,13 @@ static int check_scanning_info(const struct ubi_device *ubi,
684 return -EINVAL; 684 return -EINVAL;
685 } 685 }
686 686
687 if (si->highest_vol_id >= ubi->vtbl_slots + UBI_INT_VOL_COUNT&& 687 if (si->highest_vol_id >= ubi->vtbl_slots + UBI_INT_VOL_COUNT &&
688 si->highest_vol_id < UBI_INTERNAL_VOL_START) { 688 si->highest_vol_id < UBI_INTERNAL_VOL_START) {
689 ubi_err("too large volume ID %d found by scanning", 689 ubi_err("too large volume ID %d found by scanning",
690 si->highest_vol_id); 690 si->highest_vol_id);
691 return -EINVAL; 691 return -EINVAL;
692 } 692 }
693 693
694
695 for (i = 0; i < ubi->vtbl_slots + UBI_INT_VOL_COUNT; i++) { 694 for (i = 0; i < ubi->vtbl_slots + UBI_INT_VOL_COUNT; i++) {
696 cond_resched(); 695 cond_resched();
697 696