Patchwork [1/2] mtd: bcm47xxpart: simplify size calculation to one loop

login
register
mail settings
Submitter Rafał Miłecki
Date Jan. 6, 2013, 3:08 p.m.
Message ID <1357484916-29965-1-git-send-email-zajec5@gmail.com>
Download mbox | patch
Permalink /patch/209759/
State New
Headers show

Comments

Rafał Miłecki - Jan. 6, 2013, 3:08 p.m.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
I've checked this patch and got:
> Successfully built configuration "mips-bcm47xx_defconfig,mips,mips-linux-", no issues
---
 drivers/mtd/bcm47xxpart.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
Artem Bityutskiy - Jan. 17, 2013, 12:38 p.m.
On Sun, 2013-01-06 at 16:08 +0100, Rafał Miłecki wrote:
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> ---
> I've checked this patch and got:
> > Successfully built configuration "mips-bcm47xx_defconfig,mips,mips-linux-", no issues

There is some breakage in upstream and aiaia cannot compile the bcm47xx
configuration. Any idea?

init/calibrate.c:257:47: warning: no previous prototype for 'calibrate_delay_is_known' [-Wmissing-prototypes]
In file included from arch/mips/bcm47xx/nvram.c:17:0:
include/linux/ssb/ssb.h:440:19: error: field 'gpio' has incomplete type
In file included from include/linux/bcma/bcma.h:7:0,
                 from arch/mips/include/asm/mach-bcm47xx/bcm47xx.h:23,
                 from arch/mips/bcm47xx/nvram.c:22:
include/linux/bcma/bcma_driver_chipcommon.h:582:19: error: field 'gpio' has incomplete type
make[3]: *** [arch/mips/bcm47xx/nvram.o] Error 1
Hauke Mehrtens - Jan. 17, 2013, 12:51 p.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/17/2013 01:38 PM, Artem Bityutskiy wrote:
> On Sun, 2013-01-06 at 16:08 +0100, Rafał Miłecki wrote:
>> Signed-off-by: Rafał Miłecki <zajec5@gmail.com> --- I've checked
>> this patch and got:
>>> Successfully built configuration
>>> "mips-bcm47xx_defconfig,mips,mips-linux-", no issues
> 
> There is some breakage in upstream and aiaia cannot compile the
> bcm47xx configuration. Any idea?
> 
> init/calibrate.c:257:47: warning: no previous prototype for
> 'calibrate_delay_is_known' [-Wmissing-prototypes] In file included
> from arch/mips/bcm47xx/nvram.c:17:0: 
> include/linux/ssb/ssb.h:440:19: error: field 'gpio' has incomplete
> type In file included from include/linux/bcma/bcma.h:7:0, from
> arch/mips/include/asm/mach-bcm47xx/bcm47xx.h:23, from
> arch/mips/bcm47xx/nvram.c:22: 
> include/linux/bcma/bcma_driver_chipcommon.h:582:19: error: field
> 'gpio' has incomplete type make[3]: *** [arch/mips/bcm47xx/nvram.o]
> Error 1

This is a unrelated problem. There is a fix [0] in the mips tree on
its way into linus tree. As a workaround activate CONFIG_GPIOLIB.

Hauke

[0]: https://patchwork.linux-mips.org/patch/4759/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQIcBAEBAgAGBQJQ9/PmAAoJEIZ0px9YPRMy1zoP/Ajkm1OL0gsuLkQ0GAoUIHkA
oVrST3hb3Nj1XRjiwst0AZBe6qm6Nc0lO2AXDKf9lxGTr7runNkrOi/ygeIL7x2S
sYqJQrGATLPv+6IWfI0INRCAvwDRTX8apAnf0hhUNDv72fIdby1M5OCGwePLCnC/
UJBLgPGOIDny5OSwj5idByoKbLrZUvmWIPNihj9Yqwneb3jOzklxbGnzf6rocU3v
rQkxVuI4nyOu8vEtpZqMiQBFfvlGMr2UmCOlKpxaRvXYm5R4LWJvErKVF3ADMqe5
UCLn6ZQHcnHnh1yOEpxxigAblYMSHxdsFzYmqzBHc8jdKW/PhnOoSxirSL5NGINc
oQFJ0hlsXe7trcRRPNUMpUiWFCfMUgxGnkoq56eNLxAFBYaR/oBBJDIX0nHlzjA1
MfdwGMfAprI8jiFPgEyFvBUUewCeCAnHOkKX06a7Fn3aoWEqVV2+2qmlzUrnpx4f
Hb0X9pNAJ5fkvwtzx6fDhPRNKKFpgiAdLpiGisndiSf5e2JIhO2hQU3ed9PWgGUN
Vx93EyVQbWkhg7ZY2Tlh157cUHcjzNA2X8v1fWC/atimoKGrl3ECBksmWnazXiHb
HqXPhk1oxgGz1wjtz/AkDEpfQvIK3y+Oixd4YQBar+askFyLHLK02Ab5CLves3E+
ZPZYXHPoAOg5uLkbO83c
=RL+q
-----END PGP SIGNATURE-----
Artem Bityutskiy - Jan. 17, 2013, 1:06 p.m.
On Thu, 2013-01-17 at 13:51 +0100, Hauke Mehrtens wrote:
> This is a unrelated problem. There is a fix [0] in the mips tree on
> its way into linus tree. As a workaround activate CONFIG_GPIOLIB.
> 
> Hauke
> 
> [0]: https://patchwork.linux-mips.org/patch/4759/

Thanks Hauke,

I've added your patch to my quick-fixes, thanks!
Artem Bityutskiy - Jan. 17, 2013, 1:22 p.m.
On Sun, 2013-01-06 at 16:08 +0100, Rafał Miłecki wrote:
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

Pushed both to l2-mtd.git, thanks!

Patch

diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c
index e06d782..06125eb 100644
--- a/drivers/mtd/bcm47xxpart.c
+++ b/drivers/mtd/bcm47xxpart.c
@@ -169,11 +169,12 @@  static int bcm47xxpart_parse(struct mtd_info *master,
 	 * Assume that partitions end at the beginning of the one they are
 	 * followed by.
 	 */
-	for (i = 0; i < curr_part - 1; i++)
-		parts[i].size = parts[i + 1].offset - parts[i].offset;
-	if (curr_part > 0)
-		parts[curr_part - 1].size =
-				master->size - parts[curr_part - 1].offset;
+	for (i = 0; i < curr_part; i++) {
+		u64 next_part_offset = (i < curr_part - 1) ?
+				       parts[i + 1].offset : master->size;
+
+		parts[i].size = next_part_offset - parts[i].offset;
+	}
 
 	*pparts = parts;
 	return curr_part;