brcm47xx: add initial support for kernel 3.8
[openwrt/svn-archive/archive.git] / target / linux / brcm47xx / patches-3.8 / 020-mtd-bcm47xxpart-simplify-size-calculation-to-one-loo.patch
1 --- a/drivers/mtd/bcm47xxpart.c
2 +++ b/drivers/mtd/bcm47xxpart.c
3 @@ -169,11 +169,12 @@ static int bcm47xxpart_parse(struct mtd_
4 * Assume that partitions end at the beginning of the one they are
5 * followed by.
6 */
7 - for (i = 0; i < curr_part - 1; i++)
8 - parts[i].size = parts[i + 1].offset - parts[i].offset;
9 - if (curr_part > 0)
10 - parts[curr_part - 1].size =
11 - master->size - parts[curr_part - 1].offset;
12 + for (i = 0; i < curr_part; i++) {
13 + u64 next_part_offset = (i < curr_part - 1) ?
14 + parts[i + 1].offset : master->size;
15 +
16 + parts[i].size = next_part_offset - parts[i].offset;
17 + }
18
19 *pparts = parts;
20 return curr_part;