[PATCH 7/7] x86: microcode: constify attribute_group structures.
From: Arvind Yadav
Date: Thu Jul 20 2017 - 03:22:55 EST
attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by <linux/sysfs.h> work with
const attribute_group. So mark the non-const structs as const.
File size before:
text data bss dec hex filename
3614 545 1560 5719 1657 x86/kernel/cpu/microcode/core.o
File size After adding 'const':
text data bss dec hex filename
3742 417 1560 5719 1657 x86/kernel/cpu/microcode/core.o
Signed-off-by: Arvind Yadav <arvind.yadav.cs@xxxxxxxxx>
---
arch/x86/kernel/cpu/microcode/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 9cb98ee..86e8f0b 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -561,7 +561,7 @@ static ssize_t pf_show(struct device *dev,
NULL
};
-static struct attribute_group mc_attr_group = {
+static const struct attribute_group mc_attr_group = {
.attrs = mc_default_attrs,
.name = "microcode",
};
@@ -707,7 +707,7 @@ static int mc_cpu_down_prep(unsigned int cpu)
NULL
};
-static struct attribute_group cpu_root_microcode_group = {
+static const struct attribute_group cpu_root_microcode_group = {
.name = "microcode",
.attrs = cpu_root_microcode_attrs,
};
--
1.9.1