public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: designware: make const array supported_speeds static to shink object code size
@ 2017-09-21 22:30 Colin King
  2017-09-22  7:10 ` Jarkko Nikula
  2017-10-17 21:50 ` Wolfram Sang
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2017-09-21 22:30 UTC (permalink / raw)
  To: Jarkko Nikula, Andy Shevchenko, Mika Westerberg, Wolfram Sang,
	linux-i2c
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Don't populate const array supported_speeds on the stack, instead
make it static.  Makes the object code smaller by 150 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
   8474	   1440	      0	   9914	   26ba	i2c-designware-platdrv.o

After:
   text	   data	    bss	    dec	    hex	filename
   8324	   1440	      0	   9764	   2624	i2c-designware-platdrv.o

(gcc version 7.2.0 x86_64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/i2c/busses/i2c-designware-platdrv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 0e65b97842b4..8a7b29b9afbe 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -257,7 +257,9 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
 	u32 acpi_speed, ht = 0;
 	struct resource *mem;
 	int i, irq, ret;
-	const int supported_speeds[] = { 0, 100000, 400000, 1000000, 3400000 };
+	static const int supported_speeds[] = {
+		0, 100000, 400000, 1000000, 3400000
+	};
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-17 21:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-21 22:30 [PATCH] i2c: designware: make const array supported_speeds static to shink object code size Colin King
2017-09-22  7:10 ` Jarkko Nikula
2017-10-17 21:50 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox