From patchwork Thu Mar 21 02:53:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bmZlbmcgWXVuICjkupHmmKXls7Ap?= X-Patchwork-Id: 10862871 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ADB6117E0 for ; Thu, 21 Mar 2019 02:55:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93B7A29DDB for ; Thu, 21 Mar 2019 02:55:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87BBD29EFE; Thu, 21 Mar 2019 02:55:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37F9729DDB for ; Thu, 21 Mar 2019 02:55:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727965AbfCUCyv (ORCPT ); Wed, 20 Mar 2019 22:54:51 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:38413 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727919AbfCUCyu (ORCPT ); Wed, 20 Mar 2019 22:54:50 -0400 X-UUID: 85df57b87a68459992bd1c09afca4c2d-20190321 X-UUID: 85df57b87a68459992bd1c09afca4c2d-20190321 Received: from mtkcas32.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 803504971; Thu, 21 Mar 2019 10:54:42 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 21 Mar 2019 10:54:40 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 21 Mar 2019 10:54:40 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman , Felipe Balbi , Matthias Brugger CC: Chunfeng Yun , , , , , Subject: [RESEND PATCH 11/11] usb: mtu3: add a function to switch mailbox state to string Date: Thu, 21 Mar 2019 10:53:49 +0800 Message-ID: <1553136829-14712-12-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1553136829-14712-1-git-send-email-chunfeng.yun@mediatek.com> References: <1553136829-14712-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-MTK: N Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP By introducing mailbox_state_string(), allow to make debug log more readable Signed-off-by: Chunfeng Yun --- drivers/usb/mtu3/mtu3_dr.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/usb/mtu3/mtu3_dr.c b/drivers/usb/mtu3/mtu3_dr.c index 82913120622b..5fcb71af875a 100644 --- a/drivers/usb/mtu3/mtu3_dr.c +++ b/drivers/usb/mtu3/mtu3_dr.c @@ -21,6 +21,22 @@ enum mtu3_vbus_id_state { MTU3_VBUS_VALID, }; +static char *mailbox_state_string(enum mtu3_vbus_id_state state) +{ + switch (state) { + case MTU3_ID_FLOAT: + return "ID_FLOAT"; + case MTU3_ID_GROUND: + return "ID_GROUND"; + case MTU3_VBUS_OFF: + return "VBUS_OFF"; + case MTU3_VBUS_VALID: + return "VBUS_VALID"; + default: + return "UNKNOWN"; + } +} + static void toggle_opstate(struct ssusb_mtk *ssusb) { if (!ssusb->otg_switch.is_u3_drd) { @@ -140,8 +156,8 @@ static void ssusb_set_mailbox(struct otg_switch_mtk *otg_sx, container_of(otg_sx, struct ssusb_mtk, otg_switch); struct mtu3 *mtu = ssusb->u3d; - dev_dbg(ssusb->dev, "mailbox state(%d)\n", status); - mtu3_dbg_trace(ssusb->dev, "mailbox %d", status); + dev_dbg(ssusb->dev, "mailbox %s\n", mailbox_state_string(status)); + mtu3_dbg_trace(ssusb->dev, "mailbox %s", mailbox_state_string(status)); switch (status) { case MTU3_ID_GROUND: