* [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
* Re: [PATCH] i2c: designware: make const array supported_speeds static to shink object code size
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
1 sibling, 0 replies; 3+ messages in thread
From: Jarkko Nikula @ 2017-09-22 7:10 UTC (permalink / raw)
To: Colin King, Andy Shevchenko, Mika Westerberg, Wolfram Sang,
linux-i2c
Cc: kernel-janitors, linux-kernel
On 09/22/2017 01:30 AM, Colin King wrote:
> 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
> + };
>
Oh, this is so easy to forget.
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i2c: designware: make const array supported_speeds static to shink object code size
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
1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2017-10-17 21:50 UTC (permalink / raw)
To: Colin King
Cc: Jarkko Nikula, Andy Shevchenko, Mika Westerberg, linux-i2c,
kernel-janitors, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 650 bytes --]
On Thu, Sep 21, 2017 at 11:30:07PM +0100, Colin King wrote:
> 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>
Applied to for-next, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [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