* [PATCH 1/4] MIPS: SMP: Constify smp ops
@ 2017-02-14 14:37 ` Matt Redfearn
0 siblings, 0 replies; 10+ messages in thread
From: Matt Redfearn @ 2017-02-14 14:37 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Matt Redfearn
smp_ops providers do not modify their ops structures, so they may be
made const.
This change saves 128 bytes of kernel text on a pistachio_defconfig.
Before:
text data bss dec hex filename
7187239 1772752 470224 9430215 8fe4c7 vmlinux
After:
text data bss dec hex filename
7187111 1772752 470224 9430087 8fe447 vmlinux
Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
---
arch/mips/include/asm/smp-ops.h | 10 +++++-----
arch/mips/include/asm/smp.h | 10 +++++-----
arch/mips/kernel/smp-cps.c | 4 ++--
arch/mips/kernel/smp-mt.c | 2 +-
arch/mips/kernel/smp-up.c | 2 +-
arch/mips/kernel/smp.c | 4 ++--
6 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/arch/mips/include/asm/smp-ops.h b/arch/mips/include/asm/smp-ops.h
index db7c322f057f..cf12bde3aa78 100644
--- a/arch/mips/include/asm/smp-ops.h
+++ b/arch/mips/include/asm/smp-ops.h
@@ -35,11 +35,11 @@ struct plat_smp_ops {
#endif
};
-extern void register_smp_ops(struct plat_smp_ops *ops);
+extern void register_smp_ops(const struct plat_smp_ops *ops);
static inline void plat_smp_setup(void)
{
- extern struct plat_smp_ops *mp_ops; /* private */
+ extern const struct plat_smp_ops *mp_ops; /* private */
mp_ops->smp_setup();
}
@@ -66,7 +66,7 @@ static inline void register_smp_ops(struct plat_smp_ops *ops)
static inline int register_up_smp_ops(void)
{
#ifdef CONFIG_SMP_UP
- extern struct plat_smp_ops up_smp_ops;
+ extern const struct plat_smp_ops up_smp_ops;
register_smp_ops(&up_smp_ops);
@@ -79,7 +79,7 @@ static inline int register_up_smp_ops(void)
static inline int register_cmp_smp_ops(void)
{
#ifdef CONFIG_MIPS_CMP
- extern struct plat_smp_ops cmp_smp_ops;
+ extern const struct plat_smp_ops cmp_smp_ops;
if (!mips_cm_present())
return -ENODEV;
@@ -95,7 +95,7 @@ static inline int register_cmp_smp_ops(void)
static inline int register_vsmp_smp_ops(void)
{
#ifdef CONFIG_MIPS_MT_SMP
- extern struct plat_smp_ops vsmp_smp_ops;
+ extern const struct plat_smp_ops vsmp_smp_ops;
register_smp_ops(&vsmp_smp_ops);
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h
index 98a117a05fbc..572191ac2961 100644
--- a/arch/mips/include/asm/smp.h
+++ b/arch/mips/include/asm/smp.h
@@ -58,7 +58,7 @@ extern void calculate_cpu_foreign_map(void);
*/
static inline void smp_send_reschedule(int cpu)
{
- extern struct plat_smp_ops *mp_ops; /* private */
+ extern const struct plat_smp_ops *mp_ops; /* private */
mp_ops->send_ipi_single(cpu, SMP_RESCHEDULE_YOURSELF);
}
@@ -66,14 +66,14 @@ static inline void smp_send_reschedule(int cpu)
#ifdef CONFIG_HOTPLUG_CPU
static inline int __cpu_disable(void)
{
- extern struct plat_smp_ops *mp_ops; /* private */
+ extern const struct plat_smp_ops *mp_ops; /* private */
return mp_ops->cpu_disable();
}
static inline void __cpu_die(unsigned int cpu)
{
- extern struct plat_smp_ops *mp_ops; /* private */
+ extern const struct plat_smp_ops *mp_ops; /* private */
mp_ops->cpu_die(cpu);
}
@@ -97,14 +97,14 @@ int mips_smp_ipi_free(const struct cpumask *mask);
static inline void arch_send_call_function_single_ipi(int cpu)
{
- extern struct plat_smp_ops *mp_ops; /* private */
+ extern const struct plat_smp_ops *mp_ops; /* private */
mp_ops->send_ipi_mask(cpumask_of(cpu), SMP_CALL_FUNCTION);
}
static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask)
{
- extern struct plat_smp_ops *mp_ops; /* private */
+ extern const struct plat_smp_ops *mp_ops; /* private */
mp_ops->send_ipi_mask(mask, SMP_CALL_FUNCTION);
}
diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c
index a2544c2394e4..77c0db4d46e2 100644
--- a/arch/mips/kernel/smp-cps.c
+++ b/arch/mips/kernel/smp-cps.c
@@ -549,7 +549,7 @@ static void cps_cpu_die(unsigned int cpu)
#endif /* CONFIG_HOTPLUG_CPU */
-static struct plat_smp_ops cps_smp_ops = {
+static const struct plat_smp_ops cps_smp_ops = {
.smp_setup = cps_smp_setup,
.prepare_cpus = cps_prepare_cpus,
.boot_secondary = cps_boot_secondary,
@@ -565,7 +565,7 @@ static struct plat_smp_ops cps_smp_ops = {
bool mips_cps_smp_in_use(void)
{
- extern struct plat_smp_ops *mp_ops;
+ extern const struct plat_smp_ops *mp_ops;
return mp_ops == &cps_smp_ops;
}
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
index e077ea3e11fb..22db83be8349 100644
--- a/arch/mips/kernel/smp-mt.c
+++ b/arch/mips/kernel/smp-mt.c
@@ -279,7 +279,7 @@ static void __init vsmp_prepare_cpus(unsigned int max_cpus)
mips_mt_set_cpuoptions();
}
-struct plat_smp_ops vsmp_smp_ops = {
+const struct plat_smp_ops vsmp_smp_ops = {
.send_ipi_single = vsmp_send_ipi_single,
.send_ipi_mask = vsmp_send_ipi_mask,
.init_secondary = vsmp_init_secondary,
diff --git a/arch/mips/kernel/smp-up.c b/arch/mips/kernel/smp-up.c
index 17878d71ef2b..4cf015a624d1 100644
--- a/arch/mips/kernel/smp-up.c
+++ b/arch/mips/kernel/smp-up.c
@@ -63,7 +63,7 @@ static void up_cpu_die(unsigned int cpu)
}
#endif
-struct plat_smp_ops up_smp_ops = {
+const struct plat_smp_ops up_smp_ops = {
.send_ipi_single = up_send_ipi_single,
.send_ipi_mask = up_send_ipi_mask,
.init_secondary = up_init_secondary,
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 8c60a296294c..9f01a6f28f49 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -146,10 +146,10 @@ void calculate_cpu_foreign_map(void)
&temp_foreign_map, &cpu_sibling_map[i]);
}
-struct plat_smp_ops *mp_ops;
+const struct plat_smp_ops *mp_ops;
EXPORT_SYMBOL(mp_ops);
-void register_smp_ops(struct plat_smp_ops *ops)
+void register_smp_ops(const struct plat_smp_ops *ops)
{
if (mp_ops)
printk(KERN_WARNING "Overriding previously set SMP ops\n");
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 1/4] MIPS: SMP: Constify smp ops
@ 2017-02-14 14:37 ` Matt Redfearn
0 siblings, 0 replies; 10+ messages in thread
From: Matt Redfearn @ 2017-02-14 14:37 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Matt Redfearn
smp_ops providers do not modify their ops structures, so they may be
made const.
This change saves 128 bytes of kernel text on a pistachio_defconfig.
Before:
text data bss dec hex filename
7187239 1772752 470224 9430215 8fe4c7 vmlinux
After:
text data bss dec hex filename
7187111 1772752 470224 9430087 8fe447 vmlinux
Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
---
arch/mips/include/asm/smp-ops.h | 10 +++++-----
arch/mips/include/asm/smp.h | 10 +++++-----
arch/mips/kernel/smp-cps.c | 4 ++--
arch/mips/kernel/smp-mt.c | 2 +-
arch/mips/kernel/smp-up.c | 2 +-
arch/mips/kernel/smp.c | 4 ++--
6 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/arch/mips/include/asm/smp-ops.h b/arch/mips/include/asm/smp-ops.h
index db7c322f057f..cf12bde3aa78 100644
--- a/arch/mips/include/asm/smp-ops.h
+++ b/arch/mips/include/asm/smp-ops.h
@@ -35,11 +35,11 @@ struct plat_smp_ops {
#endif
};
-extern void register_smp_ops(struct plat_smp_ops *ops);
+extern void register_smp_ops(const struct plat_smp_ops *ops);
static inline void plat_smp_setup(void)
{
- extern struct plat_smp_ops *mp_ops; /* private */
+ extern const struct plat_smp_ops *mp_ops; /* private */
mp_ops->smp_setup();
}
@@ -66,7 +66,7 @@ static inline void register_smp_ops(struct plat_smp_ops *ops)
static inline int register_up_smp_ops(void)
{
#ifdef CONFIG_SMP_UP
- extern struct plat_smp_ops up_smp_ops;
+ extern const struct plat_smp_ops up_smp_ops;
register_smp_ops(&up_smp_ops);
@@ -79,7 +79,7 @@ static inline int register_up_smp_ops(void)
static inline int register_cmp_smp_ops(void)
{
#ifdef CONFIG_MIPS_CMP
- extern struct plat_smp_ops cmp_smp_ops;
+ extern const struct plat_smp_ops cmp_smp_ops;
if (!mips_cm_present())
return -ENODEV;
@@ -95,7 +95,7 @@ static inline int register_cmp_smp_ops(void)
static inline int register_vsmp_smp_ops(void)
{
#ifdef CONFIG_MIPS_MT_SMP
- extern struct plat_smp_ops vsmp_smp_ops;
+ extern const struct plat_smp_ops vsmp_smp_ops;
register_smp_ops(&vsmp_smp_ops);
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h
index 98a117a05fbc..572191ac2961 100644
--- a/arch/mips/include/asm/smp.h
+++ b/arch/mips/include/asm/smp.h
@@ -58,7 +58,7 @@ extern void calculate_cpu_foreign_map(void);
*/
static inline void smp_send_reschedule(int cpu)
{
- extern struct plat_smp_ops *mp_ops; /* private */
+ extern const struct plat_smp_ops *mp_ops; /* private */
mp_ops->send_ipi_single(cpu, SMP_RESCHEDULE_YOURSELF);
}
@@ -66,14 +66,14 @@ static inline void smp_send_reschedule(int cpu)
#ifdef CONFIG_HOTPLUG_CPU
static inline int __cpu_disable(void)
{
- extern struct plat_smp_ops *mp_ops; /* private */
+ extern const struct plat_smp_ops *mp_ops; /* private */
return mp_ops->cpu_disable();
}
static inline void __cpu_die(unsigned int cpu)
{
- extern struct plat_smp_ops *mp_ops; /* private */
+ extern const struct plat_smp_ops *mp_ops; /* private */
mp_ops->cpu_die(cpu);
}
@@ -97,14 +97,14 @@ int mips_smp_ipi_free(const struct cpumask *mask);
static inline void arch_send_call_function_single_ipi(int cpu)
{
- extern struct plat_smp_ops *mp_ops; /* private */
+ extern const struct plat_smp_ops *mp_ops; /* private */
mp_ops->send_ipi_mask(cpumask_of(cpu), SMP_CALL_FUNCTION);
}
static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask)
{
- extern struct plat_smp_ops *mp_ops; /* private */
+ extern const struct plat_smp_ops *mp_ops; /* private */
mp_ops->send_ipi_mask(mask, SMP_CALL_FUNCTION);
}
diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c
index a2544c2394e4..77c0db4d46e2 100644
--- a/arch/mips/kernel/smp-cps.c
+++ b/arch/mips/kernel/smp-cps.c
@@ -549,7 +549,7 @@ static void cps_cpu_die(unsigned int cpu)
#endif /* CONFIG_HOTPLUG_CPU */
-static struct plat_smp_ops cps_smp_ops = {
+static const struct plat_smp_ops cps_smp_ops = {
.smp_setup = cps_smp_setup,
.prepare_cpus = cps_prepare_cpus,
.boot_secondary = cps_boot_secondary,
@@ -565,7 +565,7 @@ static struct plat_smp_ops cps_smp_ops = {
bool mips_cps_smp_in_use(void)
{
- extern struct plat_smp_ops *mp_ops;
+ extern const struct plat_smp_ops *mp_ops;
return mp_ops == &cps_smp_ops;
}
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
index e077ea3e11fb..22db83be8349 100644
--- a/arch/mips/kernel/smp-mt.c
+++ b/arch/mips/kernel/smp-mt.c
@@ -279,7 +279,7 @@ static void __init vsmp_prepare_cpus(unsigned int max_cpus)
mips_mt_set_cpuoptions();
}
-struct plat_smp_ops vsmp_smp_ops = {
+const struct plat_smp_ops vsmp_smp_ops = {
.send_ipi_single = vsmp_send_ipi_single,
.send_ipi_mask = vsmp_send_ipi_mask,
.init_secondary = vsmp_init_secondary,
diff --git a/arch/mips/kernel/smp-up.c b/arch/mips/kernel/smp-up.c
index 17878d71ef2b..4cf015a624d1 100644
--- a/arch/mips/kernel/smp-up.c
+++ b/arch/mips/kernel/smp-up.c
@@ -63,7 +63,7 @@ static void up_cpu_die(unsigned int cpu)
}
#endif
-struct plat_smp_ops up_smp_ops = {
+const struct plat_smp_ops up_smp_ops = {
.send_ipi_single = up_send_ipi_single,
.send_ipi_mask = up_send_ipi_mask,
.init_secondary = up_init_secondary,
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 8c60a296294c..9f01a6f28f49 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -146,10 +146,10 @@ void calculate_cpu_foreign_map(void)
&temp_foreign_map, &cpu_sibling_map[i]);
}
-struct plat_smp_ops *mp_ops;
+const struct plat_smp_ops *mp_ops;
EXPORT_SYMBOL(mp_ops);
-void register_smp_ops(struct plat_smp_ops *ops)
+void register_smp_ops(const struct plat_smp_ops *ops)
{
if (mp_ops)
printk(KERN_WARNING "Overriding previously set SMP ops\n");
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/4] MIPS: R6: Constify r2_decoder_tables
@ 2017-02-14 14:37 ` Matt Redfearn
0 siblings, 0 replies; 10+ messages in thread
From: Matt Redfearn @ 2017-02-14 14:37 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Matt Redfearn
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>
---
arch/mips/kernel/mips-r2-to-r6-emul.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c b/arch/mips/kernel/mips-r2-to-r6-emul.c
index d8f1cf1ec370..7d1fe0448640 100644
--- a/arch/mips/kernel/mips-r2-to-r6-emul.c
+++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
@@ -600,7 +600,7 @@ static int ddivu_func(struct pt_regs *regs, u32 ir)
}
/* R6 removed instructions for the SPECIAL opcode */
-static struct r2_decoder_table spec_op_table[] = {
+static const struct r2_decoder_table spec_op_table[] = {
{ 0xfc1ff83f, 0x00000008, jr_func },
{ 0xfc00ffff, 0x00000018, mult_func },
{ 0xfc00ffff, 0x00000019, multu_func },
@@ -867,7 +867,7 @@ static int dclo_func(struct pt_regs *regs, u32 ir)
}
/* R6 removed instructions for the SPECIAL2 opcode */
-static struct r2_decoder_table spec2_op_table[] = {
+static const struct r2_decoder_table spec2_op_table[] = {
{ 0xfc00ffff, 0x70000000, madd_func },
{ 0xfc00ffff, 0x70000001, maddu_func },
{ 0xfc0007ff, 0x70000002, mul_func },
@@ -881,9 +881,9 @@ static struct r2_decoder_table spec2_op_table[] = {
};
static inline int mipsr2_find_op_func(struct pt_regs *regs, u32 inst,
- struct r2_decoder_table *table)
+ const struct r2_decoder_table *table)
{
- struct r2_decoder_table *p;
+ const struct r2_decoder_table *p;
int err;
for (p = table; p->func; p++) {
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/4] MIPS: R6: Constify r2_decoder_tables
@ 2017-02-14 14:37 ` Matt Redfearn
0 siblings, 0 replies; 10+ messages in thread
From: Matt Redfearn @ 2017-02-14 14:37 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Matt Redfearn
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>
---
arch/mips/kernel/mips-r2-to-r6-emul.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c b/arch/mips/kernel/mips-r2-to-r6-emul.c
index d8f1cf1ec370..7d1fe0448640 100644
--- a/arch/mips/kernel/mips-r2-to-r6-emul.c
+++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
@@ -600,7 +600,7 @@ static int ddivu_func(struct pt_regs *regs, u32 ir)
}
/* R6 removed instructions for the SPECIAL opcode */
-static struct r2_decoder_table spec_op_table[] = {
+static const struct r2_decoder_table spec_op_table[] = {
{ 0xfc1ff83f, 0x00000008, jr_func },
{ 0xfc00ffff, 0x00000018, mult_func },
{ 0xfc00ffff, 0x00000019, multu_func },
@@ -867,7 +867,7 @@ static int dclo_func(struct pt_regs *regs, u32 ir)
}
/* R6 removed instructions for the SPECIAL2 opcode */
-static struct r2_decoder_table spec2_op_table[] = {
+static const struct r2_decoder_table spec2_op_table[] = {
{ 0xfc00ffff, 0x70000000, madd_func },
{ 0xfc00ffff, 0x70000001, maddu_func },
{ 0xfc0007ff, 0x70000002, mul_func },
@@ -881,9 +881,9 @@ static struct r2_decoder_table spec2_op_table[] = {
};
static inline int mipsr2_find_op_func(struct pt_regs *regs, u32 inst,
- struct r2_decoder_table *table)
+ const struct r2_decoder_table *table)
{
- struct r2_decoder_table *p;
+ const struct r2_decoder_table *p;
int err;
for (p = table; p->func; p++) {
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] MIPS: uasm: Constify insn_table
@ 2017-02-14 14:37 ` Matt Redfearn
0 siblings, 0 replies; 10+ messages in thread
From: Matt Redfearn @ 2017-02-14 14:37 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Matt Redfearn
The insn_table is an array of constant structures and as such should be
declared const.
This change saves 1088 bytes of kernel text at the expense of 64 bytes
of kernel data on a pistachio_defconfig:
Before:
text data bss dec hex filename
7187103 1772760 470224 9430087 8fe447 vmlinux
After:
text data bss dec hex filename
7186015 1772824 470224 9429063 8fe047 vmlinux
Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
---
arch/mips/mm/uasm-mips.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/mm/uasm-mips.c b/arch/mips/mm/uasm-mips.c
index 763d3f1edb8a..17a7fc4dae8d 100644
--- a/arch/mips/mm/uasm-mips.c
+++ b/arch/mips/mm/uasm-mips.c
@@ -48,7 +48,7 @@
#include "uasm.c"
-static struct insn insn_table[] = {
+static const struct insn insn_table[] = {
{ insn_addiu, M(addiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
{ insn_addu, M(spec_op, 0, 0, 0, 0, addu_op), RS | RT | RD },
{ insn_andi, M(andi_op, 0, 0, 0, 0, 0), RS | RT | UIMM },
@@ -195,7 +195,7 @@ static inline u32 build_jimm(u32 arg)
*/
static void build_insn(u32 **buf, enum opcode opc, ...)
{
- struct insn *ip = NULL;
+ const struct insn *ip = NULL;
unsigned int i;
va_list ap;
u32 op;
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] MIPS: uasm: Constify insn_table
@ 2017-02-14 14:37 ` Matt Redfearn
0 siblings, 0 replies; 10+ messages in thread
From: Matt Redfearn @ 2017-02-14 14:37 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Matt Redfearn
The insn_table is an array of constant structures and as such should be
declared const.
This change saves 1088 bytes of kernel text at the expense of 64 bytes
of kernel data on a pistachio_defconfig:
Before:
text data bss dec hex filename
7187103 1772760 470224 9430087 8fe447 vmlinux
After:
text data bss dec hex filename
7186015 1772824 470224 9429063 8fe047 vmlinux
Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
---
arch/mips/mm/uasm-mips.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/mm/uasm-mips.c b/arch/mips/mm/uasm-mips.c
index 763d3f1edb8a..17a7fc4dae8d 100644
--- a/arch/mips/mm/uasm-mips.c
+++ b/arch/mips/mm/uasm-mips.c
@@ -48,7 +48,7 @@
#include "uasm.c"
-static struct insn insn_table[] = {
+static const struct insn insn_table[] = {
{ insn_addiu, M(addiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
{ insn_addu, M(spec_op, 0, 0, 0, 0, addu_op), RS | RT | RD },
{ insn_andi, M(andi_op, 0, 0, 0, 0, 0), RS | RT | UIMM },
@@ -195,7 +195,7 @@ static inline u32 build_jimm(u32 arg)
*/
static void build_insn(u32 **buf, enum opcode opc, ...)
{
- struct insn *ip = NULL;
+ const struct insn *ip = NULL;
unsigned int i;
va_list ap;
u32 op;
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/4] MIPS: uasm: Constify insn_table_MM
@ 2017-02-14 14:37 ` Matt Redfearn
0 siblings, 0 replies; 10+ messages in thread
From: Matt Redfearn @ 2017-02-14 14:37 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Matt Redfearn
The insn_table_MM is an array of constant structures and as such should
be declared const.
This change saves 1024 bytes of kernel text on a micro32r2el_defconfig.
Before:
text data bss dec hex filename
4138863 1130964 296432 5566259 54ef33 vmlinux
After:
text data bss dec hex filename
4137839 1130964 296432 5565235 54eb33 vmlinux
Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
---
arch/mips/mm/uasm-micromips.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/mm/uasm-micromips.c b/arch/mips/mm/uasm-micromips.c
index 277cf52d80e1..ddc5a9cfe2a5 100644
--- a/arch/mips/mm/uasm-micromips.c
+++ b/arch/mips/mm/uasm-micromips.c
@@ -40,7 +40,7 @@
#include "uasm.c"
-static struct insn insn_table_MM[] = {
+static const struct insn insn_table_MM[] = {
{ insn_addu, M(mm_pool32a_op, 0, 0, 0, 0, mm_addu32_op), RT | RS | RD },
{ insn_addiu, M(mm_addiu32_op, 0, 0, 0, 0, 0), RT | RS | SIMM },
{ insn_and, M(mm_pool32a_op, 0, 0, 0, 0, mm_and_op), RT | RS | RD },
@@ -156,7 +156,7 @@ static inline u32 build_jimm(u32 arg)
*/
static void build_insn(u32 **buf, enum opcode opc, ...)
{
- struct insn *ip = NULL;
+ const struct insn *ip = NULL;
unsigned int i;
va_list ap;
u32 op;
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/4] MIPS: uasm: Constify insn_table_MM
@ 2017-02-14 14:37 ` Matt Redfearn
0 siblings, 0 replies; 10+ messages in thread
From: Matt Redfearn @ 2017-02-14 14:37 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Matt Redfearn
The insn_table_MM is an array of constant structures and as such should
be declared const.
This change saves 1024 bytes of kernel text on a micro32r2el_defconfig.
Before:
text data bss dec hex filename
4138863 1130964 296432 5566259 54ef33 vmlinux
After:
text data bss dec hex filename
4137839 1130964 296432 5565235 54eb33 vmlinux
Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
---
arch/mips/mm/uasm-micromips.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/mm/uasm-micromips.c b/arch/mips/mm/uasm-micromips.c
index 277cf52d80e1..ddc5a9cfe2a5 100644
--- a/arch/mips/mm/uasm-micromips.c
+++ b/arch/mips/mm/uasm-micromips.c
@@ -40,7 +40,7 @@
#include "uasm.c"
-static struct insn insn_table_MM[] = {
+static const struct insn insn_table_MM[] = {
{ insn_addu, M(mm_pool32a_op, 0, 0, 0, 0, mm_addu32_op), RT | RS | RD },
{ insn_addiu, M(mm_addiu32_op, 0, 0, 0, 0, 0), RT | RS | SIMM },
{ insn_and, M(mm_pool32a_op, 0, 0, 0, 0, mm_and_op), RT | RS | RD },
@@ -156,7 +156,7 @@ static inline u32 build_jimm(u32 arg)
*/
static void build_insn(u32 **buf, enum opcode opc, ...)
{
- struct insn *ip = NULL;
+ const struct insn *ip = NULL;
unsigned int i;
va_list ap;
u32 op;
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] MIPS: SMP: Constify smp ops
@ 2017-02-15 13:13 ` Matt Redfearn
0 siblings, 0 replies; 10+ messages in thread
From: Matt Redfearn @ 2017-02-15 13:13 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
On 14/02/17 14:37, Matt Redfearn wrote:
> smp_ops providers do not modify their ops structures, so they may be
> made const.
>
> This change saves 128 bytes of kernel text on a pistachio_defconfig.
> Before:
> text data bss dec hex filename
> 7187239 1772752 470224 9430215 8fe4c7 vmlinux
> After:
> text data bss dec hex filename
> 7187111 1772752 470224 9430087 8fe447 vmlinux
>
> Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
Forget this one, it misses a whole bunch of smp_ops providers. I'll send
a v2 after the merge window.
Thanks,
Matt
> ---
>
> arch/mips/include/asm/smp-ops.h | 10 +++++-----
> arch/mips/include/asm/smp.h | 10 +++++-----
> arch/mips/kernel/smp-cps.c | 4 ++--
> arch/mips/kernel/smp-mt.c | 2 +-
> arch/mips/kernel/smp-up.c | 2 +-
> arch/mips/kernel/smp.c | 4 ++--
> 6 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/arch/mips/include/asm/smp-ops.h b/arch/mips/include/asm/smp-ops.h
> index db7c322f057f..cf12bde3aa78 100644
> --- a/arch/mips/include/asm/smp-ops.h
> +++ b/arch/mips/include/asm/smp-ops.h
> @@ -35,11 +35,11 @@ struct plat_smp_ops {
> #endif
> };
>
> -extern void register_smp_ops(struct plat_smp_ops *ops);
> +extern void register_smp_ops(const struct plat_smp_ops *ops);
>
> static inline void plat_smp_setup(void)
> {
> - extern struct plat_smp_ops *mp_ops; /* private */
> + extern const struct plat_smp_ops *mp_ops; /* private */
>
> mp_ops->smp_setup();
> }
> @@ -66,7 +66,7 @@ static inline void register_smp_ops(struct plat_smp_ops *ops)
> static inline int register_up_smp_ops(void)
> {
> #ifdef CONFIG_SMP_UP
> - extern struct plat_smp_ops up_smp_ops;
> + extern const struct plat_smp_ops up_smp_ops;
>
> register_smp_ops(&up_smp_ops);
>
> @@ -79,7 +79,7 @@ static inline int register_up_smp_ops(void)
> static inline int register_cmp_smp_ops(void)
> {
> #ifdef CONFIG_MIPS_CMP
> - extern struct plat_smp_ops cmp_smp_ops;
> + extern const struct plat_smp_ops cmp_smp_ops;
>
> if (!mips_cm_present())
> return -ENODEV;
> @@ -95,7 +95,7 @@ static inline int register_cmp_smp_ops(void)
> static inline int register_vsmp_smp_ops(void)
> {
> #ifdef CONFIG_MIPS_MT_SMP
> - extern struct plat_smp_ops vsmp_smp_ops;
> + extern const struct plat_smp_ops vsmp_smp_ops;
>
> register_smp_ops(&vsmp_smp_ops);
>
> diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h
> index 98a117a05fbc..572191ac2961 100644
> --- a/arch/mips/include/asm/smp.h
> +++ b/arch/mips/include/asm/smp.h
> @@ -58,7 +58,7 @@ extern void calculate_cpu_foreign_map(void);
> */
> static inline void smp_send_reschedule(int cpu)
> {
> - extern struct plat_smp_ops *mp_ops; /* private */
> + extern const struct plat_smp_ops *mp_ops; /* private */
>
> mp_ops->send_ipi_single(cpu, SMP_RESCHEDULE_YOURSELF);
> }
> @@ -66,14 +66,14 @@ static inline void smp_send_reschedule(int cpu)
> #ifdef CONFIG_HOTPLUG_CPU
> static inline int __cpu_disable(void)
> {
> - extern struct plat_smp_ops *mp_ops; /* private */
> + extern const struct plat_smp_ops *mp_ops; /* private */
>
> return mp_ops->cpu_disable();
> }
>
> static inline void __cpu_die(unsigned int cpu)
> {
> - extern struct plat_smp_ops *mp_ops; /* private */
> + extern const struct plat_smp_ops *mp_ops; /* private */
>
> mp_ops->cpu_die(cpu);
> }
> @@ -97,14 +97,14 @@ int mips_smp_ipi_free(const struct cpumask *mask);
>
> static inline void arch_send_call_function_single_ipi(int cpu)
> {
> - extern struct plat_smp_ops *mp_ops; /* private */
> + extern const struct plat_smp_ops *mp_ops; /* private */
>
> mp_ops->send_ipi_mask(cpumask_of(cpu), SMP_CALL_FUNCTION);
> }
>
> static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask)
> {
> - extern struct plat_smp_ops *mp_ops; /* private */
> + extern const struct plat_smp_ops *mp_ops; /* private */
>
> mp_ops->send_ipi_mask(mask, SMP_CALL_FUNCTION);
> }
> diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c
> index a2544c2394e4..77c0db4d46e2 100644
> --- a/arch/mips/kernel/smp-cps.c
> +++ b/arch/mips/kernel/smp-cps.c
> @@ -549,7 +549,7 @@ static void cps_cpu_die(unsigned int cpu)
>
> #endif /* CONFIG_HOTPLUG_CPU */
>
> -static struct plat_smp_ops cps_smp_ops = {
> +static const struct plat_smp_ops cps_smp_ops = {
> .smp_setup = cps_smp_setup,
> .prepare_cpus = cps_prepare_cpus,
> .boot_secondary = cps_boot_secondary,
> @@ -565,7 +565,7 @@ static struct plat_smp_ops cps_smp_ops = {
>
> bool mips_cps_smp_in_use(void)
> {
> - extern struct plat_smp_ops *mp_ops;
> + extern const struct plat_smp_ops *mp_ops;
> return mp_ops == &cps_smp_ops;
> }
>
> diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
> index e077ea3e11fb..22db83be8349 100644
> --- a/arch/mips/kernel/smp-mt.c
> +++ b/arch/mips/kernel/smp-mt.c
> @@ -279,7 +279,7 @@ static void __init vsmp_prepare_cpus(unsigned int max_cpus)
> mips_mt_set_cpuoptions();
> }
>
> -struct plat_smp_ops vsmp_smp_ops = {
> +const struct plat_smp_ops vsmp_smp_ops = {
> .send_ipi_single = vsmp_send_ipi_single,
> .send_ipi_mask = vsmp_send_ipi_mask,
> .init_secondary = vsmp_init_secondary,
> diff --git a/arch/mips/kernel/smp-up.c b/arch/mips/kernel/smp-up.c
> index 17878d71ef2b..4cf015a624d1 100644
> --- a/arch/mips/kernel/smp-up.c
> +++ b/arch/mips/kernel/smp-up.c
> @@ -63,7 +63,7 @@ static void up_cpu_die(unsigned int cpu)
> }
> #endif
>
> -struct plat_smp_ops up_smp_ops = {
> +const struct plat_smp_ops up_smp_ops = {
> .send_ipi_single = up_send_ipi_single,
> .send_ipi_mask = up_send_ipi_mask,
> .init_secondary = up_init_secondary,
> diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
> index 8c60a296294c..9f01a6f28f49 100644
> --- a/arch/mips/kernel/smp.c
> +++ b/arch/mips/kernel/smp.c
> @@ -146,10 +146,10 @@ void calculate_cpu_foreign_map(void)
> &temp_foreign_map, &cpu_sibling_map[i]);
> }
>
> -struct plat_smp_ops *mp_ops;
> +const struct plat_smp_ops *mp_ops;
> EXPORT_SYMBOL(mp_ops);
>
> -void register_smp_ops(struct plat_smp_ops *ops)
> +void register_smp_ops(const struct plat_smp_ops *ops)
> {
> if (mp_ops)
> printk(KERN_WARNING "Overriding previously set SMP ops\n");
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] MIPS: SMP: Constify smp ops
@ 2017-02-15 13:13 ` Matt Redfearn
0 siblings, 0 replies; 10+ messages in thread
From: Matt Redfearn @ 2017-02-15 13:13 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
On 14/02/17 14:37, Matt Redfearn wrote:
> smp_ops providers do not modify their ops structures, so they may be
> made const.
>
> This change saves 128 bytes of kernel text on a pistachio_defconfig.
> Before:
> text data bss dec hex filename
> 7187239 1772752 470224 9430215 8fe4c7 vmlinux
> After:
> text data bss dec hex filename
> 7187111 1772752 470224 9430087 8fe447 vmlinux
>
> Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
Forget this one, it misses a whole bunch of smp_ops providers. I'll send
a v2 after the merge window.
Thanks,
Matt
> ---
>
> arch/mips/include/asm/smp-ops.h | 10 +++++-----
> arch/mips/include/asm/smp.h | 10 +++++-----
> arch/mips/kernel/smp-cps.c | 4 ++--
> arch/mips/kernel/smp-mt.c | 2 +-
> arch/mips/kernel/smp-up.c | 2 +-
> arch/mips/kernel/smp.c | 4 ++--
> 6 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/arch/mips/include/asm/smp-ops.h b/arch/mips/include/asm/smp-ops.h
> index db7c322f057f..cf12bde3aa78 100644
> --- a/arch/mips/include/asm/smp-ops.h
> +++ b/arch/mips/include/asm/smp-ops.h
> @@ -35,11 +35,11 @@ struct plat_smp_ops {
> #endif
> };
>
> -extern void register_smp_ops(struct plat_smp_ops *ops);
> +extern void register_smp_ops(const struct plat_smp_ops *ops);
>
> static inline void plat_smp_setup(void)
> {
> - extern struct plat_smp_ops *mp_ops; /* private */
> + extern const struct plat_smp_ops *mp_ops; /* private */
>
> mp_ops->smp_setup();
> }
> @@ -66,7 +66,7 @@ static inline void register_smp_ops(struct plat_smp_ops *ops)
> static inline int register_up_smp_ops(void)
> {
> #ifdef CONFIG_SMP_UP
> - extern struct plat_smp_ops up_smp_ops;
> + extern const struct plat_smp_ops up_smp_ops;
>
> register_smp_ops(&up_smp_ops);
>
> @@ -79,7 +79,7 @@ static inline int register_up_smp_ops(void)
> static inline int register_cmp_smp_ops(void)
> {
> #ifdef CONFIG_MIPS_CMP
> - extern struct plat_smp_ops cmp_smp_ops;
> + extern const struct plat_smp_ops cmp_smp_ops;
>
> if (!mips_cm_present())
> return -ENODEV;
> @@ -95,7 +95,7 @@ static inline int register_cmp_smp_ops(void)
> static inline int register_vsmp_smp_ops(void)
> {
> #ifdef CONFIG_MIPS_MT_SMP
> - extern struct plat_smp_ops vsmp_smp_ops;
> + extern const struct plat_smp_ops vsmp_smp_ops;
>
> register_smp_ops(&vsmp_smp_ops);
>
> diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h
> index 98a117a05fbc..572191ac2961 100644
> --- a/arch/mips/include/asm/smp.h
> +++ b/arch/mips/include/asm/smp.h
> @@ -58,7 +58,7 @@ extern void calculate_cpu_foreign_map(void);
> */
> static inline void smp_send_reschedule(int cpu)
> {
> - extern struct plat_smp_ops *mp_ops; /* private */
> + extern const struct plat_smp_ops *mp_ops; /* private */
>
> mp_ops->send_ipi_single(cpu, SMP_RESCHEDULE_YOURSELF);
> }
> @@ -66,14 +66,14 @@ static inline void smp_send_reschedule(int cpu)
> #ifdef CONFIG_HOTPLUG_CPU
> static inline int __cpu_disable(void)
> {
> - extern struct plat_smp_ops *mp_ops; /* private */
> + extern const struct plat_smp_ops *mp_ops; /* private */
>
> return mp_ops->cpu_disable();
> }
>
> static inline void __cpu_die(unsigned int cpu)
> {
> - extern struct plat_smp_ops *mp_ops; /* private */
> + extern const struct plat_smp_ops *mp_ops; /* private */
>
> mp_ops->cpu_die(cpu);
> }
> @@ -97,14 +97,14 @@ int mips_smp_ipi_free(const struct cpumask *mask);
>
> static inline void arch_send_call_function_single_ipi(int cpu)
> {
> - extern struct plat_smp_ops *mp_ops; /* private */
> + extern const struct plat_smp_ops *mp_ops; /* private */
>
> mp_ops->send_ipi_mask(cpumask_of(cpu), SMP_CALL_FUNCTION);
> }
>
> static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask)
> {
> - extern struct plat_smp_ops *mp_ops; /* private */
> + extern const struct plat_smp_ops *mp_ops; /* private */
>
> mp_ops->send_ipi_mask(mask, SMP_CALL_FUNCTION);
> }
> diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c
> index a2544c2394e4..77c0db4d46e2 100644
> --- a/arch/mips/kernel/smp-cps.c
> +++ b/arch/mips/kernel/smp-cps.c
> @@ -549,7 +549,7 @@ static void cps_cpu_die(unsigned int cpu)
>
> #endif /* CONFIG_HOTPLUG_CPU */
>
> -static struct plat_smp_ops cps_smp_ops = {
> +static const struct plat_smp_ops cps_smp_ops = {
> .smp_setup = cps_smp_setup,
> .prepare_cpus = cps_prepare_cpus,
> .boot_secondary = cps_boot_secondary,
> @@ -565,7 +565,7 @@ static struct plat_smp_ops cps_smp_ops = {
>
> bool mips_cps_smp_in_use(void)
> {
> - extern struct plat_smp_ops *mp_ops;
> + extern const struct plat_smp_ops *mp_ops;
> return mp_ops == &cps_smp_ops;
> }
>
> diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
> index e077ea3e11fb..22db83be8349 100644
> --- a/arch/mips/kernel/smp-mt.c
> +++ b/arch/mips/kernel/smp-mt.c
> @@ -279,7 +279,7 @@ static void __init vsmp_prepare_cpus(unsigned int max_cpus)
> mips_mt_set_cpuoptions();
> }
>
> -struct plat_smp_ops vsmp_smp_ops = {
> +const struct plat_smp_ops vsmp_smp_ops = {
> .send_ipi_single = vsmp_send_ipi_single,
> .send_ipi_mask = vsmp_send_ipi_mask,
> .init_secondary = vsmp_init_secondary,
> diff --git a/arch/mips/kernel/smp-up.c b/arch/mips/kernel/smp-up.c
> index 17878d71ef2b..4cf015a624d1 100644
> --- a/arch/mips/kernel/smp-up.c
> +++ b/arch/mips/kernel/smp-up.c
> @@ -63,7 +63,7 @@ static void up_cpu_die(unsigned int cpu)
> }
> #endif
>
> -struct plat_smp_ops up_smp_ops = {
> +const struct plat_smp_ops up_smp_ops = {
> .send_ipi_single = up_send_ipi_single,
> .send_ipi_mask = up_send_ipi_mask,
> .init_secondary = up_init_secondary,
> diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
> index 8c60a296294c..9f01a6f28f49 100644
> --- a/arch/mips/kernel/smp.c
> +++ b/arch/mips/kernel/smp.c
> @@ -146,10 +146,10 @@ void calculate_cpu_foreign_map(void)
> &temp_foreign_map, &cpu_sibling_map[i]);
> }
>
> -struct plat_smp_ops *mp_ops;
> +const struct plat_smp_ops *mp_ops;
> EXPORT_SYMBOL(mp_ops);
>
> -void register_smp_ops(struct plat_smp_ops *ops)
> +void register_smp_ops(const struct plat_smp_ops *ops)
> {
> if (mp_ops)
> printk(KERN_WARNING "Overriding previously set SMP ops\n");
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2017-02-15 13:14 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-14 14:37 [PATCH 1/4] MIPS: SMP: Constify smp ops Matt Redfearn
2017-02-14 14:37 ` Matt Redfearn
2017-02-14 14:37 ` [PATCH 2/4] MIPS: R6: Constify r2_decoder_tables Matt Redfearn
2017-02-14 14:37 ` Matt Redfearn
2017-02-14 14:37 ` [PATCH 3/4] MIPS: uasm: Constify insn_table Matt Redfearn
2017-02-14 14:37 ` Matt Redfearn
2017-02-14 14:37 ` [PATCH 4/4] MIPS: uasm: Constify insn_table_MM Matt Redfearn
2017-02-14 14:37 ` Matt Redfearn
2017-02-15 13:13 ` [PATCH 1/4] MIPS: SMP: Constify smp ops Matt Redfearn
2017-02-15 13:13 ` Matt Redfearn
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.