AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Huang Rui <ray.huang-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	"Alex Deucher" <alexander.deucher-5C7GfCeVMHo@public.gmane.org>,
	"Christian König" <christian.koenig-5C7GfCeVMHo@public.gmane.org>
Cc: Arindam Nath <Arindam.Nath-5C7GfCeVMHo@public.gmane.org>,
	Huang Rui <ray.huang-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 3/4] drm/amd/powerplay: update printk to cgs debug prints for common part
Date: Thu, 8 Dec 2016 13:23:10 +0800	[thread overview]
Message-ID: <1481174591-2187-4-git-send-email-ray.huang@amd.com> (raw)
In-Reply-To: <1481174591-2187-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>

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@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

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2016-12-08  5:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-08  5:23 [PATCH 0/4] drm/amd/powerplay: introduce the cgs print helpers Huang Rui
     [not found] ` <1481174591-2187-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
2016-12-08  5:23   ` [PATCH 1/4] drm/amdgpu: " Huang Rui
2016-12-08  5:23   ` [PATCH 2/4] drm/amd/powerplay: update printk to cgs debug prints for smumgr Huang Rui
2016-12-08  5:23   ` Huang Rui [this message]
2016-12-08  5:23   ` [PATCH 4/4] drm/amd/powerplay: update printk to cgs debug prints for hwmgr Huang Rui
2016-12-08  8:41   ` [PATCH 0/4] drm/amd/powerplay: introduce the cgs print helpers Christian König
     [not found]     ` <9672b4c9-a905-8fef-9fa4-cd0cbe94a67b-5C7GfCeVMHo@public.gmane.org>
2016-12-08  9:02       ` Huang Rui
2016-12-08  9:27         ` Christian König
     [not found]           ` <752e5cbf-0bcb-d42f-8542-6f7a788d9299-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-12-08  9:50             ` Huang Rui
2016-12-08 13:04               ` Grazvydas Ignotas
     [not found]                 ` <CANOLnOOqGWKw5XdR-d=3GRrqWQ45KT_NJymWQW39kb0RtfK5Qw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-12-09  2:29                   ` Huang Rui
2016-12-22 10:52                   ` Huang Rui
2016-12-23  2:38                     ` Huang Rui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1481174591-2187-4-git-send-email-ray.huang@amd.com \
    --to=ray.huang-5c7gfcevmho@public.gmane.org \
    --cc=Arindam.Nath-5C7GfCeVMHo@public.gmane.org \
    --cc=alexander.deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox