* [PATCH] fsl/fman: make arrays port_ids static, reduces object code size
@ 2017-08-31 13:24 ` Colin King
0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2017-08-31 13:24 UTC (permalink / raw)
To: Madalin Bucur, netdev; +Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Don't populate the arrays port_ids on the stack, instead make them static.
Makes the object code smaller by over 700 bytes:
Before:
text data bss dec hex filename
28785 5832 192 34809 87f9 fman.o
After:
text data bss dec hex filename
27921 5992 192 34105 8539 fman.o
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/net/ethernet/freescale/fman/fman.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c
index f420dac2f484..9530405030a7 100644
--- a/drivers/net/ethernet/freescale/fman/fman.c
+++ b/drivers/net/ethernet/freescale/fman/fman.c
@@ -2368,15 +2368,21 @@ u32 fman_get_qman_channel_id(struct fman *fman, u32 port_id)
int i;
if (fman->state->rev_info.major >= 6) {
- u32 port_ids[] = {0x30, 0x31, 0x28, 0x29, 0x2a, 0x2b,
- 0x2c, 0x2d, 0x2, 0x3, 0x4, 0x5, 0x7, 0x7};
+ static const u32 port_ids[] = {
+ 0x30, 0x31, 0x28, 0x29, 0x2a, 0x2b,
+ 0x2c, 0x2d, 0x2, 0x3, 0x4, 0x5, 0x7, 0x7
+ };
+
for (i = 0; i < fman->state->num_of_qman_channels; i++) {
if (port_ids[i] == port_id)
break;
}
} else {
- u32 port_ids[] = {0x30, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x1,
- 0x2, 0x3, 0x4, 0x5, 0x7, 0x7};
+ static const u32 port_ids[] = {
+ 0x30, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x1,
+ 0x2, 0x3, 0x4, 0x5, 0x7, 0x7
+ };
+
for (i = 0; i < fman->state->num_of_qman_channels; i++) {
if (port_ids[i] == port_id)
break;
--
2.14.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] fsl/fman: make arrays port_ids static, reduces object code size
@ 2017-08-31 13:24 ` Colin King
0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2017-08-31 13:24 UTC (permalink / raw)
To: Madalin Bucur, netdev; +Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Don't populate the arrays port_ids on the stack, instead make them static.
Makes the object code smaller by over 700 bytes:
Before:
text data bss dec hex filename
28785 5832 192 34809 87f9 fman.o
After:
text data bss dec hex filename
27921 5992 192 34105 8539 fman.o
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/net/ethernet/freescale/fman/fman.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c
index f420dac2f484..9530405030a7 100644
--- a/drivers/net/ethernet/freescale/fman/fman.c
+++ b/drivers/net/ethernet/freescale/fman/fman.c
@@ -2368,15 +2368,21 @@ u32 fman_get_qman_channel_id(struct fman *fman, u32 port_id)
int i;
if (fman->state->rev_info.major >= 6) {
- u32 port_ids[] = {0x30, 0x31, 0x28, 0x29, 0x2a, 0x2b,
- 0x2c, 0x2d, 0x2, 0x3, 0x4, 0x5, 0x7, 0x7};
+ static const u32 port_ids[] = {
+ 0x30, 0x31, 0x28, 0x29, 0x2a, 0x2b,
+ 0x2c, 0x2d, 0x2, 0x3, 0x4, 0x5, 0x7, 0x7
+ };
+
for (i = 0; i < fman->state->num_of_qman_channels; i++) {
if (port_ids[i] = port_id)
break;
}
} else {
- u32 port_ids[] = {0x30, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x1,
- 0x2, 0x3, 0x4, 0x5, 0x7, 0x7};
+ static const u32 port_ids[] = {
+ 0x30, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x1,
+ 0x2, 0x3, 0x4, 0x5, 0x7, 0x7
+ };
+
for (i = 0; i < fman->state->num_of_qman_channels; i++) {
if (port_ids[i] = port_id)
break;
--
2.14.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH] fsl/fman: make arrays port_ids static, reduces object code size
2017-08-31 13:24 ` Colin King
@ 2017-09-07 7:14 ` Madalin-cristian Bucur
-1 siblings, 0 replies; 4+ messages in thread
From: Madalin-cristian Bucur @ 2017-09-07 7:14 UTC (permalink / raw)
To: Colin King, netdev; +Cc: kernel-janitors, linux-kernel
> -----Original Message-----
> From: Colin King [mailto:colin.king@canonical.com]
> Sent: Thursday, August 31, 2017 4:25 PM
> Subject: [PATCH] fsl/fman: make arrays port_ids static, reduces object
> code size
>
> From: Colin Ian King <colin.king@canonical.com>
>
> Don't populate the arrays port_ids on the stack, instead make them static.
> Makes the object code smaller by over 700 bytes:
>
> Before:
> text data bss dec hex filename
> 28785 5832 192 34809 87f9 fman.o
>
> After:
> text data bss dec hex filename
> 27921 5992 192 34105 8539 fman.o
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Thanks,
Madalin
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] fsl/fman: make arrays port_ids static, reduces object code size
@ 2017-09-07 7:14 ` Madalin-cristian Bucur
0 siblings, 0 replies; 4+ messages in thread
From: Madalin-cristian Bucur @ 2017-09-07 7:14 UTC (permalink / raw)
To: Colin King, netdev; +Cc: kernel-janitors, linux-kernel
PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBDb2xpbiBLaW5nIFttYWlsdG86
Y29saW4ua2luZ0BjYW5vbmljYWwuY29tXQ0KPiBTZW50OiBUaHVyc2RheSwgQXVndXN0IDMxLCAy
MDE3IDQ6MjUgUE0NCj4gU3ViamVjdDogW1BBVENIXSBmc2wvZm1hbjogbWFrZSBhcnJheXMgcG9y
dF9pZHMgc3RhdGljLCByZWR1Y2VzIG9iamVjdA0KPiBjb2RlIHNpemUNCj4gDQo+IEZyb206IENv
bGluIElhbiBLaW5nIDxjb2xpbi5raW5nQGNhbm9uaWNhbC5jb20+DQo+IA0KPiBEb24ndCBwb3B1
bGF0ZSB0aGUgYXJyYXlzIHBvcnRfaWRzIG9uIHRoZSBzdGFjaywgaW5zdGVhZCBtYWtlIHRoZW0g
c3RhdGljLg0KPiBNYWtlcyB0aGUgb2JqZWN0IGNvZGUgc21hbGxlciBieSBvdmVyIDcwMCBieXRl
czoNCj4gDQo+IEJlZm9yZToNCj4gICAgdGV4dAkgICBkYXRhCSAgICBic3MJICAgIGRlYwkgICAg
aGV4CWZpbGVuYW1lDQo+ICAgMjg3ODUJICAgNTgzMgkgICAgMTkyCSAgMzQ4MDkJICAgODdmOQlm
bWFuLm8NCj4gDQo+IEFmdGVyOg0KPiAgICB0ZXh0CSAgIGRhdGEJICAgIGJzcwkgICAgZGVjCSAg
ICBoZXgJZmlsZW5hbWUNCj4gICAyNzkyMQkgICA1OTkyCSAgICAxOTIJICAzNDEwNQkgICA4NTM5
CWZtYW4ubw0KPiANCj4gU2lnbmVkLW9mZi1ieTogQ29saW4gSWFuIEtpbmcgPGNvbGluLmtpbmdA
Y2Fub25pY2FsLmNvbT4NCg0KVGhhbmtzLA0KTWFkYWxpbg0K
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-09-07 7:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-31 13:24 [PATCH] fsl/fman: make arrays port_ids static, reduces object code size Colin King
2017-08-31 13:24 ` Colin King
2017-09-07 7:14 ` Madalin-cristian Bucur
2017-09-07 7:14 ` Madalin-cristian Bucur
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.