u-boot/drivers/i2c
Rasmus Villemoes 49f3a42edf i2c: avoid dynamic stack use in dm_i2c_write
The size of the dynamic stack allocation here is bounded by the if()
statement. However, just allocating the maximum size up-front and
doing malloc() if necessary avoids code duplication (the
i2c_setup_offset() until the invocation of ->xfer), and generates much
better (smaller) code:

bloat-o-meter drivers/i2c/i2c-uclass.o.{0,1}
add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-144 (-144)
Function                                     old     new   delta
dm_i2c_write                                 552     408    -144
Total: Before=3828, After=3684, chg -3.76%

It also makes static analysis of maximum stack usage (using the .su
files that are automatically generated during build) easier if there
are no lines saying "dynamic".

[This is not entirely equivalent to the existing code; this now uses
the stack for len <= 64 rather than len <= 63, but that seems like a
more natural limit.]

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Heiko Schocher <hs@denx.de>
2022-07-19 13:46:28 +02:00
..
muxes spl: Ensure all SPL symbols in Kconfig have some SPL dependency 2022-07-07 09:29:08 -04:00
acpi_i2c.c
acpi_i2c.h
ast_i2c.c i2c: ast_i2c: Remove SCL direct drive mode 2022-07-19 13:46:28 +02:00
ast_i2c.h
at91_i2c.c
at91_i2c.h
cros_ec_ldo.c
cros_ec_tunnel.c
davinci_i2c.c i2c: Remove non-DM_I2C support from davinci_i2c.c 2022-07-08 17:57:34 -04:00
davinci_i2c.h
designware_i2c.c stm32mp1: fix reference for STMicroelectronics 2022-06-17 14:12:27 +02:00
designware_i2c.h stm32mp1: fix reference for STMicroelectronics 2022-06-17 14:12:27 +02:00
designware_i2c_pci.c stm32mp1: fix reference for STMicroelectronics 2022-06-17 14:12:27 +02:00
exynos_hs_i2c.c arm: samsung: Migrate a number of symbols to Kconfig 2022-06-28 17:04:37 -04:00
fsl_i2c.c
i2c-cdns.c
i2c-cortina.c
i2c-cortina.h
i2c-emul-uclass.c
i2c-gpio.c
i2c-microchip.c
i2c-uclass.c i2c: avoid dynamic stack use in dm_i2c_write 2022-07-19 13:46:28 +02:00
i2c-uniphier-f.c
i2c-uniphier.c
i2c-versatile.c
i2c_core.c
ihs_i2c.c i2c: ihs: intel: Fix typo in comments (actual) 2022-05-10 06:47:13 +02:00
imx_lpi2c.c
intel_i2c.c i2c: ihs: intel: Fix typo in comments (actual) 2022-05-10 06:47:13 +02:00
iproc_i2c.c
iproc_i2c.h
Kconfig i2c: nuvoton: Add NPCM7xx i2c driver 2022-07-19 13:46:28 +02:00
kona_i2c.c
lpc32xx_i2c.c
Makefile i2c: nuvoton: Add NPCM7xx i2c driver 2022-07-19 13:46:28 +02:00
meson_i2c.c
mv_i2c.c
mv_i2c.h
mvtwsi.c
mxc_i2c.c
npcm-i2c.c i2c: nuvoton: Add NPCM7xx i2c driver 2022-07-19 13:46:28 +02:00
nx_i2c.c
ocores_i2c.c
octeon_i2c.c pci: Add mask parameter to dm_pci_map_bar() 2022-05-03 18:33:29 -04:00
omap24xx_i2c.c
omap24xx_i2c.h
rcar_i2c.c
rcar_iic.c
rk_i2c.c
s3c24x0_i2c.c arm: samsung: Migrate a number of symbols to Kconfig 2022-06-28 17:04:37 -04:00
s3c24x0_i2c.h
sandbox_i2c.c
sh_i2c.c
soft_i2c.c
stm32f7_i2c.c i2c: stm32: add support for the st,stm32mp13 SOC 2022-07-12 11:47:34 +02:00
sun6i_p2wi.c i2c: sun6i_p2wi: Add support for DM clocks and resets 2022-04-04 23:24:17 +01:00
sun8i_rsb.c i2c: sun8i_rsb: Add support for DM clocks and resets 2022-04-04 23:24:17 +01:00
synquacer_i2c.c
tegra186_bpmp_i2c.c
tegra_i2c.c arm: tegra: Update some DT compatibles 2022-06-13 15:31:10 -07:00
xilinx_xiic.c