Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: R6: Constify r2_decoder_tables

The r2_decoder_tables are never modified. They are arrays of constant
values and as such should be declared const.

This change saves 256 bytes of kernel text, and 128 bytes of kernel data
(384 bytes total) on a 32r6el_defconfig (with SMP disabled)
Before:
text data bss dec hex filename
5576221 1080804 267040 6924065 69a721 vmlinux
After:
text data bss dec hex filename
5575965 1080676 267040 6923681 69a5a1 vmlinux

Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/15289/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Matt Redfearn and committed by
Ralf Baechle
114c3708 ff2c8252

+4 -4
+4 -4
arch/mips/kernel/mips-r2-to-r6-emul.c
··· 600 600 } 601 601 602 602 /* R6 removed instructions for the SPECIAL opcode */ 603 - static struct r2_decoder_table spec_op_table[] = { 603 + static const struct r2_decoder_table spec_op_table[] = { 604 604 { 0xfc1ff83f, 0x00000008, jr_func }, 605 605 { 0xfc00ffff, 0x00000018, mult_func }, 606 606 { 0xfc00ffff, 0x00000019, multu_func }, ··· 867 867 } 868 868 869 869 /* R6 removed instructions for the SPECIAL2 opcode */ 870 - static struct r2_decoder_table spec2_op_table[] = { 870 + static const struct r2_decoder_table spec2_op_table[] = { 871 871 { 0xfc00ffff, 0x70000000, madd_func }, 872 872 { 0xfc00ffff, 0x70000001, maddu_func }, 873 873 { 0xfc0007ff, 0x70000002, mul_func }, ··· 881 881 }; 882 882 883 883 static inline int mipsr2_find_op_func(struct pt_regs *regs, u32 inst, 884 - struct r2_decoder_table *table) 884 + const struct r2_decoder_table *table) 885 885 { 886 - struct r2_decoder_table *p; 886 + const struct r2_decoder_table *p; 887 887 int err; 888 888 889 889 for (p = table; p->func; p++) {