mirror of
https://github.com/torvalds/linux.git
synced 2026-04-21 08:13:56 -04:00
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: ``` 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. Also drops the '&' from intel_eval_slpc_support so .eval receives the function pointer directly. No functional change, only initialization style is updated. Signed-off-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com> Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com> Link: https://lore.kernel.org/r/bae491e8098705a87304a7c94573b377e8c8fa37.1765897826.git.sebastian.brzezinka@intel.com
37 lines
841 B
C
37 lines
841 B
C
// SPDX-License-Identifier: MIT
|
|
|
|
/*
|
|
* Copyright © 2019 Intel Corporation
|
|
*/
|
|
|
|
#include <drm/drm_print.h>
|
|
|
|
#include "intel_engine.h"
|
|
#include "intel_gt.h"
|
|
#include "intel_gt_debugfs.h"
|
|
#include "intel_gt_engines_debugfs.h"
|
|
|
|
static int engines_show(struct seq_file *m, void *data)
|
|
{
|
|
struct intel_gt *gt = m->private;
|
|
struct intel_engine_cs *engine;
|
|
enum intel_engine_id id;
|
|
struct drm_printer p;
|
|
|
|
p = drm_seq_file_printer(m);
|
|
for_each_engine(engine, gt, id)
|
|
intel_engine_dump(engine, &p, "%s\n", engine->name);
|
|
|
|
return 0;
|
|
}
|
|
DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE(engines);
|
|
|
|
void intel_gt_engines_debugfs_register(struct intel_gt *gt, struct dentry *root)
|
|
{
|
|
static const struct intel_gt_debugfs_file files[] = {
|
|
{ .name = "engines", .fops = &engines_fops },
|
|
};
|
|
|
|
intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), gt);
|
|
}
|