Skip to content

Commit 6b3a3e1

Browse files
rohanmclurempe
authored andcommitted
powerpc: declare unmodified attribute_group usages const
Inspired by (bd75b4e: Constify static attribute_group structs), accepted by linux-next, reported: https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20220210202805.7750-4-rikard.falkeborn@gmail.com/ Nearly all singletons of type struct attribute_group are never modified, and so are candidates for being const. Declare them as const. Signed-off-by: Rohan McLure <rmclure@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20220307231414.86560-1-rmclure@linux.ibm.com
1 parent 5986f6b commit 6b3a3e1

17 files changed

Lines changed: 33 additions & 33 deletions

File tree

arch/powerpc/include/asm/spu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ void unregister_spu_syscalls(struct spufs_calls *calls);
249249
int spu_add_dev_attr(struct device_attribute *attr);
250250
void spu_remove_dev_attr(struct device_attribute *attr);
251251

252-
int spu_add_dev_attr_group(struct attribute_group *attrs);
253-
void spu_remove_dev_attr_group(struct attribute_group *attrs);
252+
int spu_add_dev_attr_group(const struct attribute_group *attrs);
253+
void spu_remove_dev_attr_group(const struct attribute_group *attrs);
254254

255255
extern void notify_spus_active(void);
256256
extern void do_notify_spus_active(void);

arch/powerpc/perf/generic-compat-pmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static struct attribute *generic_compat_events_attr[] = {
130130
NULL
131131
};
132132

133-
static struct attribute_group generic_compat_pmu_events_group = {
133+
static const struct attribute_group generic_compat_pmu_events_group = {
134134
.name = "events",
135135
.attrs = generic_compat_events_attr,
136136
};
@@ -146,7 +146,7 @@ static struct attribute *generic_compat_pmu_format_attr[] = {
146146
NULL,
147147
};
148148

149-
static struct attribute_group generic_compat_pmu_format_group = {
149+
static const struct attribute_group generic_compat_pmu_format_group = {
150150
.name = "format",
151151
.attrs = generic_compat_pmu_format_attr,
152152
};

arch/powerpc/perf/hv-24x7.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ static struct attribute *format_attrs[] = {
204204
NULL,
205205
};
206206

207-
static struct attribute_group format_group = {
207+
static const struct attribute_group format_group = {
208208
.name = "format",
209209
.attrs = format_attrs,
210210
};
@@ -1148,7 +1148,7 @@ static struct attribute *cpumask_attrs[] = {
11481148
NULL,
11491149
};
11501150

1151-
static struct attribute_group cpumask_attr_group = {
1151+
static const struct attribute_group cpumask_attr_group = {
11521152
.attrs = cpumask_attrs,
11531153
};
11541154

@@ -1162,7 +1162,7 @@ static struct attribute *if_attrs[] = {
11621162
NULL,
11631163
};
11641164

1165-
static struct attribute_group if_group = {
1165+
static const struct attribute_group if_group = {
11661166
.name = "interface",
11671167
.bin_attrs = if_bin_attrs,
11681168
.attrs = if_attrs,

arch/powerpc/perf/hv-gpci.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ static struct attribute *format_attrs[] = {
6565
NULL,
6666
};
6767

68-
static struct attribute_group format_group = {
68+
static const struct attribute_group format_group = {
6969
.name = "format",
7070
.attrs = format_attrs,
7171
};
7272

73-
static struct attribute_group event_group = {
73+
static const struct attribute_group event_group = {
7474
.name = "events",
7575
.attrs = hv_gpci_event_attrs,
7676
};
@@ -126,11 +126,11 @@ static struct attribute *cpumask_attrs[] = {
126126
NULL,
127127
};
128128

129-
static struct attribute_group cpumask_attr_group = {
129+
static const struct attribute_group cpumask_attr_group = {
130130
.attrs = cpumask_attrs,
131131
};
132132

133-
static struct attribute_group interface_group = {
133+
static const struct attribute_group interface_group = {
134134
.name = "interface",
135135
.attrs = interface_attrs,
136136
};

arch/powerpc/perf/imc-pmu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static struct attribute *imc_format_attrs[] = {
7171
NULL,
7272
};
7373

74-
static struct attribute_group imc_format_group = {
74+
static const struct attribute_group imc_format_group = {
7575
.name = "format",
7676
.attrs = imc_format_attrs,
7777
};
@@ -90,7 +90,7 @@ static struct attribute *trace_imc_format_attrs[] = {
9090
NULL,
9191
};
9292

93-
static struct attribute_group trace_imc_format_group = {
93+
static const struct attribute_group trace_imc_format_group = {
9494
.name = "format",
9595
.attrs = trace_imc_format_attrs,
9696
};
@@ -125,7 +125,7 @@ static struct attribute *imc_pmu_cpumask_attrs[] = {
125125
NULL,
126126
};
127127

128-
static struct attribute_group imc_pmu_cpumask_attr_group = {
128+
static const struct attribute_group imc_pmu_cpumask_attr_group = {
129129
.attrs = imc_pmu_cpumask_attrs,
130130
};
131131

arch/powerpc/perf/isa207-common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static struct attribute *isa207_pmu_format_attr[] = {
3737
NULL,
3838
};
3939

40-
struct attribute_group isa207_pmu_format_group = {
40+
const struct attribute_group isa207_pmu_format_group = {
4141
.name = "format",
4242
.attrs = isa207_pmu_format_attr,
4343
};

arch/powerpc/perf/power10-pmu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@ static struct attribute *power10_events_attr[] = {
200200
NULL
201201
};
202202

203-
static struct attribute_group power10_pmu_events_group_dd1 = {
203+
static const struct attribute_group power10_pmu_events_group_dd1 = {
204204
.name = "events",
205205
.attrs = power10_events_attr_dd1,
206206
};
207207

208-
static struct attribute_group power10_pmu_events_group = {
208+
static const struct attribute_group power10_pmu_events_group = {
209209
.name = "events",
210210
.attrs = power10_events_attr,
211211
};
@@ -253,7 +253,7 @@ static struct attribute *power10_pmu_format_attr[] = {
253253
NULL,
254254
};
255255

256-
static struct attribute_group power10_pmu_format_group = {
256+
static const struct attribute_group power10_pmu_format_group = {
257257
.name = "format",
258258
.attrs = power10_pmu_format_attr,
259259
};

arch/powerpc/perf/power7-pmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ static struct attribute *power7_events_attr[] = {
405405
NULL
406406
};
407407

408-
static struct attribute_group power7_pmu_events_group = {
408+
static const struct attribute_group power7_pmu_events_group = {
409409
.name = "events",
410410
.attrs = power7_events_attr,
411411
};
@@ -417,7 +417,7 @@ static struct attribute *power7_pmu_format_attr[] = {
417417
NULL,
418418
};
419419

420-
static struct attribute_group power7_pmu_format_group = {
420+
static const struct attribute_group power7_pmu_format_group = {
421421
.name = "format",
422422
.attrs = power7_pmu_format_attr,
423423
};

arch/powerpc/perf/power8-pmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ enum {
9292
*/
9393

9494
/* PowerISA v2.07 format attribute structure*/
95-
extern struct attribute_group isa207_pmu_format_group;
95+
extern const struct attribute_group isa207_pmu_format_group;
9696

9797
/* Table of alternatives, sorted by column 0 */
9898
static const unsigned int event_alternatives[][MAX_ALT] = {
@@ -182,7 +182,7 @@ static struct attribute *power8_events_attr[] = {
182182
NULL
183183
};
184184

185-
static struct attribute_group power8_pmu_events_group = {
185+
static const struct attribute_group power8_pmu_events_group = {
186186
.name = "events",
187187
.attrs = power8_events_attr,
188188
};

arch/powerpc/perf/power9-pmu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ extern u64 PERF_REG_EXTENDED_MASK;
9696
#define PVR_POWER9_CUMULUS 0x00002000
9797

9898
/* PowerISA v2.07 format attribute structure*/
99-
extern struct attribute_group isa207_pmu_format_group;
99+
extern const struct attribute_group isa207_pmu_format_group;
100100

101101
int p9_dd21_bl_ev[] = {
102102
PM_MRK_ST_DONE_L2,
@@ -217,7 +217,7 @@ static struct attribute *power9_events_attr[] = {
217217
NULL
218218
};
219219

220-
static struct attribute_group power9_pmu_events_group = {
220+
static const struct attribute_group power9_pmu_events_group = {
221221
.name = "events",
222222
.attrs = power9_events_attr,
223223
};
@@ -253,7 +253,7 @@ static struct attribute *power9_pmu_format_attr[] = {
253253
NULL,
254254
};
255255

256-
static struct attribute_group power9_pmu_format_group = {
256+
static const struct attribute_group power9_pmu_format_group = {
257257
.name = "format",
258258
.attrs = power9_pmu_format_attr,
259259
};

0 commit comments

Comments
 (0)