[PATCH V2 2/4] perf/x86/intel: Constify static attribute_group structs

From: Rikard Falkeborn
Date: Fri Jun 11 2021 - 16:52:51 EST


These either have their address put in an array of pointers to const
attribute structs, or (in uncore_snb.c and uncore_snbep.c) have their
address assigned to at pointer to const field in the intel_uncore_type
struct.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@xxxxxxxxx>
---
Changes since v1:
- None

arch/x86/events/intel/core.c | 8 ++++----
arch/x86/events/intel/cstate.c | 10 +++++-----
arch/x86/events/intel/pt.c | 4 ++--
arch/x86/events/intel/uncore_snb.c | 2 +-
arch/x86/events/intel/uncore_snbep.c | 2 +-
5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index e28892270c58..b07d832f304e 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -5164,12 +5164,12 @@ static struct attribute_group group_events_tsx = {
.is_visible = tsx_is_visible,
};

-static struct attribute_group group_caps_gen = {
+static const struct attribute_group group_caps_gen = {
.name = "caps",
.attrs = intel_pmu_caps_attrs,
};

-static struct attribute_group group_caps_lbr = {
+static const struct attribute_group group_caps_lbr = {
.name = "caps",
.attrs = lbr_attrs,
.is_visible = lbr_is_visible,
@@ -5185,7 +5185,7 @@ static struct attribute_group group_format_extra_skl = {
.is_visible = exra_is_visible,
};

-static struct attribute_group group_default = {
+static const struct attribute_group group_default = {
.attrs = intel_pmu_attrs,
.is_visible = default_is_visible,
};
@@ -5364,7 +5364,7 @@ static struct attribute *intel_hybrid_cpus_attrs[] = {
NULL,
};

-static struct attribute_group hybrid_group_cpus = {
+static const struct attribute_group hybrid_group_cpus = {
.attrs = intel_hybrid_cpus_attrs,
};

diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c
index 433399069e27..089f71ac83f5 100644
--- a/arch/x86/events/intel/cstate.c
+++ b/arch/x86/events/intel/cstate.c
@@ -187,7 +187,7 @@ static struct attribute *attrs_empty[] = {
* "events" group (with empty attrs) before updating
* it with detected events.
*/
-static struct attribute_group core_events_attr_group = {
+static const struct attribute_group core_events_attr_group = {
.name = "events",
.attrs = attrs_empty,
};
@@ -198,7 +198,7 @@ static struct attribute *core_format_attrs[] = {
NULL,
};

-static struct attribute_group core_format_attr_group = {
+static const struct attribute_group core_format_attr_group = {
.name = "format",
.attrs = core_format_attrs,
};
@@ -211,7 +211,7 @@ static struct attribute *cstate_cpumask_attrs[] = {
NULL,
};

-static struct attribute_group cpumask_attr_group = {
+static const struct attribute_group cpumask_attr_group = {
.attrs = cstate_cpumask_attrs,
};

@@ -266,7 +266,7 @@ static struct perf_msr pkg_msr[] = {
[PERF_CSTATE_PKG_C10_RES] = { MSR_PKG_C10_RESIDENCY, &group_cstate_pkg_c10, test_msr },
};

-static struct attribute_group pkg_events_attr_group = {
+static const struct attribute_group pkg_events_attr_group = {
.name = "events",
.attrs = attrs_empty,
};
@@ -276,7 +276,7 @@ static struct attribute *pkg_format_attrs[] = {
&format_attr_pkg_event.attr,
NULL,
};
-static struct attribute_group pkg_format_attr_group = {
+static const struct attribute_group pkg_format_attr_group = {
.name = "format",
.attrs = pkg_format_attrs,
};
diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c
index 915847655c06..83ccf106ed13 100644
--- a/arch/x86/events/intel/pt.c
+++ b/arch/x86/events/intel/pt.c
@@ -128,7 +128,7 @@ static struct attribute *pt_formats_attr[] = {
NULL,
};

-static struct attribute_group pt_format_group = {
+static const struct attribute_group pt_format_group = {
.name = "format",
.attrs = pt_formats_attr,
};
@@ -165,7 +165,7 @@ static struct attribute *pt_timing_attr[] = {
NULL,
};

-static struct attribute_group pt_timing_group = {
+static const struct attribute_group pt_timing_group = {
.attrs = pt_timing_attr,
};

diff --git a/arch/x86/events/intel/uncore_snb.c b/arch/x86/events/intel/uncore_snb.c
index 2938679f0002..e30b69fba939 100644
--- a/arch/x86/events/intel/uncore_snb.c
+++ b/arch/x86/events/intel/uncore_snb.c
@@ -369,7 +369,7 @@ static struct attribute *icl_uncore_clock_formats_attr[] = {
NULL,
};

-static struct attribute_group icl_uncore_clock_format_group = {
+static const struct attribute_group icl_uncore_clock_format_group = {
.name = "format",
.attrs = icl_uncore_clock_formats_attr,
};
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index 43eabe8d37dc..b5b22fe473d8 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -4001,7 +4001,7 @@ static struct attribute *skx_uncore_pcu_formats_attr[] = {
NULL,
};

-static struct attribute_group skx_uncore_pcu_format_group = {
+static const struct attribute_group skx_uncore_pcu_format_group = {
.name = "format",
.attrs = skx_uncore_pcu_formats_attr,
};
--
2.32.0