Hi Sebastian, On Fri, Dec 12, 2025 at 01:01:57PM +0100, Sebastian Brzezinka wrote: > CONFIG_RANDSTRUCT may reorder structure fields, which makes positional > initializers unsafe. The i915 GT debugfs tables were using positional > initializers for `struct intel_gt_debugfs_file`, and on configs where > the layout differs (e.g., presence/absence of the `.eval` callback), > this can lead to fields being initialized incorrectly and trigger > randstruct warnings such as:
nit: leave a space here. > ``` > drivers/gpu/drm/i915/gt/intel_gt_debugfs.c:75:51: note: randstruct: > casting between randomized structure pointer types (constructor) > ``` > > Switch all the GT debugfs file arrays to designated initializers. This > binds each value to the intended member regardless of structure > reordering or optional members and removes the warning while preserving > the intended initialization. > > No functional change, only initialization style is updated. > > Signed-off-by: Sebastian Brzezinka <[email protected]> > Reviewed-by: Krzysztof Karas <[email protected]> ... > static const struct intel_gt_debugfs_file files[] = { > - { "drpc", &drpc_fops, NULL }, > - { "frequency", &frequency_fops, NULL }, > - { "forcewake", &fw_domains_fops, NULL }, > - { "forcewake_user", &forcewake_user_fops, NULL}, > - { "llc", &llc_fops, llc_eval }, > - { "rps_boost", &rps_boost_fops, rps_eval }, > - { "perf_limit_reasons", &perf_limit_reasons_fops, > perf_limit_reasons_eval }, > + { .name = "drpc", .fops = &drpc_fops }, > + { .name = "frequency", .fops = &frequency_fops }, > + { .name = "forcewake", .fops = &fw_domains_fops }, > + { .name = "forcewake_user", .fops = &forcewake_user_fops}, > + { .name = "llc", .fops = &llc_fops, .eval = llc_eval }, > + { .name = "rps_boost", .fops = &rps_boost_fops, .eval = > rps_eval }, > + { .name = "perf_limit_reasons", .fops = > &perf_limit_reasons_fops, > + .eval = perf_limit_reasons_eval }, For consistency, keep it in the same line, even if it goes over 80 (or 100 (remembmer that 100 is accepted)). > }; ... > static const struct intel_gt_debugfs_file files[] = { > - { "guc_info", &guc_info_fops, NULL }, > - { "guc_registered_contexts", &guc_registered_contexts_fops, > NULL }, > - { "guc_slpc_info", &guc_slpc_info_fops, > &intel_eval_slpc_support}, > - { "guc_sched_disable_delay_ms", > &guc_sched_disable_delay_ms_fops, NULL }, > - { "guc_sched_disable_gucid_threshold", > &guc_sched_disable_gucid_threshold_fops, > - NULL }, > + { .name = "guc_info", .fops = &guc_info_fops }, > + { .name = "guc_registered_contexts", .fops = > &guc_registered_contexts_fops }, > + { .name = "guc_slpc_info", .fops = &guc_slpc_info_fops, > + .eval = &intel_eval_slpc_support }, the "&" here is an error, you have the chance to fix it. > + { .name = "guc_sched_disable_delay_ms", .fops = > &guc_sched_disable_delay_ms_fops }, > + { .name = "guc_sched_disable_gucid_threshold", > + .fops = &guc_sched_disable_gucid_threshold_fops }, same comment for the new lines here. Andi > };
