android_kernel_google_msm/drivers/mtd/nand
Herton Ronaldo Krzesinski a3a13c9974 mtd: nandsim: don't open code a do_div helper
commit 596fd46268 upstream.

We don't need to open code the divide function, just use div_u64 that
already exists and do the same job. While this is a straightforward
clean up, there is more to that, the real motivation for this.

While building on a cross compiling environment in armel, using gcc
4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5), I was getting the following build
error:

ERROR: "__aeabi_uldivmod" [drivers/mtd/nand/nandsim.ko] undefined!

After investigating with objdump and hand built assembly version
generated with the compiler, I narrowed __aeabi_uldivmod as being
generated from the divide function. When nandsim.c is built with
-fno-inline-functions-called-once, that happens when
CONFIG_DEBUG_SECTION_MISMATCH is enabled, the do_div optimization in
arch/arm/include/asm/div64.h doesn't work as expected with the open
coded divide function: even if the do_div we are using doesn't have a
constant divisor, the compiler still includes the else parts of the
optimized do_div macro, and translates the divisions there to use
__aeabi_uldivmod, instead of only calling __do_div_asm -> __do_div64 and
optimizing/removing everything else out.

So to reproduce, gcc 4.6 plus CONFIG_DEBUG_SECTION_MISMATCH=y and
CONFIG_MTD_NAND_NANDSIM=m should do it, building on armel.

After this change, the compiler does the intended thing even with
-fno-inline-functions-called-once, and optimizes out as expected the
constant handling in the optimized do_div on arm. As this also avoids a
build issue, I'm marking for Stable, as I think is applicable for this
case.

Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-19 08:58:55 -07:00
..
gpmi-nand dma: mxs-dma: enable channel in device_issue_pending call 2012-04-20 15:35:58 +05:30
alauda.c mtd: flash drivers set ecc strength 2012-03-27 00:56:46 +01:00
ams-delta.c mtd: ams-delta: fix request_mem_region() failure 2012-05-08 16:24:33 -05:00
atmel_nand.c MTD merge for 3.4 2012-03-30 17:31:56 -07:00
atmel_nand_ecc.h
au1550nd.c MTD: nand: make au1550nd.c a platform_driver 2011-12-08 10:42:10 +00:00
autcpu12.c
bcm_umi_bch.c
bcm_umi_nand.c MTD merge for 3.4 2012-03-30 17:31:56 -07:00
bf5xx_nand.c mtd: flash drivers set ecc strength 2012-03-27 00:56:46 +01:00
cafe_nand.c mtd: cafe_nand: fix an & vs | mistake 2012-07-16 09:04:23 -07:00
cmx270_nand.c mtd: do not use plain 0 as NULL 2012-03-27 00:53:20 +01:00
cs553x_nand.c mtd: flash drivers set ecc strength 2012-03-27 00:56:46 +01:00
davinci_nand.c mtd: flash drivers set ecc strength 2012-03-27 00:56:46 +01:00
denali.c mtd: flash drivers set ecc strength 2012-03-27 00:56:46 +01:00
denali.h
diskonchip.c mtd: flash drivers set ecc strength 2012-03-27 00:56:46 +01:00
docg4.c mtd: flash drivers set ecc strength 2012-03-27 00:56:46 +01:00
fsl_elbc_nand.c mtd: flash drivers set ecc strength 2012-03-27 00:56:46 +01:00
fsl_ifc_nand.c NAND Machine support for Integrated Flash Controller 2012-03-16 10:46:34 -05:00
fsl_upm.c mtd: convert drivers/mtd/* to use module_platform_driver() 2012-01-09 18:12:35 +00:00
fsmc_nand.c mtd: Add device-tree support to fsmc_nand 2012-03-27 01:01:07 +01:00
gpio.c mtd: gpio-nand: add device tree bindings 2012-01-09 18:23:58 +00:00
h1910.c mtd: do not use plain 0 as NULL 2012-03-27 00:53:20 +01:00
jz4740_nand.c mtd: flash drivers set ecc strength 2012-03-27 00:56:46 +01:00
Kconfig MTD merge for 3.4 2012-03-30 17:31:56 -07:00
Makefile MTD merge for 3.4 2012-03-30 17:31:56 -07:00
mpc5121_nfc.c mtd: convert drivers/mtd/* to use module_platform_driver() 2012-01-09 18:12:35 +00:00
mxc_nand.c mtd: mxc_nand: move ecc strengh setup before nand_scan_tail 2012-06-10 00:36:13 +09:00
nand_base.c mtd: unify initialization of erase_info->fail_addr 2012-03-27 01:02:24 +01:00
nand_bbt.c mtd: nand: fix scan_read_raw_oob 2012-06-10 00:36:12 +09:00
nand_bch.c mtd: cleanup style on pr_debug messages 2011-09-11 15:02:16 +03:00
nand_bcm_umi.c
nand_bcm_umi.h
nand_ecc.c mtd: spelling, capitalization, uniformity 2011-09-11 15:02:13 +03:00
nand_ids.c mtd: nand: add 512 Mbit device code (Macronix) 2012-01-09 17:59:44 +00:00
nandsim.c mtd: nandsim: don't open code a do_div helper 2012-07-19 08:58:55 -07:00
ndfc.c mtd: flash drivers set ecc strength 2012-03-27 00:56:46 +01:00
nomadik_nand.c mtd: introduce mtd_resume interface 2012-01-09 18:25:46 +00:00
nuc900_nand.c mtd: convert drivers/mtd/* to use module_platform_driver() 2012-01-09 18:12:35 +00:00
omap2.c mtd: flash drivers set ecc strength 2012-03-27 00:56:46 +01:00
orion_nand.c mtd: do not use plain 0 as NULL 2012-03-27 00:53:20 +01:00
pasemi_nand.c mtd: convert drivers/mtd/* to use module_platform_driver() 2012-01-09 18:12:35 +00:00
plat_nand.c mtd: do not use plain 0 as NULL 2012-03-27 00:53:20 +01:00
ppchameleonevb.c mtd: do not use plain 0 as NULL 2012-03-27 00:53:20 +01:00
pxa3xx_nand.c mtd: flash drivers set ecc strength 2012-03-27 00:56:46 +01:00
r852.c mtd: flash drivers set ecc strength 2012-03-27 00:56:46 +01:00
r852.h
rtc_from4.c mtd: flash drivers set ecc strength 2012-03-27 00:56:46 +01:00
s3c2410.c mtd: flash drivers set ecc strength 2012-03-27 00:56:46 +01:00
sh_flctl.c mtd: flash drivers set ecc strength 2012-03-27 00:56:46 +01:00
sharpsl.c mtd: flash drivers set ecc strength 2012-03-27 00:56:46 +01:00
sm_common.c mtd: introduce mtd_write_oob interface 2012-01-09 18:25:24 +00:00
sm_common.h
socrates_nand.c mtd: convert drivers/mtd/* to use module_platform_driver() 2012-01-09 18:12:35 +00:00
spia.c
tmio_nand.c mtd: flash drivers set ecc strength 2012-03-27 00:56:46 +01:00
txx9ndfmc.c mtd: flash drivers set ecc strength 2012-03-27 00:56:46 +01:00