Skip to contentSkip to conversation

regulator: lp872x: make a const array static, makes object smaller

PATCH In review Colin King 2 participants 2 messages Oct 16, 2020 – Oct 26, 2020

Subsystems (2)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 regulator: lp872x: make a const array static, makes object smaller

From: Colin Ian King <[email protected]>

Don't populate const array lp872x_num_regulators on the stack but instead make it static. Makes the object code smaller by 29 bytes.

Before:
text data bss dec hex filename
18441 4624 64 23129 5a59 drivers/regulator/lp872x.o

After:
text data bss dec hex filename
18316 4720 64 23100 5a3c drivers/regulator/lp872x.o

(gcc version 10.2.0)

---
 drivers/regulator/lp872x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/lp872x.c +1 -1
index 303d7e2dc838..e84be29533f4 100644
@@ -892,7 +892,7 @@ static int lp872x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
 	struct lp872x *lp;
 	struct lp872x_platform_data *pdata;
 	int ret;
-	const int lp872x_num_regulators[] = {
+	static const int lp872x_num_regulators[] = {
 		[LP8720] = LP8720_NUM_REGULATORS,
 		[LP8725] = LP8725_NUM_REGULATORS,
 	};
Signature · 1 line
2.27.0
maintainer
#1 lore raw
Quoted 8 lines · Colin King

Don't populate const array lp872x_num_regulators on the stack but instead make it static. Makes the object code smaller by 29 bytes.

Before:
text data bss dec hex filename
18441 4624 64 23129 5a59 drivers/regulator/lp872x.o

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: lp872x: make a const array static, makes object smaller

      commit: 390d828f56a602c9201601bff1170d9d2bf5801c

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark