[PATCH 3/4] drm/amd/powerplay: update printk to cgs debug prints for common part
Huang Rui
ray.huang at amd.com
Thu Dec 8 05:23:10 UTC 2016
Most of printk are replaced by cgs prints, but some functions doesn't
have device obj for some of them. So use pr_* instead at that cases.
Signed-off-by: Huang Rui <ray.huang at amd.com>
---
drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 49 +++++++++++-----------
drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c | 2 +-
drivers/gpu/drm/amd/powerplay/inc/pp_debug.h | 14 +++----
3 files changed, 33 insertions(+), 32 deletions(-)
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index c81cf14..c30ab68 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -30,6 +30,7 @@
#include "power_state.h"
#include "eventmanager.h"
#include "pp_debug.h"
+#include "cgs_common.h"
#define PP_CHECK(handle) \
@@ -76,14 +77,14 @@ static int pp_sw_init(void *handle)
if (ret)
goto err1;
- pr_info("amdgpu: powerplay initialized\n");
+ cgs_info(hwmgr->device, "powerplay initialized\n");
return 0;
err1:
if (hwmgr->pptable_func->pptable_fini)
hwmgr->pptable_func->pptable_fini(hwmgr);
err:
- pr_err("amdgpu: powerplay initialization failed\n");
+ cgs_err(hwmgr->device, "powerplay initialization failed\n");
return ret;
}
@@ -132,13 +133,13 @@ static int pp_hw_init(void *handle)
ret = smumgr->smumgr_funcs->smu_init(smumgr);
if (ret) {
- printk(KERN_ERR "[ powerplay ] smc initialization failed\n");
+ cgs_err(smumgr->device, "smc initialization failed\n");
return ret;
}
ret = smumgr->smumgr_funcs->start_smu(smumgr);
if (ret) {
- printk(KERN_ERR "[ powerplay ] smc start failed\n");
+ cgs_err(smumgr->device, "smc start failed\n");
smumgr->smumgr_funcs->smu_fini(smumgr);
return ret;
}
@@ -207,7 +208,7 @@ int amd_set_clockgating_by_smu(void *handle, uint32_t msg_id)
PP_CHECK_HW(hwmgr);
if (hwmgr->hwmgr_func->update_clock_gatings == NULL) {
- printk(KERN_INFO "%s was not implemented.\n", __func__);
+ cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
return 0;
}
@@ -227,7 +228,7 @@ static int pp_set_powergating_state(void *handle,
PP_CHECK_HW(hwmgr);
if (hwmgr->hwmgr_func->enable_per_cu_power_gating == NULL) {
- printk(KERN_INFO "%s was not implemented.\n", __func__);
+ cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
return 0;
}
@@ -273,7 +274,7 @@ static int pp_resume(void *handle)
ret = smumgr->smumgr_funcs->start_smu(smumgr);
if (ret) {
- printk(KERN_ERR "[ powerplay ] smc start failed\n");
+ cgs_err(smumgr->device, "smc start failed\n");
smumgr->smumgr_funcs->smu_fini(smumgr);
return ret;
}
@@ -328,7 +329,7 @@ static int pp_dpm_force_performance_level(void *handle,
PP_CHECK_HW(hwmgr);
if (hwmgr->hwmgr_func->force_dpm_level == NULL) {
- printk(KERN_INFO "%s was not implemented.\n", __func__);
+ cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
return 0;
}
@@ -364,7 +365,7 @@ static int pp_dpm_get_sclk(void *handle, bool low)
PP_CHECK_HW(hwmgr);
if (hwmgr->hwmgr_func->get_sclk == NULL) {
- printk(KERN_INFO "%s was not implemented.\n", __func__);
+ cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
return 0;
}
@@ -383,7 +384,7 @@ static int pp_dpm_get_mclk(void *handle, bool low)
PP_CHECK_HW(hwmgr);
if (hwmgr->hwmgr_func->get_mclk == NULL) {
- printk(KERN_INFO "%s was not implemented.\n", __func__);
+ cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
return 0;
}
@@ -402,7 +403,7 @@ static int pp_dpm_powergate_vce(void *handle, bool gate)
PP_CHECK_HW(hwmgr);
if (hwmgr->hwmgr_func->powergate_vce == NULL) {
- printk(KERN_INFO "%s was not implemented.\n", __func__);
+ cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
return 0;
}
@@ -421,7 +422,7 @@ static int pp_dpm_powergate_uvd(void *handle, bool gate)
PP_CHECK_HW(hwmgr);
if (hwmgr->hwmgr_func->powergate_uvd == NULL) {
- printk(KERN_INFO "%s was not implemented.\n", __func__);
+ cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
return 0;
}
@@ -527,7 +528,7 @@ static int pp_dpm_set_fan_control_mode(void *handle, uint32_t mode)
PP_CHECK_HW(hwmgr);
if (hwmgr->hwmgr_func->set_fan_control_mode == NULL) {
- printk(KERN_INFO "%s was not implemented.\n", __func__);
+ cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
return 0;
}
@@ -546,7 +547,7 @@ static int pp_dpm_get_fan_control_mode(void *handle)
PP_CHECK_HW(hwmgr);
if (hwmgr->hwmgr_func->get_fan_control_mode == NULL) {
- printk(KERN_INFO "%s was not implemented.\n", __func__);
+ cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
return 0;
}
@@ -565,7 +566,7 @@ static int pp_dpm_set_fan_speed_percent(void *handle, uint32_t percent)
PP_CHECK_HW(hwmgr);
if (hwmgr->hwmgr_func->set_fan_speed_percent == NULL) {
- printk(KERN_INFO "%s was not implemented.\n", __func__);
+ cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
return 0;
}
@@ -584,7 +585,7 @@ static int pp_dpm_get_fan_speed_percent(void *handle, uint32_t *speed)
PP_CHECK_HW(hwmgr);
if (hwmgr->hwmgr_func->get_fan_speed_percent == NULL) {
- printk(KERN_INFO "%s was not implemented.\n", __func__);
+ cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
return 0;
}
@@ -620,7 +621,7 @@ static int pp_dpm_get_temperature(void *handle)
PP_CHECK_HW(hwmgr);
if (hwmgr->hwmgr_func->get_temperature == NULL) {
- printk(KERN_INFO "%s was not implemented.\n", __func__);
+ cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
return 0;
}
@@ -726,7 +727,7 @@ static int pp_dpm_force_clock_level(void *handle,
PP_CHECK_HW(hwmgr);
if (hwmgr->hwmgr_func->force_clock_level == NULL) {
- printk(KERN_INFO "%s was not implemented.\n", __func__);
+ cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
return 0;
}
@@ -746,7 +747,7 @@ static int pp_dpm_print_clock_levels(void *handle,
PP_CHECK_HW(hwmgr);
if (hwmgr->hwmgr_func->print_clock_levels == NULL) {
- printk(KERN_INFO "%s was not implemented.\n", __func__);
+ cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
return 0;
}
return hwmgr->hwmgr_func->print_clock_levels(hwmgr, type, buf);
@@ -764,7 +765,7 @@ static int pp_dpm_get_sclk_od(void *handle)
PP_CHECK_HW(hwmgr);
if (hwmgr->hwmgr_func->get_sclk_od == NULL) {
- printk(KERN_INFO "%s was not implemented.\n", __func__);
+ cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
return 0;
}
@@ -783,7 +784,7 @@ static int pp_dpm_set_sclk_od(void *handle, uint32_t value)
PP_CHECK_HW(hwmgr);
if (hwmgr->hwmgr_func->set_sclk_od == NULL) {
- printk(KERN_INFO "%s was not implemented.\n", __func__);
+ cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
return 0;
}
@@ -802,7 +803,7 @@ static int pp_dpm_get_mclk_od(void *handle)
PP_CHECK_HW(hwmgr);
if (hwmgr->hwmgr_func->get_mclk_od == NULL) {
- printk(KERN_INFO "%s was not implemented.\n", __func__);
+ cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
return 0;
}
@@ -821,7 +822,7 @@ static int pp_dpm_set_mclk_od(void *handle, uint32_t value)
PP_CHECK_HW(hwmgr);
if (hwmgr->hwmgr_func->set_mclk_od == NULL) {
- printk(KERN_INFO "%s was not implemented.\n", __func__);
+ cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
return 0;
}
@@ -840,7 +841,7 @@ static int pp_dpm_read_sensor(void *handle, int idx, int32_t *value)
PP_CHECK_HW(hwmgr);
if (hwmgr->hwmgr_func->read_sensor == NULL) {
- printk(KERN_INFO "%s was not implemented.\n", __func__);
+ cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
return 0;
}
diff --git a/drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c b/drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c
index d5ec8cc..a3cd230 100644
--- a/drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c
+++ b/drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c
@@ -151,7 +151,7 @@ static int thermal_interrupt_callback(void *private_data,
unsigned src_id, const uint32_t *iv_entry)
{
/* TO DO hanle PEM_Event_ThermalNotification (struct pp_eventmgr *)private_data*/
- printk("current thermal is out of range \n");
+ pr_info("current thermal is out of range \n");
return 0;
}
diff --git a/drivers/gpu/drm/amd/powerplay/inc/pp_debug.h b/drivers/gpu/drm/amd/powerplay/inc/pp_debug.h
index bfdbec1..7e1129f 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/pp_debug.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/pp_debug.h
@@ -28,18 +28,18 @@
#include <linux/kernel.h>
#include <linux/slab.h>
-#define PP_ASSERT_WITH_CODE(cond, msg, code) \
- do { \
- if (!(cond)) { \
- printk("%s\n", msg); \
- code; \
- } \
+#define PP_ASSERT_WITH_CODE(cond, msg, code) \
+ do { \
+ if (!(cond)) { \
+ pr_info("[powerplay] %s\n", msg); \
+ code; \
+ } \
} while (0)
#define PP_DBG_LOG(fmt, ...) \
do { \
- if(0)printk(KERN_INFO "[ pp_dbg ] " fmt, ##__VA_ARGS__); \
+ if(0)pr_info("[pp_dbg] " fmt, ##__VA_ARGS__); \
} while (0)
--
2.7.4
More information about the amd-gfx
mailing list