OSDN Git Service

drm/i915/gt: allow setting generic data pointer
authorAndi Shyti <andi.shyti@intel.com>
Thu, 26 Mar 2020 18:11:16 +0000 (11:11 -0700)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 26 Mar 2020 21:20:51 +0000 (21:20 +0000)
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: Andi Shyti <andi.shyti@intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20200326181121.16869-2-daniele.ceraolospurio@intel.com
drivers/gpu/drm/i915/gt/debugfs_engines.c
drivers/gpu/drm/i915/gt/debugfs_gt.c
drivers/gpu/drm/i915/gt/debugfs_gt.h
drivers/gpu/drm/i915/gt/debugfs_gt_pm.c

index 6a5e9ab..5e3725e 100644 (file)
@@ -32,5 +32,5 @@ void debugfs_engines_register(struct intel_gt *gt, struct dentry *root)
                { "engines", &engines_fops },
        };
 
-       debugfs_gt_register_files(gt, root, files, ARRAY_SIZE(files));
+       intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), gt);
 }
index 75255aa..de73b63 100644 (file)
@@ -26,15 +26,14 @@ void debugfs_gt_register(struct intel_gt *gt)
        debugfs_gt_pm_register(gt, root);
 }
 
-void debugfs_gt_register_files(struct intel_gt *gt,
-                              struct dentry *root,
-                              const struct debugfs_gt_file *files,
-                              unsigned long count)
+void intel_gt_debugfs_register_files(struct dentry *root,
+                                    const struct debugfs_gt_file *files,
+                                    unsigned long count, void *data)
 {
        while (count--) {
-               if (!files->eval || files->eval(gt))
+               if (!files->eval || files->eval(data))
                        debugfs_create_file(files->name,
-                                           0444, root, gt,
+                                           0444, root, data,
                                            files->fops);
 
                files++;
index 4ea0f06..f77540f 100644 (file)
@@ -28,12 +28,11 @@ void debugfs_gt_register(struct intel_gt *gt);
 struct debugfs_gt_file {
        const char *name;
        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,
-                              struct dentry *root,
-                              const struct debugfs_gt_file *files,
-                              unsigned long count);
+void intel_gt_debugfs_register_files(struct dentry *root,
+                                    const struct debugfs_gt_file *files,
+                                    unsigned long count, void *data);
 
 #endif /* DEBUGFS_GT_H */
index 059c9e5..aab30d9 100644 (file)
@@ -506,8 +506,10 @@ static int llc_show(struct seq_file *m, void *data)
        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);
 }
 
@@ -580,8 +582,10 @@ static int rps_boost_show(struct seq_file *m, void *data)
        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);
 }
 
@@ -597,5 +601,5 @@ void debugfs_gt_pm_register(struct intel_gt *gt, struct dentry *root)
                { "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);
 }