Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1737529 > unrolled thread

[PATCH] i40e: make const array patterns static, reduces object code size

Started byColin King <colin.king@canonical.com>
First post2017-09-22 16:20 +0200
Last post2017-09-22 18:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] i40e: make const array patterns static, reduces object code size Colin King <colin.king@canonical.com> - 2017-09-22 16:20 +0200
    Re: [Intel-wired-lan] [PATCH] i40e: make const array patterns  static, reduces object code size Jesse Brandeburg <jesse.brandeburg@intel.com> - 2017-09-22 18:50 +0200

#1737529 — [PATCH] i40e: make const array patterns static, reduces object code size

FromColin King <colin.king@canonical.com>
Date2017-09-22 16:20 +0200
Subject[PATCH] i40e: make const array patterns static, reduces object code size
Message-ID<uswYa-75K-19@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

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

Before:
   text	   data	    bss	    dec	    hex	filename
   1953	    496	      0	   2449	    991	i40e_diag.o

After:
   text	   data	    bss	    dec	    hex	filename
   1798	    584	      0	   2382	    94e	i40e_diag.o

(gcc 6.3.0, x86-64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/intel/i40e/i40e_diag.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_diag.c b/drivers/net/ethernet/intel/i40e/i40e_diag.c
index f141e78d409e..76ed56641864 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_diag.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_diag.c
@@ -36,7 +36,9 @@
 static i40e_status i40e_diag_reg_pattern_test(struct i40e_hw *hw,
 							u32 reg, u32 mask)
 {
-	const u32 patterns[] = {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF};
+	static const u32 patterns[] = {
+		0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF
+	};
 	u32 pat, val, orig_val;
 	int i;
 
-- 
2.14.1

[toc] | [next] | [standalone]


#1737670 — Re: [Intel-wired-lan] [PATCH] i40e: make const array patterns static, reduces object code size

FromJesse Brandeburg <jesse.brandeburg@intel.com>
Date2017-09-22 18:50 +0200
SubjectRe: [Intel-wired-lan] [PATCH] i40e: make const array patterns static, reduces object code size
Message-ID<uszjk-8ri-35@gated-at.bofh.it>
In reply to#1737529
On Fri, 22 Sep 2017 15:11:38 +0100
Colin King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate const array patterns on the stack, instead make it
> static. Makes the object code smaller by over 60 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>    1953	    496	      0	   2449	    991	i40e_diag.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>    1798	    584	      0	   2382	    94e	i40e_diag.o
> 
> (gcc 6.3.0, x86-64)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Looks good, thanks Colin!

Acked-by: Jesse Brandeburg <jesse.brandeburg@intel.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web