From patchwork Wed Mar 30 09:56:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 64656 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2494020lbc; Wed, 30 Mar 2016 02:57:07 -0700 (PDT) X-Received: by 10.66.159.232 with SMTP id xf8mr11563136pab.71.1459331825918; Wed, 30 Mar 2016 02:57:05 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 24si5369097pfn.204.2016.03.30.02.57.05; Wed, 30 Mar 2016 02:57:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752976AbcC3J4z (ORCPT + 29 others); Wed, 30 Mar 2016 05:56:55 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:48948 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752818AbcC3J4u (ORCPT ); Wed, 30 Mar 2016 05:56:50 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id u2U9uiN4015123; Wed, 30 Mar 2016 04:56:44 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id u2U9uiSS028102; Wed, 30 Mar 2016 04:56:44 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.224.2; Wed, 30 Mar 2016 04:56:44 -0500 Received: from lta0400828d.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id u2U9ua4w015698; Wed, 30 Mar 2016 04:56:42 -0500 From: Roger Quadros To: , CC: , , , Roger Quadros Subject: [PATCH v6 3/3] usb: otg-fsm: Prevent build warning "VDBG" redefined Date: Wed, 30 Mar 2016 12:56:30 +0300 Message-ID: <1459331790-29651-4-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1459331790-29651-1-git-send-email-rogerq@ti.com> References: <1459331790-29651-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If usb/otg-fsm.h and usb/composite.h are included together then it results in the build warning [1]. Prevent that by using dev_vdbg() instead. Also get rid of MPC_LOC which doesn't seem to be used by anyone. [1] - warning fixed by this patch: In file included from drivers/usb/dwc3/core.h:33, from drivers/usb/dwc3/ep0.c:33: include/linux/usb/otg-fsm.h:30:1: warning: "VDBG" redefined In file included from drivers/usb/dwc3/ep0.c:31: include/linux/usb/composite.h:615:1: warning: this is the location of the previous definition Signed-off-by: Roger Quadros Acked-by: Peter Chen --- drivers/usb/chipidea/otg_fsm.c | 1 + drivers/usb/common/usb-otg-fsm.c | 12 +++++++----- drivers/usb/phy/phy-fsl-usb.c | 1 + include/linux/usb/otg-fsm.h | 19 ++++--------------- 4 files changed, 13 insertions(+), 20 deletions(-) -- 2.5.0 diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index de8e22e..5f169b3 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -805,6 +805,7 @@ int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci) ci->fsm.id = hw_read_otgsc(ci, OTGSC_ID) ? 1 : 0; ci->fsm.otg->state = OTG_STATE_UNDEFINED; ci->fsm.ops = &ci_otg_ops; + ci->fsm.dev = ci->dev; ci->gadget.hnp_polling_support = 1; ci->fsm.host_req_flag = devm_kzalloc(ci->dev, 1, GFP_KERNEL); if (!ci->fsm.host_req_flag) diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c index 9059b7d..c5a61fe 100644 --- a/drivers/usb/common/usb-otg-fsm.c +++ b/drivers/usb/common/usb-otg-fsm.c @@ -36,8 +36,9 @@ static int otg_set_protocol(struct otg_fsm *fsm, int protocol) int ret = 0; if (fsm->protocol != protocol) { - VDBG("Changing role fsm->protocol= %d; new protocol= %d\n", - fsm->protocol, protocol); + dev_vdbg(fsm->dev, + "Changing role fsm->protocol= %d; new protocol= %d\n", + fsm->protocol, protocol); /* stop old protocol */ if (fsm->protocol == PROTO_HOST) ret = otg_start_host(fsm, 0); @@ -208,7 +209,7 @@ static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) { if (fsm->otg->state == new_state) return 0; - VDBG("Set state: %s\n", usb_otg_state_string(new_state)); + dev_vdbg(fsm->dev, "Set state: %s\n", usb_otg_state_string(new_state)); otg_leave_state(fsm, fsm->otg->state); switch (new_state) { case OTG_STATE_B_IDLE: @@ -338,7 +339,7 @@ int otg_statemachine(struct otg_fsm *fsm) switch (state) { case OTG_STATE_UNDEFINED: - VDBG("fsm->id = %d\n", fsm->id); + dev_vdbg(fsm->dev, "fsm->id = %d\n", fsm->id); if (fsm->id) otg_set_state(fsm, OTG_STATE_B_IDLE); else @@ -446,7 +447,8 @@ int otg_statemachine(struct otg_fsm *fsm) } mutex_unlock(&fsm->lock); - VDBG("quit statemachine, changed = %d\n", fsm->state_changed); + dev_vdbg(fsm->dev, "quit statemachine, changed = %d\n", + fsm->state_changed); return fsm->state_changed; } EXPORT_SYMBOL_GPL(otg_statemachine); diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index 94eb292..ee3f2c2 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c @@ -817,6 +817,7 @@ static int fsl_otg_conf(struct platform_device *pdev) /* Set OTG state machine operations */ fsl_otg_tc->fsm.ops = &fsl_otg_ops; + fsl_otg_tc->fsm.dev = &pdev->dev; /* initialize the otg structure */ fsl_otg_tc->phy.label = DRIVER_DESC; diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h index 7a03505..47b8392 100644 --- a/include/linux/usb/otg-fsm.h +++ b/include/linux/usb/otg-fsm.h @@ -18,24 +18,10 @@ #ifndef __LINUX_USB_OTG_FSM_H #define __LINUX_USB_OTG_FSM_H +#include #include #include -#undef VERBOSE - -#ifdef VERBOSE -#define VDBG(fmt, args...) pr_debug("[%s] " fmt , \ - __func__, ## args) -#else -#define VDBG(stuff...) do {} while (0) -#endif - -#ifdef VERBOSE -#define MPC_LOC printk("Current Location [%s]:[%d]\n", __FILE__, __LINE__) -#else -#define MPC_LOC do {} while (0) -#endif - #define PROTO_UNDEF (0) #define PROTO_HOST (1) #define PROTO_GADGET (2) @@ -211,6 +197,9 @@ struct otg_fsm { u8 *host_req_flag; struct delayed_work hnp_polling_work; bool state_changed; + + /* for debug prints */ + struct device *dev; }; struct otg_fsm_ops {