[PATCH v1 8/9] drm/amd/pm: move private definitions to the .c file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Move stuff that's only used in amdgpu_pm.c to the top of file instead
of leaving it in a .h files included in 30+ files.

Tested-by: Mario Limonciello <mario.limonciello@xxxxxxx>
Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@xxxxxxx>
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c     |  98 +++++++++++++++++++++++
 drivers/gpu/drm/amd/pm/inc/amdgpu_pm.h | 104 -------------------------
 2 files changed, 98 insertions(+), 104 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
index 1bac174e6d09..0efad5e1a307 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
@@ -97,6 +97,85 @@ const char * const amdgpu_pp_profile_name[] = {
 	"UNCAPPED",
 };
 
+struct cg_flag_name {
+	u64 flag;
+	const char *name;
+};
+
+enum amdgpu_device_attr_flags {
+	ATTR_FLAG_BASIC = (1 << 0),
+	ATTR_FLAG_ONEVF = (1 << 16),
+};
+
+#define ATTR_FLAG_TYPE_MASK	(0x0000ffff)
+#define ATTR_FLAG_MODE_MASK	(0xffff0000)
+#define ATTR_FLAG_MASK_ALL	(0xffffffff)
+
+enum amdgpu_device_attr_states {
+	ATTR_STATE_UNSUPPORTED = 0,
+	ATTR_STATE_SUPPORTED,
+};
+
+enum amdgpu_device_attr_id {
+	device_attr_id__unknown = -1,
+	device_attr_id__power_dpm_state = 0,
+	device_attr_id__power_dpm_force_performance_level,
+	device_attr_id__pp_num_states,
+	device_attr_id__pp_cur_state,
+	device_attr_id__pp_force_state,
+	device_attr_id__pp_table,
+	device_attr_id__pp_dpm_sclk,
+	device_attr_id__pp_dpm_mclk,
+	device_attr_id__pp_dpm_socclk,
+	device_attr_id__pp_dpm_fclk,
+	device_attr_id__pp_dpm_vclk,
+	device_attr_id__pp_dpm_vclk1,
+	device_attr_id__pp_dpm_dclk,
+	device_attr_id__pp_dpm_dclk1,
+	device_attr_id__pp_dpm_dcefclk,
+	device_attr_id__pp_dpm_pcie,
+	device_attr_id__pp_sclk_od,
+	device_attr_id__pp_mclk_od,
+	device_attr_id__pp_power_profile_mode,
+	device_attr_id__pp_od_clk_voltage,
+	device_attr_id__gpu_busy_percent,
+	device_attr_id__mem_busy_percent,
+	device_attr_id__vcn_busy_percent,
+	device_attr_id__pcie_bw,
+	device_attr_id__pp_features,
+	device_attr_id__unique_id,
+	device_attr_id__thermal_throttling_logging,
+	device_attr_id__apu_thermal_cap,
+	device_attr_id__gpu_metrics,
+	device_attr_id__smartshift_apu_power,
+	device_attr_id__smartshift_dgpu_power,
+	device_attr_id__smartshift_bias,
+	device_attr_id__pm_metrics,
+	device_attr_id__count,
+};
+
+struct amdgpu_device_attr {
+	struct device_attribute dev_attr;
+	enum amdgpu_device_attr_id attr_id;
+	enum amdgpu_device_attr_flags flags;
+	int (*attr_update)(struct amdgpu_device *adev, struct amdgpu_device_attr *attr,
+			   uint32_t mask, enum amdgpu_device_attr_states *states);
+
+	ssize_t (*attr_show)(struct device *dev, struct device_attribute *attr,
+			     char *buf);
+	ssize_t (*attr_store)(struct device *dev, struct device_attribute *attr,
+			      const char *buf, size_t count);
+};
+
+#define to_amdgpu_device_attr(_dev_attr) \
+	container_of(_dev_attr, struct amdgpu_device_attr, dev_attr)
+
+struct amdgpu_device_attr_entry {
+	struct list_head entry;
+	struct amdgpu_device_attr *attr;
+};
+
+
 static ssize_t amdgpu_pp_attr_show_wrapper(struct device *dev,
 					   struct device_attribute *attr,
 					   char *buf)
@@ -151,6 +230,25 @@ static ssize_t amdgpu_pp_attr_store_wrapper(struct device *dev,
 	return r;
 }
 
+#define AMDGPU_DEVICE_ATTR_RW(_name, _flags, ...)			\
+	{ .dev_attr = __ATTR(_name, S_IRUGO | S_IWUSR,			\
+			     amdgpu_pp_attr_show_wrapper,		\
+			     amdgpu_pp_attr_store_wrapper),		\
+	  .attr_id = device_attr_id__##_name,				\
+	  .flags = _flags,						\
+	  .attr_show = amdgpu_get_##_name,				\
+	  .attr_store = amdgpu_set_##_name,				\
+	  ##__VA_ARGS__, }
+
+#define AMDGPU_DEVICE_ATTR_RO(_name, _flags, ...)			\
+	{ .dev_attr = __ATTR(_name, S_IRUGO,				\
+			     amdgpu_pp_attr_show_wrapper,		\
+			     NULL),					\
+	  .attr_id = device_attr_id__##_name,				\
+	  .flags = _flags,						\
+	  .attr_show = amdgpu_get_##_name,				\
+	  ##__VA_ARGS__, }
+
 
 /**
  * DOC: power_dpm_state
diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_pm.h b/drivers/gpu/drm/amd/pm/inc/amdgpu_pm.h
index bf4e27b28330..d4629627444c 100644
--- a/drivers/gpu/drm/amd/pm/inc/amdgpu_pm.h
+++ b/drivers/gpu/drm/amd/pm/inc/amdgpu_pm.h
@@ -24,112 +24,8 @@
 #ifndef __AMDGPU_PM_H__
 #define __AMDGPU_PM_H__
 
-struct cg_flag_name {
-	u64 flag;
-	const char *name;
-};
-
-enum amdgpu_device_attr_flags {
-	ATTR_FLAG_BASIC = (1 << 0),
-	ATTR_FLAG_ONEVF = (1 << 16),
-};
-
-#define ATTR_FLAG_TYPE_MASK	(0x0000ffff)
-#define ATTR_FLAG_MODE_MASK	(0xffff0000)
-#define ATTR_FLAG_MASK_ALL	(0xffffffff)
-
-enum amdgpu_device_attr_states {
-	ATTR_STATE_UNSUPPORTED = 0,
-	ATTR_STATE_SUPPORTED,
-};
-
-enum amdgpu_device_attr_id {
-	device_attr_id__unknown = -1,
-	device_attr_id__power_dpm_state = 0,
-	device_attr_id__power_dpm_force_performance_level,
-	device_attr_id__pp_num_states,
-	device_attr_id__pp_cur_state,
-	device_attr_id__pp_force_state,
-	device_attr_id__pp_table,
-	device_attr_id__pp_dpm_sclk,
-	device_attr_id__pp_dpm_mclk,
-	device_attr_id__pp_dpm_socclk,
-	device_attr_id__pp_dpm_fclk,
-	device_attr_id__pp_dpm_vclk,
-	device_attr_id__pp_dpm_vclk1,
-	device_attr_id__pp_dpm_dclk,
-	device_attr_id__pp_dpm_dclk1,
-	device_attr_id__pp_dpm_dcefclk,
-	device_attr_id__pp_dpm_pcie,
-	device_attr_id__pp_sclk_od,
-	device_attr_id__pp_mclk_od,
-	device_attr_id__pp_power_profile_mode,
-	device_attr_id__pp_od_clk_voltage,
-	device_attr_id__gpu_busy_percent,
-	device_attr_id__mem_busy_percent,
-	device_attr_id__vcn_busy_percent,
-	device_attr_id__pcie_bw,
-	device_attr_id__pp_features,
-	device_attr_id__unique_id,
-	device_attr_id__thermal_throttling_logging,
-	device_attr_id__apu_thermal_cap,
-	device_attr_id__gpu_metrics,
-	device_attr_id__smartshift_apu_power,
-	device_attr_id__smartshift_dgpu_power,
-	device_attr_id__smartshift_bias,
-	device_attr_id__pm_metrics,
-	device_attr_id__count,
-};
-
-struct amdgpu_device_attr {
-	struct device_attribute dev_attr;
-	enum amdgpu_device_attr_id attr_id;
-	enum amdgpu_device_attr_flags flags;
-	int (*attr_update)(struct amdgpu_device *adev, struct amdgpu_device_attr *attr,
-			   uint32_t mask, enum amdgpu_device_attr_states *states);
-
-	ssize_t (*attr_show)(struct device *dev, struct device_attribute *attr,
-			     char *buf);
-	ssize_t (*attr_store)(struct device *dev, struct device_attribute *attr,
-			      const char *buf, size_t count);
-};
-
-struct amdgpu_device_attr_entry {
-	struct list_head entry;
-	struct amdgpu_device_attr *attr;
-};
-
-#define to_amdgpu_device_attr(_dev_attr) \
-	container_of(_dev_attr, struct amdgpu_device_attr, dev_attr)
-
-#define __AMDGPU_DEVICE_ATTR(_name, _mode, _show, _store, _flags, ...)		\
-	{ .dev_attr = __ATTR(_name, _mode,					\
-			     amdgpu_pp_attr_show_wrapper,			\
-			     _store ? amdgpu_pp_attr_store_wrapper : NULL),	\
-	  .attr_id = device_attr_id__##_name,					\
-	  .flags = _flags,							\
-	  .attr_show = _show,							\
-	  .attr_store = _store,							\
-	  ##__VA_ARGS__, }
-
-#define AMDGPU_DEVICE_ATTR(_name, _mode, _flags, ...)			\
-	__AMDGPU_DEVICE_ATTR(_name, _mode,				\
-			     amdgpu_get_##_name, amdgpu_set_##_name,	\
-			     _flags, ##__VA_ARGS__)
-
-#define AMDGPU_DEVICE_ATTR_RW(_name, _flags, ...)			\
-	AMDGPU_DEVICE_ATTR(_name, S_IRUGO | S_IWUSR,			\
-			   _flags, ##__VA_ARGS__)
-
-#define AMDGPU_DEVICE_ATTR_RO(_name, _flags, ...)			\
-	__AMDGPU_DEVICE_ATTR(_name, S_IRUGO,				\
-			     amdgpu_get_##_name, NULL,			\
-			     _flags, ##__VA_ARGS__)
-
 int amdgpu_pm_sysfs_init(struct amdgpu_device *adev);
-int amdgpu_pm_virt_sysfs_init(struct amdgpu_device *adev);
 void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev);
-void amdgpu_pm_virt_sysfs_fini(struct amdgpu_device *adev);
 
 void amdgpu_debugfs_pm_init(struct amdgpu_device *adev);
 
-- 
2.40.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux