Skip to content

Commit 347efe5

Browse files
tititiou36alexdeucher
authored andcommitted
drm/amd/display: Constify struct timing_generator_funcs
'struct timing_generator_funcs' are not modified in these drivers. Constifying these structures moves some data to a read-only section, so increases overall security, especially when the structure holds some function pointers. Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: Alex Hung <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent c3e9826 commit 347efe5

File tree

9 files changed

+9
-9
lines changed

9 files changed

+9
-9
lines changed

drivers/gpu/drm/amd/display/dc/optc/dcn20/dcn20_optc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ void optc2_get_last_used_drr_vtotal(struct timing_generator *optc, uint32_t *ref
502502
REG_GET(OTG_DRR_CONTROL, OTG_V_TOTAL_LAST_USED_BY_DRR, refresh_rate);
503503
}
504504

505-
static struct timing_generator_funcs dcn20_tg_funcs = {
505+
static const struct timing_generator_funcs dcn20_tg_funcs = {
506506
.validate_timing = optc1_validate_timing,
507507
.program_timing = optc1_program_timing,
508508
.setup_vertical_interrupt0 = optc1_setup_vertical_interrupt0,

drivers/gpu/drm/amd/display/dc/optc/dcn201/dcn201_optc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static void optc201_get_optc_source(struct timing_generator *optc,
129129
*num_of_src_opp = 1;
130130
}
131131

132-
static struct timing_generator_funcs dcn201_tg_funcs = {
132+
static const struct timing_generator_funcs dcn201_tg_funcs = {
133133
.validate_timing = optc201_validate_timing,
134134
.program_timing = optc1_program_timing,
135135
.setup_vertical_interrupt0 = optc1_setup_vertical_interrupt0,

drivers/gpu/drm/amd/display/dc/optc/dcn30/dcn30_optc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ void optc3_tg_init(struct timing_generator *optc)
357357
optc1_clear_optc_underflow(optc);
358358
}
359359

360-
static struct timing_generator_funcs dcn30_tg_funcs = {
360+
static const struct timing_generator_funcs dcn30_tg_funcs = {
361361
.validate_timing = optc1_validate_timing,
362362
.program_timing = optc1_program_timing,
363363
.setup_vertical_interrupt0 = optc1_setup_vertical_interrupt0,

drivers/gpu/drm/amd/display/dc/optc/dcn301/dcn301_optc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void optc301_setup_manual_trigger(struct timing_generator *optc)
109109
OTG_TRIGA_CLEAR, 1);
110110
}
111111

112-
static struct timing_generator_funcs dcn30_tg_funcs = {
112+
static const struct timing_generator_funcs dcn30_tg_funcs = {
113113
.validate_timing = optc1_validate_timing,
114114
.program_timing = optc1_program_timing,
115115
.setup_vertical_interrupt0 = optc1_setup_vertical_interrupt0,

drivers/gpu/drm/amd/display/dc/optc/dcn31/dcn31_optc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ void optc31_read_otg_state(struct timing_generator *optc,
315315
s->otg_double_buffer_control = REG_READ(OTG_DOUBLE_BUFFER_CONTROL);
316316
}
317317

318-
static struct timing_generator_funcs dcn31_tg_funcs = {
318+
static const struct timing_generator_funcs dcn31_tg_funcs = {
319319
.validate_timing = optc1_validate_timing,
320320
.program_timing = optc1_program_timing,
321321
.setup_vertical_interrupt0 = optc1_setup_vertical_interrupt0,

drivers/gpu/drm/amd/display/dc/optc/dcn314/dcn314_optc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static void optc314_set_h_timing_div_manual_mode(struct timing_generator *optc,
192192
}
193193

194194

195-
static struct timing_generator_funcs dcn314_tg_funcs = {
195+
static const struct timing_generator_funcs dcn314_tg_funcs = {
196196
.validate_timing = optc1_validate_timing,
197197
.program_timing = optc1_program_timing,
198198
.setup_vertical_interrupt0 = optc1_setup_vertical_interrupt0,

drivers/gpu/drm/amd/display/dc/optc/dcn32/dcn32_optc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ static void optc32_set_drr(
297297
optc32_setup_manual_trigger(optc);
298298
}
299299

300-
static struct timing_generator_funcs dcn32_tg_funcs = {
300+
static const struct timing_generator_funcs dcn32_tg_funcs = {
301301
.validate_timing = optc1_validate_timing,
302302
.program_timing = optc1_program_timing,
303303
.setup_vertical_interrupt0 = optc1_setup_vertical_interrupt0,

drivers/gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ static void optc35_set_long_vtotal(
428428
}
429429
}
430430

431-
static struct timing_generator_funcs dcn35_tg_funcs = {
431+
static const struct timing_generator_funcs dcn35_tg_funcs = {
432432
.validate_timing = optc1_validate_timing,
433433
.program_timing = optc1_program_timing,
434434
.setup_vertical_interrupt0 = optc1_setup_vertical_interrupt0,

drivers/gpu/drm/amd/display/dc/optc/dcn401/dcn401_optc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ bool optc401_wait_update_lock_status(struct timing_generator *tg, bool locked)
459459
return true;
460460
}
461461

462-
static struct timing_generator_funcs dcn401_tg_funcs = {
462+
static const struct timing_generator_funcs dcn401_tg_funcs = {
463463
.validate_timing = optc1_validate_timing,
464464
.program_timing = optc1_program_timing,
465465
.setup_vertical_interrupt0 = optc1_setup_vertical_interrupt0,

0 commit comments

Comments
 (0)