Hi Andi

On Tue Dec 16, 2025 at 2:35 PM CET, Andi Shyti wrote:
> 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)).

```
-                 .eval = perf_limit_reasons_eval },
+               { .name = "perf_limit_reasons", .fops = 
&perf_limit_reasons_fops, .eval = perf_limit_reasons_eval },
        };
 
        intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), gt);
[sbrzezin@soc-5cg4303qqt drm-tip]$ ./scripts/checkpatch.pl -g HEAD
WARNING: Missing commit description - Add an appropriate one

WARNING: line length of 116 exceeds 100 columns
#21: FILE: drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c:597:
+               { .name = "perf_limit_reasons", .fops = 
&perf_limit_reasons_fops, .eval = perf_limit_reasons_eval },

total: 0 errors, 2 warnings, 9 lines checked
```

In this case its is 116.

-- 
Best regards,
Sebastian

Reply via email to