* [PATCH v2 0/7] constify x86 attribute_group structures.
@ 2017-07-20 11:30 Arvind Yadav
2017-07-20 11:30 ` [PATCH v2 1/7] perf: x86: intel: uncore: constify " Arvind Yadav
` (6 more replies)
0 siblings, 7 replies; 10+ messages in thread
From: Arvind Yadav @ 2017-07-20 11:30 UTC (permalink / raw)
To: tglx, mingo, hpa, x86, bp, tony.luck; +Cc: linux-kernel
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(-)
--
1.9.1
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH v2 1/7] perf: x86: intel: uncore: constify attribute_group structures. 2017-07-20 11:30 [PATCH v2 0/7] constify x86 attribute_group structures Arvind Yadav @ 2017-07-20 11:30 ` Arvind Yadav 2017-08-18 9:33 ` [tip:x86/urgent] x86: Constify " tip-bot for Arvind Yadav 2017-07-20 11:30 ` [PATCH v2 2/7] perf: x86: intel: uncore_nhmex: constify " Arvind Yadav ` (5 subsequent siblings) 6 siblings, 1 reply; 10+ messages in thread From: Arvind Yadav @ 2017-07-20 11:30 UTC (permalink / raw) To: tglx, mingo, hpa, x86, bp, tony.luck; +Cc: linux-kernel 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. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> --- 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(-) diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c index 44ec523..1c5390f 100644 --- a/arch/x86/events/intel/uncore.c +++ b/arch/x86/events/intel/uncore.c @@ -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, }; -- 1.9.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [tip:x86/urgent] x86: Constify attribute_group structures 2017-07-20 11:30 ` [PATCH v2 1/7] perf: x86: intel: uncore: constify " Arvind Yadav @ 2017-08-18 9:33 ` tip-bot for Arvind Yadav 0 siblings, 0 replies; 10+ messages in thread From: tip-bot for Arvind Yadav @ 2017-08-18 9:33 UTC (permalink / raw) To: linux-tip-commits; +Cc: linux-kernel, arvind.yadav.cs, tglx, hpa, mingo Commit-ID: 45bd07ad82622fb7c8dd7504d976b7dd11568965 Gitweb: http://git.kernel.org/tip/45bd07ad82622fb7c8dd7504d976b7dd11568965 Author: Arvind Yadav <arvind.yadav.cs@gmail.com> AuthorDate: Thu, 20 Jul 2017 17:00:32 +0530 Committer: Thomas Gleixner <tglx@linutronix.de> 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 ] Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: tony.luck@intel.com Cc: bp@alien8.de Link: http://lkml.kernel.org/r/1500550238-15655-2-git-send-email-arvind.yadav.cs@gmail.com --- 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(-) diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c index 44ec523..1c5390f 100644 --- a/arch/x86/events/intel/uncore.c +++ b/arch/x86/events/intel/uncore.c @@ -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, }; diff --git a/arch/x86/events/intel/uncore_nhmex.c b/arch/x86/events/intel/uncore_nhmex.c index cda5693..6a5cbe9 100644 --- a/arch/x86/events/intel/uncore_nhmex.c +++ b/arch/x86/events/intel/uncore_nhmex.c @@ -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, }; diff --git a/arch/x86/events/intel/uncore_snb.c b/arch/x86/events/intel/uncore_snb.c index a3dcc12..db1127c 100644 --- a/arch/x86/events/intel/uncore_snb.c +++ b/arch/x86/events/intel/uncore_snb.c @@ -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, }; diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index 4f91276..db1fe37 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -602,27 +602,27 @@ static struct uncore_event_desc snbep_uncore_qpi_events[] = { { /* 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, }; @@ -1431,27 +1431,27 @@ static struct attribute *ivbep_uncore_qpi_formats_attr[] = { 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, }; @@ -1887,7 +1887,7 @@ static struct attribute *knl_uncore_ubox_formats_attr[] = { 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, }; @@ -1927,7 +1927,7 @@ static struct attribute *knl_uncore_cha_formats_attr[] = { 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, }; @@ -2037,7 +2037,7 @@ static struct attribute *knl_uncore_pcu_formats_attr[] = { 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, }; @@ -2187,7 +2187,7 @@ static struct attribute *knl_uncore_irp_formats_attr[] = { 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, }; @@ -2385,7 +2385,7 @@ static struct attribute *hswep_uncore_ubox_formats_attr[] = { 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, }; @@ -2439,7 +2439,7 @@ static struct attribute *hswep_uncore_cbox_formats_attr[] = { 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, }; @@ -2621,7 +2621,7 @@ static struct attribute *hswep_uncore_sbox_formats_attr[] = { 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, }; @@ -3314,7 +3314,7 @@ static struct attribute *skx_uncore_cha_formats_attr[] = { 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, }; @@ -3427,7 +3427,7 @@ static struct attribute *skx_uncore_iio_formats_attr[] = { 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, }; @@ -3484,7 +3484,7 @@ static struct attribute *skx_uncore_formats_attr[] = { 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, }; @@ -3605,7 +3605,7 @@ static struct attribute *skx_upi_uncore_formats_attr[] = { 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, }; diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c index d7cc190..f7370ab 100644 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c @@ -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" }; 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 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, }; diff --git a/arch/x86/kernel/ksysfs.c b/arch/x86/kernel/ksysfs.c index 4afc67f..06e1ff5 100644 --- a/arch/x86/kernel/ksysfs.c +++ b/arch/x86/kernel/ksysfs.c @@ -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, }; ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 2/7] perf: x86: intel: uncore_nhmex: constify attribute_group structures. 2017-07-20 11:30 [PATCH v2 0/7] constify x86 attribute_group structures Arvind Yadav 2017-07-20 11:30 ` [PATCH v2 1/7] perf: x86: intel: uncore: constify " Arvind Yadav @ 2017-07-20 11:30 ` Arvind Yadav 2017-07-20 11:30 ` [PATCH v2 3/7] perf: x86: intel: uncore_snb: " Arvind Yadav ` (4 subsequent siblings) 6 siblings, 0 replies; 10+ messages in thread From: Arvind Yadav @ 2017-07-20 11:30 UTC (permalink / raw) To: tglx, mingo, hpa, x86, bp, tony.luck; +Cc: linux-kernel 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. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> --- 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(-) diff --git a/arch/x86/events/intel/uncore_nhmex.c b/arch/x86/events/intel/uncore_nhmex.c index cda5693..6a5cbe9 100644 --- a/arch/x86/events/intel/uncore_nhmex.c +++ b/arch/x86/events/intel/uncore_nhmex.c @@ -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, }; -- 1.9.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 3/7] perf: x86: intel: uncore_snb: constify attribute_group structures. 2017-07-20 11:30 [PATCH v2 0/7] constify x86 attribute_group structures Arvind Yadav 2017-07-20 11:30 ` [PATCH v2 1/7] perf: x86: intel: uncore: constify " Arvind Yadav 2017-07-20 11:30 ` [PATCH v2 2/7] perf: x86: intel: uncore_nhmex: constify " Arvind Yadav @ 2017-07-20 11:30 ` Arvind Yadav 2017-07-20 11:30 ` [PATCH v2 4/7] perf: x86: intel: uncore_snbep: " Arvind Yadav ` (3 subsequent siblings) 6 siblings, 0 replies; 10+ messages in thread From: Arvind Yadav @ 2017-07-20 11:30 UTC (permalink / raw) To: tglx, mingo, hpa, x86, bp, tony.luck; +Cc: linux-kernel 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. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> --- 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(-) diff --git a/arch/x86/events/intel/uncore_snb.c b/arch/x86/events/intel/uncore_snb.c index a3dcc12..db1127c 100644 --- a/arch/x86/events/intel/uncore_snb.c +++ b/arch/x86/events/intel/uncore_snb.c @@ -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, }; -- 1.9.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 4/7] perf: x86: intel: uncore_snbep: constify attribute_group structures. 2017-07-20 11:30 [PATCH v2 0/7] constify x86 attribute_group structures Arvind Yadav ` (2 preceding siblings ...) 2017-07-20 11:30 ` [PATCH v2 3/7] perf: x86: intel: uncore_snb: " Arvind Yadav @ 2017-07-20 11:30 ` Arvind Yadav 2017-07-20 11:30 ` [PATCH v2 5/7] x86: ksysfs: " Arvind Yadav ` (2 subsequent siblings) 6 siblings, 0 replies; 10+ messages in thread From: Arvind Yadav @ 2017-07-20 11:30 UTC (permalink / raw) To: tglx, mingo, hpa, x86, bp, tony.luck; +Cc: linux-kernel 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. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> --- 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(-) diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index dae2fed..080d8ba 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -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, }; -- 1.9.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 5/7] x86: ksysfs: constify attribute_group structures. 2017-07-20 11:30 [PATCH v2 0/7] constify x86 attribute_group structures Arvind Yadav ` (3 preceding siblings ...) 2017-07-20 11:30 ` [PATCH v2 4/7] perf: x86: intel: uncore_snbep: " Arvind Yadav @ 2017-07-20 11:30 ` Arvind Yadav 2017-07-20 11:30 ` [PATCH v2 6/7] x86: therm_throt: " Arvind Yadav 2017-07-20 11:30 ` [PATCH v2 7/7] x86: microcode: " Arvind Yadav 6 siblings, 0 replies; 10+ messages in thread From: Arvind Yadav @ 2017-07-20 11:30 UTC (permalink / raw) To: tglx, mingo, hpa, x86, bp, tony.luck; +Cc: linux-kernel 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. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> --- change in v2: Remove before/after size comparison from commit message. arch/x86/kernel/ksysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/ksysfs.c b/arch/x86/kernel/ksysfs.c index 4afc67f..06e1ff5 100644 --- a/arch/x86/kernel/ksysfs.c +++ b/arch/x86/kernel/ksysfs.c @@ -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, }; -- 1.9.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 6/7] x86: therm_throt: constify attribute_group structures. 2017-07-20 11:30 [PATCH v2 0/7] constify x86 attribute_group structures Arvind Yadav ` (4 preceding siblings ...) 2017-07-20 11:30 ` [PATCH v2 5/7] x86: ksysfs: " Arvind Yadav @ 2017-07-20 11:30 ` Arvind Yadav 2017-07-20 15:58 ` Borislav Petkov 2017-07-20 11:30 ` [PATCH v2 7/7] x86: microcode: " Arvind Yadav 6 siblings, 1 reply; 10+ messages in thread From: Arvind Yadav @ 2017-07-20 11:30 UTC (permalink / raw) To: tglx, mingo, hpa, x86, bp, tony.luck; +Cc: linux-kernel 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. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> --- 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(-) diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c index d7cc190..f7370ab 100644 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c @@ -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" }; -- 1.9.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 6/7] x86: therm_throt: constify attribute_group structures. 2017-07-20 11:30 ` [PATCH v2 6/7] x86: therm_throt: " Arvind Yadav @ 2017-07-20 15:58 ` Borislav Petkov 0 siblings, 0 replies; 10+ messages in thread From: Borislav Petkov @ 2017-07-20 15:58 UTC (permalink / raw) To: Arvind Yadav; +Cc: tglx, mingo, hpa, x86, tony.luck, linux-kernel On Thu, Jul 20, 2017 at 05:00:37PM +0530, Arvind Yadav wrote: > 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. > > Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> > --- > 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: Acked-by: Borislav Petkov <bp@suse.de> -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 7/7] x86: microcode: constify attribute_group structures. 2017-07-20 11:30 [PATCH v2 0/7] constify x86 attribute_group structures Arvind Yadav ` (5 preceding siblings ...) 2017-07-20 11:30 ` [PATCH v2 6/7] x86: therm_throt: " Arvind Yadav @ 2017-07-20 11:30 ` Arvind Yadav 6 siblings, 0 replies; 10+ messages in thread From: Arvind Yadav @ 2017-07-20 11:30 UTC (permalink / raw) To: tglx, mingo, hpa, x86, bp, tony.luck; +Cc: linux-kernel 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. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> --- 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(-) 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 ^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2017-08-18 9:35 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-07-20 11:30 [PATCH v2 0/7] constify x86 attribute_group structures Arvind Yadav 2017-07-20 11:30 ` [PATCH v2 1/7] perf: x86: intel: uncore: constify " Arvind Yadav 2017-08-18 9:33 ` [tip:x86/urgent] x86: Constify " tip-bot for Arvind Yadav 2017-07-20 11:30 ` [PATCH v2 2/7] perf: x86: intel: uncore_nhmex: constify " Arvind Yadav 2017-07-20 11:30 ` [PATCH v2 3/7] perf: x86: intel: uncore_snb: " Arvind Yadav 2017-07-20 11:30 ` [PATCH v2 4/7] perf: x86: intel: uncore_snbep: " Arvind Yadav 2017-07-20 11:30 ` [PATCH v2 5/7] x86: ksysfs: " Arvind Yadav 2017-07-20 11:30 ` [PATCH v2 6/7] x86: therm_throt: " Arvind Yadav 2017-07-20 15:58 ` Borislav Petkov 2017-07-20 11:30 ` [PATCH v2 7/7] x86: microcode: " Arvind Yadav
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox