Commit 12df6c59 authored by Andi Shyti's avatar Andi Shyti Committed by Chris Wilson

drm/i915/gt: allow setting generic data pointer

When registering debugfs files the intel gt debugfs library
forces a 'struct *gt' private data on the caller.

To be open to different usages make the new
"intel_gt_debugfs_register_files()"[*] function more generic by
converting the 'struct *gt' pointer to a 'void *' type.

I take the chance to rename the functions by using "intel_gt_" as
prefix instead of "debugfs_", so that "debugfs_gt_register_files()"
becomes "intel_gt_debugfs_register_files()".
Signed-off-by: default avatarAndi Shyti <andi.shyti@intel.com>
Reviewed-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20200326181121.16869-2-daniele.ceraolospurio@intel.com
parent d5e56705
...@@ -32,5 +32,5 @@ void debugfs_engines_register(struct intel_gt *gt, struct dentry *root) ...@@ -32,5 +32,5 @@ void debugfs_engines_register(struct intel_gt *gt, struct dentry *root)
{ "engines", &engines_fops }, { "engines", &engines_fops },
}; };
debugfs_gt_register_files(gt, root, files, ARRAY_SIZE(files)); intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), gt);
} }
...@@ -26,15 +26,14 @@ void debugfs_gt_register(struct intel_gt *gt) ...@@ -26,15 +26,14 @@ void debugfs_gt_register(struct intel_gt *gt)
debugfs_gt_pm_register(gt, root); debugfs_gt_pm_register(gt, root);
} }
void debugfs_gt_register_files(struct intel_gt *gt, void intel_gt_debugfs_register_files(struct dentry *root,
struct dentry *root, const struct debugfs_gt_file *files,
const struct debugfs_gt_file *files, unsigned long count, void *data)
unsigned long count)
{ {
while (count--) { while (count--) {
if (!files->eval || files->eval(gt)) if (!files->eval || files->eval(data))
debugfs_create_file(files->name, debugfs_create_file(files->name,
0444, root, gt, 0444, root, data,
files->fops); files->fops);
files++; files++;
......
...@@ -28,12 +28,11 @@ void debugfs_gt_register(struct intel_gt *gt); ...@@ -28,12 +28,11 @@ void debugfs_gt_register(struct intel_gt *gt);
struct debugfs_gt_file { struct debugfs_gt_file {
const char *name; const char *name;
const struct file_operations *fops; const struct file_operations *fops;
bool (*eval)(const struct intel_gt *gt); bool (*eval)(void *data);
}; };
void debugfs_gt_register_files(struct intel_gt *gt, void intel_gt_debugfs_register_files(struct dentry *root,
struct dentry *root, const struct debugfs_gt_file *files,
const struct debugfs_gt_file *files, unsigned long count, void *data);
unsigned long count);
#endif /* DEBUGFS_GT_H */ #endif /* DEBUGFS_GT_H */
...@@ -506,8 +506,10 @@ static int llc_show(struct seq_file *m, void *data) ...@@ -506,8 +506,10 @@ static int llc_show(struct seq_file *m, void *data)
return 0; return 0;
} }
static bool llc_eval(const struct intel_gt *gt) static bool llc_eval(void *data)
{ {
struct intel_gt *gt = data;
return HAS_LLC(gt->i915); return HAS_LLC(gt->i915);
} }
...@@ -580,8 +582,10 @@ static int rps_boost_show(struct seq_file *m, void *data) ...@@ -580,8 +582,10 @@ static int rps_boost_show(struct seq_file *m, void *data)
return 0; return 0;
} }
static bool rps_eval(const struct intel_gt *gt) static bool rps_eval(void *data)
{ {
struct intel_gt *gt = data;
return HAS_RPS(gt->i915); return HAS_RPS(gt->i915);
} }
...@@ -597,5 +601,5 @@ void debugfs_gt_pm_register(struct intel_gt *gt, struct dentry *root) ...@@ -597,5 +601,5 @@ void debugfs_gt_pm_register(struct intel_gt *gt, struct dentry *root)
{ "rps_boost", &rps_boost_fops, rps_eval }, { "rps_boost", &rps_boost_fops, rps_eval },
}; };
debugfs_gt_register_files(gt, root, files, ARRAY_SIZE(files)); intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), gt);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment