diff mbox series

[next,V2] EDAC, pnd2: Make read-only const array intlv static

Message ID 20240919170427.497429-1-colin.i.king@gmail.com (mailing list archive)
State New
Headers show
Series [next,V2] EDAC, pnd2: Make read-only const array intlv static | expand

Commit Message

Colin Ian King Sept. 19, 2024, 5:04 p.m. UTC
Don't populate the const read-only array intlv on the stack at
run time, instead make it static. This also shrinks the object size:

$ size pnd2_edac.o.*

   text    data     bss     dec     hex filename
  15632     264    1384   17280    4380 pnd2_edac.o.new
  15644     264    1384   17292    438c pnd2_edac.o.old

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
---

V2: add note showing that this change shrinks the object size as
    suggested by Qiuxu Zhuo.

---
 drivers/edac/pnd2_edac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Tony Luck Sept. 19, 2024, 5:16 p.m. UTC | #1
> Don't populate the const read-only array intlv on the stack at
> run time, instead make it static. This also shrinks the object size:
>
> $ size pnd2_edac.o.*
>
>    text    data     bss     dec     hex filename
>   15632     264    1384   17280    4380 pnd2_edac.o.new
>   15644     264    1384   17292    438c pnd2_edac.o.old
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>

LGTM. I'll apply to RAS tree after merge window when v6.11-rc1 is available.

Thanks

-Tony
diff mbox series

Patch

diff --git a/drivers/edac/pnd2_edac.c b/drivers/edac/pnd2_edac.c
index f93f2f2b1cf2..af14c8a3279f 100644
--- a/drivers/edac/pnd2_edac.c
+++ b/drivers/edac/pnd2_edac.c
@@ -372,7 +372,7 @@  static int gen_asym_mask(struct b_cr_slice_channel_hash *p,
 			 struct b_cr_asym_mem_region1_mchbar *as1,
 			 struct b_cr_asym_2way_mem_region_mchbar *as2way)
 {
-	const int intlv[] = { 0x5, 0xA, 0x3, 0xC };
+	static const int intlv[] = { 0x5, 0xA, 0x3, 0xC };
 	int mask = 0;
 
 	if (as2way->asym_2way_interleave_enable)
@@ -489,7 +489,7 @@  static int dnv_get_registers(void)
  */
 static int get_registers(void)
 {
-	const int intlv[] = { 10, 11, 12, 12 };
+	static const int intlv[] = { 10, 11, 12, 12 };
 
 	if (RD_REG(&tolud, b_cr_tolud_pci) ||
 		RD_REG(&touud_lo, b_cr_touud_lo_pci) ||