From 3e2f1329abfa729fe6786ff64d9545e6ce94f042 Mon Sep 17 00:00:00 2001 From: Todd Broch Date: Fri, 17 Oct 2014 19:25:14 -0700 Subject: pd: Correct use of console printing in USB PD policy files. All non-interactive console prints should use their tasks channel parameter to make it easy for developers to inhibit console output. This CL corrects printf's in the various usb_pd_policy files that belong to the USB PD task to use cprintf(CC_USBPD, ...) instead of the macro reserved for interactive console commands ccprintf. BRANCH=none BUG=none TEST=manual, set 'chan 1' and see none of the previous chatter relating to USB PD. set 'chan 0x08000000' and see it return. Output from DFP side for SVDM discovery now looks: SVDM/4 [1] ff008041 340018d1 00000000 11000008 [1119.966911 DONE] SVDM/2 [2] ff008042 ff010000 [1119.970135 DONE] SVDM/2 [3] ff018043 00100081 [1119.973437 DONE] SVDM/1 [4] ff018184 Change-Id: I47e5f4ec2d4a6a25f171177ead5ebc99409f80b6 Signed-off-by: Todd Broch Reviewed-on: https://chromium-review.googlesource.com/224191 Reviewed-by: Vincent Palatin --- board/hoho/usb_pd_policy.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'board/hoho') diff --git a/board/hoho/usb_pd_policy.c b/board/hoho/usb_pd_policy.c index b647219085..dd94ed1413 100644 --- a/board/hoho/usb_pd_policy.c +++ b/board/hoho/usb_pd_policy.c @@ -16,6 +16,7 @@ #include "usb_pd.h" #include "version.h" +#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) #define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) /* Source PDOs */ @@ -54,7 +55,7 @@ int pd_choose_voltage(int cnt, uint32_t *src_caps, uint32_t *rdo) /* request all the power ... */ ma = 10 * (src_caps[i] & 0x3FF); *rdo = RDO_FIXED(i + 1, ma, ma, 0); - ccprintf("Request [%d] %dV %dmA\n", i, set_mv/1000, ma); + CPRINTF("Request [%d] %dV %dmA\n", i, set_mv/1000, ma); return ma; } @@ -179,7 +180,7 @@ static int pd_custom_vdm(int port, int cnt, uint32_t *payload, { int cmd = PD_VDO_CMD(payload[0]); int rsize = 1; - ccprintf("%T] VDM/%d [%d] %08x\n", cnt, cmd, payload[0]); + CPRINTF("VDM/%d [%d] %08x\n", cnt, cmd, payload[0]); *rpayload = payload; switch (cmd) { @@ -191,7 +192,7 @@ static int pd_custom_vdm(int port, int cnt, uint32_t *payload, rsize = 0; } - ccprintf("%T] DONE\n"); + CPRINTS("DONE"); /* respond (positively) to the request */ payload[0] |= VDO_SRC_RESPONDER; -- cgit v1.2.1