xref: /linux/drivers/gpu/drm/i915/gt/intel_gt_sysfs.h (revision f9bff0e31881d03badf191d3b0005839391f5f2b)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2022 Intel Corporation
4  */
5 
6 #ifndef __SYSFS_GT_H__
7 #define __SYSFS_GT_H__
8 
9 #include <linux/ctype.h>
10 #include <linux/kobject.h>
11 
12 #include "i915_gem.h" /* GEM_BUG_ON() */
13 #include "intel_gt_types.h"
14 
15 struct intel_gt;
16 
17 bool is_object_gt(struct kobject *kobj);
18 
19 struct drm_i915_private *kobj_to_i915(struct kobject *kobj);
20 
21 static inline struct intel_gt *kobj_to_gt(struct kobject *kobj)
22 {
23 	return container_of(kobj, struct intel_gt, sysfs_gt);
24 }
25 
26 void intel_gt_sysfs_register(struct intel_gt *gt);
27 void intel_gt_sysfs_unregister(struct intel_gt *gt);
28 struct intel_gt *intel_gt_sysfs_get_drvdata(struct kobject *kobj,
29 					    const char *name);
30 
31 #endif /* SYSFS_GT_H */
32