Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf: Constify static struct attribute_group

The only usage is to put their addresses in an array of pointers to
const struct attribute group. Make them const to allow the compiler
to put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20210117212847.21319-5-rikard.falkeborn@gmail.com
Signed-off-by: Will Deacon <will@kernel.org>

authored by

Rikard Falkeborn and committed by
Will Deacon
f0c14048 c2c4d5c0

+12 -12
+1 -1
drivers/perf/arm-cci.c
··· 1376 1376 NULL, 1377 1377 }; 1378 1378 1379 - static struct attribute_group pmu_attr_group = { 1379 + static const struct attribute_group pmu_attr_group = { 1380 1380 .attrs = pmu_attrs, 1381 1381 }; 1382 1382
+1 -1
drivers/perf/arm-cmn.c
··· 616 616 NULL, 617 617 }; 618 618 619 - static struct attribute_group arm_cmn_cpumask_attr_group = { 619 + static const struct attribute_group arm_cmn_cpumask_attr_group = { 620 620 .attrs = arm_cmn_cpumask_attrs, 621 621 }; 622 622
+2 -2
drivers/perf/arm_dmc620_pmu.c
··· 159 159 NULL, 160 160 }; 161 161 162 - static struct attribute_group dmc620_pmu_events_attr_group = { 162 + static const struct attribute_group dmc620_pmu_events_attr_group = { 163 163 .name = "events", 164 164 .attrs = dmc620_pmu_events_attrs, 165 165 }; ··· 222 222 NULL, 223 223 }; 224 224 225 - static struct attribute_group dmc620_pmu_format_attr_group = { 225 + static const struct attribute_group dmc620_pmu_format_attr_group = { 226 226 .name = "format", 227 227 .attrs = dmc620_pmu_formats_attrs, 228 228 };
+1 -1
drivers/perf/arm_pmu.c
··· 577 577 NULL, 578 578 }; 579 579 580 - static struct attribute_group armpmu_common_attr_group = { 580 + static const struct attribute_group armpmu_common_attr_group = { 581 581 .attrs = armpmu_common_attrs, 582 582 }; 583 583
+4 -4
drivers/perf/arm_smmuv3_pmu.c
··· 493 493 NULL 494 494 }; 495 495 496 - static struct attribute_group smmu_pmu_cpumask_group = { 496 + static const struct attribute_group smmu_pmu_cpumask_group = { 497 497 .attrs = smmu_pmu_cpumask_attrs, 498 498 }; 499 499 ··· 548 548 return 0; 549 549 } 550 550 551 - static struct attribute_group smmu_pmu_events_group = { 551 + static const struct attribute_group smmu_pmu_events_group = { 552 552 .name = "events", 553 553 .attrs = smmu_pmu_events, 554 554 .is_visible = smmu_pmu_event_is_visible, ··· 583 583 NULL 584 584 }; 585 585 586 - static struct attribute_group smmu_pmu_identifier_group = { 586 + static const struct attribute_group smmu_pmu_identifier_group = { 587 587 .attrs = smmu_pmu_identifier_attrs, 588 588 .is_visible = smmu_pmu_identifier_attr_visible, 589 589 }; ··· 602 602 NULL 603 603 }; 604 604 605 - static struct attribute_group smmu_pmu_format_group = { 605 + static const struct attribute_group smmu_pmu_format_group = { 606 606 .name = "format", 607 607 .attrs = smmu_pmu_formats, 608 608 };
+3 -3
drivers/perf/arm_spe_pmu.c
··· 146 146 NULL, 147 147 }; 148 148 149 - static struct attribute_group arm_spe_pmu_cap_group = { 149 + static const struct attribute_group arm_spe_pmu_cap_group = { 150 150 .name = "caps", 151 151 .attrs = arm_spe_pmu_cap_attr, 152 152 }; ··· 227 227 NULL, 228 228 }; 229 229 230 - static struct attribute_group arm_spe_pmu_format_group = { 230 + static const struct attribute_group arm_spe_pmu_format_group = { 231 231 .name = "format", 232 232 .attrs = arm_spe_pmu_formats_attr, 233 233 }; ··· 247 247 NULL, 248 248 }; 249 249 250 - static struct attribute_group arm_spe_pmu_group = { 250 + static const struct attribute_group arm_spe_pmu_group = { 251 251 .attrs = arm_spe_pmu_attrs, 252 252 }; 253 253