diff options
author | Kyungmin Park <kyungmin.park@samsung.com> | 2008-05-22 03:32:18 +0200 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-07-24 12:32:54 +0200 |
commit | cadb40ccc16a26a738f1cbc963e35b21edd93e79 (patch) | |
tree | acd1d5d02ecda07634f1c49432ddb39cd9f5d7fd /drivers/mtd/ubi/vtbl.c | |
parent | UBI: fix buffer padding (diff) | |
download | linux-cadb40ccc16a26a738f1cbc963e35b21edd93e79.tar.xz linux-cadb40ccc16a26a738f1cbc963e35b21edd93e79.zip |
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.c | 5 |
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, goto bad; } - n = alignment % ubi->min_io_size; + n = alignment & (ubi->min_io_size - 1); if (alignment != 1 && n) { err = 5; goto bad; @@ -684,14 +684,13 @@ static int check_scanning_info(const struct ubi_device *ubi, return -EINVAL; } - if (si->highest_vol_id >= ubi->vtbl_slots + UBI_INT_VOL_COUNT&& + if (si->highest_vol_id >= ubi->vtbl_slots + UBI_INT_VOL_COUNT && si->highest_vol_id < UBI_INTERNAL_VOL_START) { ubi_err("too large volume ID %d found by scanning", si->highest_vol_id); return -EINVAL; } - for (i = 0; i < ubi->vtbl_slots + UBI_INT_VOL_COUNT; i++) { cond_resched(); |