constify x86 attribute_group structures.
Subsystems (3)
v2 cover constify x86 attribute_group structures.
attribute_group are not supposed to change at runtime. All functions working with attribute_group provided by <linux/sysfs.h> and 'uncore.h' work with const attribute_group. So mark the non-const structs as const.
Arvind Yadav (7):
[PATCH v2 1/7] perf: x86: intel: uncore: constify attribute_group structures. [PATCH v2 2/7] perf: x86: intel: uncore: constify attribute_group structures. [PATCH v2 3/7] perf: x86: intel: uncore: constify attribute_group structures. [PATCH v2 4/7] perf: x86: intel: uncore: constify attribute_group structures. [PATCH v2 5/7] x86: ksysfs: constify attribute_group structures. [PATCH v2 6/7] x86: therm_throt: constify attribute_group structures. [PATCH v2 7/7] x86: microcode: constify attribute_group structures.
arch/x86/events/intel/uncore.c | 2 +- arch/x86/events/intel/uncore_nhmex.c | 12 ++++----- arch/x86/events/intel/uncore_snb.c | 6 ++--- arch/x86/events/intel/uncore_snbep.c | 42 ++++++++++++++++---------------- arch/x86/kernel/cpu/mcheck/therm_throt.c | 2 +- arch/x86/kernel/cpu/microcode/core.c | 4 +-- arch/x86/kernel/ksysfs.c | 4 +-- 7 files changed, 36 insertions(+), 36 deletions(-)
Signature · 1 line
1.9.1
PATCH v2 1/7 perf: x86: intel: uncore: constify attribute_group structures.
attribute_group are not supposed to change at runtime. All functions working with attribute_group provided by 'uncore.h' work with const attribute_group. So mark the non-const structs as const.
---
change in v2:
Remove before/after size comparison from commit message.
arch/x86/events/intel/uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/intel/uncore.c +1 -1
@@ -721,7 +721,7 @@ static ssize_t uncore_get_attr_cpumask(struct device *dev, NULL, }; -static struct attribute_group uncore_pmu_attr_group = { +static const struct attribute_group uncore_pmu_attr_group = { .attrs = uncore_pmu_attrs, };
Signature · 1 line
1.9.1
PATCH v2 3/7 perf: x86: intel: uncore_snb: constify attribute_group structures.
In reply to Arvind Yadavattribute_group are not supposed to change at runtime. All functions working with attribute_group provided by 'uncore.h' work with const attribute_group. So mark the non-const structs as const.
---
change in v2:
Remove before/after size comparison from commit message.
arch/x86/events/intel/uncore_snb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/events/intel/uncore_snb.c +3 -3
@@ -130,7 +130,7 @@ static void snb_uncore_msr_exit_box(struct intel_uncore_box *box) NULL, }; -static struct attribute_group snb_uncore_format_group = { +static const struct attribute_group snb_uncore_format_group = { .name ="format" , .attrs = snb_uncore_formats_attr, };
@@ -289,7 +289,7 @@ enum { NULL, }; -static struct attribute_group snb_uncore_imc_format_group = { +static const struct attribute_group snb_uncore_imc_format_group = { .name ="format" , .attrs = snb_uncore_imc_formats_attr, };
@@ -769,7 +769,7 @@ static void nhm_uncore_msr_enable_event(struct intel_uncore_box *box, struct per NULL, }; -static struct attribute_group nhm_uncore_format_group = { +static const struct attribute_group nhm_uncore_format_group = { .name ="format" , .attrs = nhm_uncore_formats_attr, };
Signature · 1 line
1.9.1
PATCH v2 5/7 x86: ksysfs: constify attribute_group structures.
In reply to Arvind Yadavattribute_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.
---
change in v2:
Remove before/after size comparison from commit message.
arch/x86/kernel/ksysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/ksysfs.c +2 -2
@@ -55,7 +55,7 @@ static ssize_t boot_params_data_read(struct file *fp, struct kobject *kobj, NULL, }; -static struct attribute_group boot_params_attr_group = { +static const struct attribute_group boot_params_attr_group = { .attrs = boot_params_version_attrs, .bin_attrs = boot_params_data_attrs, };
@@ -202,7 +202,7 @@ static ssize_t setup_data_data_read(struct file *fp, NULL, }; -static struct attribute_group setup_data_attr_group = { +static const struct attribute_group setup_data_attr_group = { .attrs = setup_data_type_attrs, .bin_attrs = setup_data_data_attrs, };
Signature · 1 line
1.9.1
PATCH v2 6/7 x86: therm_throt: constify attribute_group structures.
In reply to Arvind Yadavattribute_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.
---
change in v2:
Remove before/after size comparison from commit message.
arch/x86/kernel/cpu/mcheck/therm_throt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/mcheck/therm_throt.c +1 -1
@@ -122,7 +122,7 @@ struct thermal_state { NULL }; -static struct attribute_group thermal_attr_group = { +static const struct attribute_group thermal_attr_group = { .attrs = thermal_throttle_attrs, .name ="thermal_throttle" };
Signature · 1 line
1.9.1
PATCH v2 7/7 x86: microcode: constify attribute_group structures.
In reply to Arvind Yadavattribute_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.
---
change in v2:
Remove before/after size comparison from commit message.
arch/x86/kernel/cpu/microcode/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/microcode/core.c +2 -2
@@ -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, };
Signature · 1 line
1.9.1
PATCH v2 4/7 perf: x86: intel: uncore_snbep: constify attribute_group structures.
In reply to Arvind Yadavattribute_group are not supposed to change at runtime. All functions working with attribute_group provided by 'uncore.h' work with const attribute_group. So mark the non-const structs as const.
---
change in v2:
Remove before/after size comparison from commit message.
arch/x86/events/intel/uncore_snbep.c | 42 ++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-)
arch/x86/events/intel/uncore_snbep.c +21 -21
@@ -603,27 +603,27 @@ static void snbep_uncore_msr_init_box(struct intel_uncore_box *box) { /* end: all zeroes */ }, }; -static struct attribute_group snbep_uncore_format_group = { +static const struct attribute_group snbep_uncore_format_group = { .name ="format" , .attrs = snbep_uncore_formats_attr, }; -static struct attribute_group snbep_uncore_ubox_format_group = { +static const struct attribute_group snbep_uncore_ubox_format_group = { .name ="format" , .attrs = snbep_uncore_ubox_formats_attr, }; -static struct attribute_group snbep_uncore_cbox_format_group = { +static const struct attribute_group snbep_uncore_cbox_format_group = { .name ="format" , .attrs = snbep_uncore_cbox_formats_attr, }; -static struct attribute_group snbep_uncore_pcu_format_group = { +static const struct attribute_group snbep_uncore_pcu_format_group = { .name ="format" , .attrs = snbep_uncore_pcu_formats_attr, }; -static struct attribute_group snbep_uncore_qpi_format_group = { +static const struct attribute_group snbep_uncore_qpi_format_group = { .name ="format" , .attrs = snbep_uncore_qpi_formats_attr, };
@@ -1432,27 +1432,27 @@ static void ivbep_uncore_pci_init_box(struct intel_uncore_box *box) NULL, }; -static struct attribute_group ivbep_uncore_format_group = { +static const struct attribute_group ivbep_uncore_format_group = { .name ="format" , .attrs = ivbep_uncore_formats_attr, }; -static struct attribute_group ivbep_uncore_ubox_format_group = { +static const struct attribute_group ivbep_uncore_ubox_format_group = { .name ="format" , .attrs = ivbep_uncore_ubox_formats_attr, }; -static struct attribute_group ivbep_uncore_cbox_format_group = { +static const struct attribute_group ivbep_uncore_cbox_format_group = { .name ="format" , .attrs = ivbep_uncore_cbox_formats_attr, }; -static struct attribute_group ivbep_uncore_pcu_format_group = { +static const struct attribute_group ivbep_uncore_pcu_format_group = { .name ="format" , .attrs = ivbep_uncore_pcu_formats_attr, }; -static struct attribute_group ivbep_uncore_qpi_format_group = { +static const struct attribute_group ivbep_uncore_qpi_format_group = { .name ="format" , .attrs = ivbep_uncore_qpi_formats_attr, };
@@ -1888,7 +1888,7 @@ int ivbep_uncore_pci_init(void) NULL, }; -static struct attribute_group knl_uncore_ubox_format_group = { +static const struct attribute_group knl_uncore_ubox_format_group = { .name ="format" , .attrs = knl_uncore_ubox_formats_attr, };
@@ -1928,7 +1928,7 @@ int ivbep_uncore_pci_init(void) NULL, }; -static struct attribute_group knl_uncore_cha_format_group = { +static const struct attribute_group knl_uncore_cha_format_group = { .name ="format" , .attrs = knl_uncore_cha_formats_attr, };
@@ -2038,7 +2038,7 @@ static void hswep_cbox_enable_event(struct intel_uncore_box *box, NULL, }; -static struct attribute_group knl_uncore_pcu_format_group = { +static const struct attribute_group knl_uncore_pcu_format_group = { .name ="format" , .attrs = knl_uncore_pcu_formats_attr, };
@@ -2188,7 +2188,7 @@ static void knl_uncore_imc_enable_event(struct intel_uncore_box *box, NULL, }; -static struct attribute_group knl_uncore_irp_format_group = { +static const struct attribute_group knl_uncore_irp_format_group = { .name ="format" , .attrs = knl_uncore_irp_formats_attr, };
@@ -2386,7 +2386,7 @@ int knl_uncore_pci_init(void) NULL, }; -static struct attribute_group hswep_uncore_ubox_format_group = { +static const struct attribute_group hswep_uncore_ubox_format_group = { .name ="format" , .attrs = hswep_uncore_ubox_formats_attr, };
@@ -2440,7 +2440,7 @@ static int hswep_ubox_hw_config(struct intel_uncore_box *box, struct perf_event NULL, }; -static struct attribute_group hswep_uncore_cbox_format_group = { +static const struct attribute_group hswep_uncore_cbox_format_group = { .name ="format" , .attrs = hswep_uncore_cbox_formats_attr, };
@@ -2622,7 +2622,7 @@ static void hswep_uncore_sbox_msr_init_box(struct intel_uncore_box *box) NULL, }; -static struct attribute_group hswep_uncore_sbox_format_group = { +static const struct attribute_group hswep_uncore_sbox_format_group = { .name ="format" , .attrs = hswep_uncore_sbox_formats_attr, };
@@ -3317,7 +3317,7 @@ int bdx_uncore_pci_init(void) NULL, }; -static struct attribute_group skx_uncore_chabox_format_group = { +static const struct attribute_group skx_uncore_chabox_format_group = { .name ="format" , .attrs = skx_uncore_cha_formats_attr, };
@@ -3416,7 +3416,7 @@ static int skx_cha_hw_config(struct intel_uncore_box *box, struct perf_event *ev NULL, }; -static struct attribute_group skx_uncore_iio_format_group = { +static const struct attribute_group skx_uncore_iio_format_group = { .name ="format" , .attrs = skx_uncore_iio_formats_attr, };
@@ -3473,7 +3473,7 @@ static void skx_iio_enable_event(struct intel_uncore_box *box, NULL, }; -static struct attribute_group skx_uncore_format_group = { +static const struct attribute_group skx_uncore_format_group = { .name ="format" , .attrs = skx_uncore_formats_attr, };
@@ -3574,7 +3574,7 @@ void skx_uncore_cpu_init(void) NULL, }; -static struct attribute_group skx_upi_uncore_format_group = { +static const struct attribute_group skx_upi_uncore_format_group = { .name ="format" , .attrs = skx_upi_uncore_formats_attr, };
Signature · 1 line
1.9.1
PATCH v2 2/7 perf: x86: intel: uncore_nhmex: constify attribute_group structures.
In reply to Arvind Yadavattribute_group are not supposed to change at runtime. All functions working with attribute_group provided by 'uncore.h' work with const attribute_group. So mark the non-const structs as const.
---
change in v2:
Remove before/after size comparison from commit message.
arch/x86/events/intel/uncore_nhmex.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/x86/events/intel/uncore_nhmex.c +6 -6
@@ -272,7 +272,7 @@ static void nhmex_uncore_msr_enable_event(struct intel_uncore_box *box, struct p NULL, }; -static struct attribute_group nhmex_uncore_ubox_format_group = { +static const struct attribute_group nhmex_uncore_ubox_format_group = { .name ="format" , .attrs = nhmex_uncore_ubox_formats_attr, };
@@ -299,7 +299,7 @@ static void nhmex_uncore_msr_enable_event(struct intel_uncore_box *box, struct p NULL, }; -static struct attribute_group nhmex_uncore_cbox_format_group = { +static const struct attribute_group nhmex_uncore_cbox_format_group = { .name ="format" , .attrs = nhmex_uncore_cbox_formats_attr, };
@@ -407,7 +407,7 @@ static void nhmex_bbox_msr_enable_event(struct intel_uncore_box *box, struct per NULL, }; -static struct attribute_group nhmex_uncore_bbox_format_group = { +static const struct attribute_group nhmex_uncore_bbox_format_group = { .name ="format" , .attrs = nhmex_uncore_bbox_formats_attr, };
@@ -484,7 +484,7 @@ static void nhmex_sbox_msr_enable_event(struct intel_uncore_box *box, struct per NULL, }; -static struct attribute_group nhmex_uncore_sbox_format_group = { +static const struct attribute_group nhmex_uncore_sbox_format_group = { .name ="format" , .attrs = nhmex_uncore_sbox_formats_attr, };
@@ -898,7 +898,7 @@ static void nhmex_mbox_msr_enable_event(struct intel_uncore_box *box, struct per NULL, }; -static struct attribute_group nhmex_uncore_mbox_format_group = { +static const struct attribute_group nhmex_uncore_mbox_format_group = { .name ="format" , .attrs = nhmex_uncore_mbox_formats_attr, };
@@ -1163,7 +1163,7 @@ static void nhmex_rbox_msr_enable_event(struct intel_uncore_box *box, struct per NULL, }; -static struct attribute_group nhmex_uncore_rbox_format_group = { +static const struct attribute_group nhmex_uncore_rbox_format_group = { .name ="format" , .attrs = nhmex_uncore_rbox_formats_attr, };
Signature · 1 line
1.9.1
Re: [PATCH v2 6/7] x86: therm_throt: constify attribute_group structures.
In reply to Arvind YadavQuoted 11 lines · Arvind Yadav
attribute_groupare not supposed to change at runtime. All functions working withattribute_groupprovided by <linux/sysfs.h> work with constattribute_group. So mark the non-const structs as const.Signed-off-by Arvind Yadav <[email protected]>---
change in v2:
Remove before/after size comparison from commit message.arch/x86/kernel/cpu/mcheck/therm_throt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
This one and the next:
Signature · 5 lines
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--tip-bot for Arvind Yadav
merge bot[tip:x86/urgent] x86: Constify attribute_group structures
In reply to Arvind Yadavx86: Constify attribute_group structures
Commit-ID: 45bd07ad82622fb7c8dd7504d976b7dd11568965 Gitweb: http://git.kernel.org/tip/45bd07ad82622fb7c8dd7504d976b7dd11568965 Author: Arvind Yadav <[email protected]> AuthorDate: Thu, 20 Jul 2017 17:00:32 +0530 Committer: Thomas Gleixner <[email protected]> CommitDate: Fri, 18 Aug 2017 11:30:35 +0200
x86: Constify attribute_group structures
attribute_groups are not supposed to change at runtime and none of the groups is modified.
Mark the non-const structs as const.
[ tglx: Folded into one big patch ]
--- arch/x86/events/intel/uncore.c | 2 +- arch/x86/events/intel/uncore_nhmex.c | 12 ++++----- arch/x86/events/intel/uncore_snb.c | 6 ++--- arch/x86/events/intel/uncore_snbep.c | 42 ++++++++++++++++---------------- arch/x86/kernel/cpu/mcheck/therm_throt.c | 2 +- arch/x86/kernel/cpu/microcode/core.c | 4 +-- arch/x86/kernel/ksysfs.c | 4 +-- 7 files changed, 36 insertions(+), 36 deletions(-)
arch/x86/events/intel/uncore.c +1 -1
@@ -721,7 +721,7 @@ static struct attribute *uncore_pmu_attrs[] = { NULL, }; -static struct attribute_group uncore_pmu_attr_group = { +static const struct attribute_group uncore_pmu_attr_group = { .attrs = uncore_pmu_attrs, };
arch/x86/events/intel/uncore_nhmex.c +6 -6
@@ -272,7 +272,7 @@ static struct attribute *nhmex_uncore_ubox_formats_attr[] = { NULL, }; -static struct attribute_group nhmex_uncore_ubox_format_group = { +static const struct attribute_group nhmex_uncore_ubox_format_group = { .name ="format" , .attrs = nhmex_uncore_ubox_formats_attr, };
@@ -299,7 +299,7 @@ static struct attribute *nhmex_uncore_cbox_formats_attr[] = { NULL, }; -static struct attribute_group nhmex_uncore_cbox_format_group = { +static const struct attribute_group nhmex_uncore_cbox_format_group = { .name ="format" , .attrs = nhmex_uncore_cbox_formats_attr, };
@@ -407,7 +407,7 @@ static struct attribute *nhmex_uncore_bbox_formats_attr[] = { NULL, }; -static struct attribute_group nhmex_uncore_bbox_format_group = { +static const struct attribute_group nhmex_uncore_bbox_format_group = { .name ="format" , .attrs = nhmex_uncore_bbox_formats_attr, };
@@ -484,7 +484,7 @@ static struct attribute *nhmex_uncore_sbox_formats_attr[] = { NULL, }; -static struct attribute_group nhmex_uncore_sbox_format_group = { +static const struct attribute_group nhmex_uncore_sbox_format_group = { .name ="format" , .attrs = nhmex_uncore_sbox_formats_attr, };
@@ -898,7 +898,7 @@ static struct attribute *nhmex_uncore_mbox_formats_attr[] = { NULL, }; -static struct attribute_group nhmex_uncore_mbox_format_group = { +static const struct attribute_group nhmex_uncore_mbox_format_group = { .name ="format" , .attrs = nhmex_uncore_mbox_formats_attr, };
@@ -1163,7 +1163,7 @@ static struct attribute *nhmex_uncore_rbox_formats_attr[] = { NULL, }; -static struct attribute_group nhmex_uncore_rbox_format_group = { +static const struct attribute_group nhmex_uncore_rbox_format_group = { .name ="format" , .attrs = nhmex_uncore_rbox_formats_attr, };
arch/x86/events/intel/uncore_snb.c +3 -3
@@ -130,7 +130,7 @@ static struct attribute *snb_uncore_formats_attr[] = { NULL, }; -static struct attribute_group snb_uncore_format_group = { +static const struct attribute_group snb_uncore_format_group = { .name ="format" , .attrs = snb_uncore_formats_attr, };
@@ -289,7 +289,7 @@ static struct attribute *snb_uncore_imc_formats_attr[] = { NULL, }; -static struct attribute_group snb_uncore_imc_format_group = { +static const struct attribute_group snb_uncore_imc_format_group = { .name ="format" , .attrs = snb_uncore_imc_formats_attr, };
@@ -769,7 +769,7 @@ static struct attribute *nhm_uncore_formats_attr[] = { NULL, }; -static struct attribute_group nhm_uncore_format_group = { +static const struct attribute_group nhm_uncore_format_group = { .name ="format" , .attrs = nhm_uncore_formats_attr, };
arch/x86/events/intel/uncore_snbep.c +21 -21
152 lines not on this page · raw message
arch/x86/kernel/cpu/mcheck/therm_throt.c +1 -1
@@ -122,7 +122,7 @@ static struct attribute *thermal_throttle_attrs[] = { NULL }; -static struct attribute_group thermal_attr_group = { +static const struct attribute_group thermal_attr_group = { .attrs = thermal_throttle_attrs, .name ="thermal_throttle" };
arch/x86/kernel/cpu/microcode/core.c +2 -2
@@ -561,7 +561,7 @@ static struct attribute *mc_default_attrs[] = { 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 struct attribute *cpu_root_microcode_attrs[] = { 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, };
arch/x86/kernel/ksysfs.c +2 -2
@@ -55,7 +55,7 @@ static struct bin_attribute *boot_params_data_attrs[] = { NULL, }; -static struct attribute_group boot_params_attr_group = { +static const struct attribute_group boot_params_attr_group = { .attrs = boot_params_version_attrs, .bin_attrs = boot_params_data_attrs, };
@@ -202,7 +202,7 @@ static struct bin_attribute *setup_data_data_attrs[] = { NULL, }; -static struct attribute_group setup_data_attr_group = { +static const struct attribute_group setup_data_attr_group = { .attrs = setup_data_type_attrs, .bin_attrs = setup_data_data_attrs, };