2017-09-19 14:25:22

by Colin King

[permalink] [raw]
Subject: [PATCH] nfc: s3fwrn5: make array match static const, reduces object code size

From: Colin Ian King <[email protected]>

Don't populate the read-only array match on the stack, instead make
it static const. Makes the object code smaller by over 310 bytes:

Before:
text data bss dec hex filename
8304 1084 128 9516 252c drivers/nfc/s3fwrn5/firmware.o

After:
text data bss dec hex filename
7894 1180 128 9202 23f2 drivers/nfc/s3fwrn5/firmware.o

Signed-off-by: Colin Ian King <[email protected]>
---
drivers/nfc/s3fwrn5/firmware.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nfc/s3fwrn5/firmware.c b/drivers/nfc/s3fwrn5/firmware.c
index 38548bd970cd..b7828fb252f2 100644
--- a/drivers/nfc/s3fwrn5/firmware.c
+++ b/drivers/nfc/s3fwrn5/firmware.c
@@ -336,7 +336,7 @@ static int s3fwrn5_fw_get_base_addr(
struct s3fwrn5_fw_cmd_get_bootinfo_rsp *bootinfo, u32 *base_addr)
{
int i;
- struct {
+ static const struct {
u8 version[4];
u32 base_addr;
} match[] = {
--
2.14.1


2017-11-06 00:04:40

by Samuel Ortiz

[permalink] [raw]
Subject: Re: [PATCH] nfc: s3fwrn5: make array match static const, reduces object code size

Hi Colin,

On Tue, Sep 19, 2017 at 03:25:15PM +0100, Colin King wrote:
> From: Colin Ian King <[email protected]>
>
> Don't populate the read-only array match on the stack, instead make
> it static const. Makes the object code smaller by over 310 bytes:
>
> Before:
> text data bss dec hex filename
> 8304 1084 128 9516 252c drivers/nfc/s3fwrn5/firmware.o
>
> After:
> text data bss dec hex filename
> 7894 1180 128 9202 23f2 drivers/nfc/s3fwrn5/firmware.o
>
> Signed-off-by: Colin Ian King <[email protected]>
> ---
> drivers/nfc/s3fwrn5/firmware.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to nfc-next, thanks.

Cheers,
Samuel.

From 1578978461285776164@xxx Tue Sep 19 14:26:44 +0000 2017
X-GM-THRID: 1578978461285776164
X-Gmail-Labels: Inbox,Category Forums