Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3206521pxb; Mon, 1 Nov 2021 09:43:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/XPqT5cBOkhVUQVdFAuOheHvM9VhcAiIGCw5QZR2MTV3NchVHeJ/MseGb0sSPmuf6oGkJ X-Received: by 2002:a17:906:6089:: with SMTP id t9mr38957954ejj.323.1635785003591; Mon, 01 Nov 2021 09:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635785003; cv=none; d=google.com; s=arc-20160816; b=f4fyWSAaBKp6e3M2SA7dkWUjVmHijK6ISSClZzbppkaG3rJiC2R19w7ThVDvYwy+fB GglnDiUn7CU+aIUbzRzOBXReBIUlaoDqs+eWzl7VKbnDute9bCh42KRF4yQSMo4brupw 9dXNuIa+oCsDiUSqgAq2YyagZzyxy7qg+ZG9pL9L/LFgg3ykGk2IGl6uugrE2LYcMgEC 9w9Gq37yN0NlGAZDGbEEvZOPLzmaM9BMufax5jnG+eFTECpwmZQ4G5jc7f1tNWiDXQNC WPMCTWGY6emnhHa3McVFxI72cMTAdnHEicth2vBwzNcO5i3Di1knIO+sbuqi84P7v+Gz 5ifw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vx/j/qFiyXYawaEzOVh4pi7vxeVBLCfoDpKoWb5FGGM=; b=jlZx0zgSg3BBsFsbHANaCMrXjvqBnYJM/gS66wSY90bQm8wAxwWlBHnl4vDPXTy+Ky p67BjHwN3eNn26YqUp7L8YnsP2LPskQiYvH6a464Ay8pHNjDLdwX+aT0iPulRZCQKF0F YxOZ/trleOUcRSAh5J4gnI6dRY53MS7jql7X4Wrtmu5geSOtwVpw7+qGa9w+19/9fA7y eOL94Y+n2jhUNZ3xRwmzJmshWcQ2HPphwVgLKgoz92Y98Q2yoKMjNbCPpL/jpGWqutxT gkua9g/b5+Yw9j2gn5dylwAzpNP+4qu36rOSa7wQxv07/qs65MsXpxiBwtQAXKFXIrjH 5Iuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C4r7fAKQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hj1si17024223ejc.555.2021.11.01.09.42.48; Mon, 01 Nov 2021 09:43:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C4r7fAKQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232850AbhKAQnc (ORCPT + 99 others); Mon, 1 Nov 2021 12:43:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233182AbhKAQnV (ORCPT ); Mon, 1 Nov 2021 12:43:21 -0400 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51992C0432EA for ; Mon, 1 Nov 2021 09:37:35 -0700 (PDT) Received: by mail-ot1-x32c.google.com with SMTP id 71-20020a9d034d000000b00553e24ce2b8so21410333otv.7 for ; Mon, 01 Nov 2021 09:37:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=vx/j/qFiyXYawaEzOVh4pi7vxeVBLCfoDpKoWb5FGGM=; b=C4r7fAKQa99niM5nBnPYlOeooBaJEHwpy5oTOiYI2nmSDAzhU5smPYAp/aw2CCFCFF b/Ko9Gq8gfdYUAB7QJiVCHrqa8dady++MKqu5DEWAa7a0OZagGA2mg1OOaKbRxU/TcjN h+e3m1T4LV1Mah1mKHeeMAx8p8t9NZBI/xRI6PHmr7mWFTAEN/ZTv5qjZlDBDps6jqjR jBKFyDu6H4kNsMVYaeLSJY/h3+4W1x03Uw/3eYdVZ3LyzTqdN7cadMLhtpab7bzZIeVX hK7f0MEt8USbQDAU369cycSRYsZ7ymaVwv91N4rPGIkTyDpwRB7zZ0+kWIlcuDp6r3yY 3KIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=vx/j/qFiyXYawaEzOVh4pi7vxeVBLCfoDpKoWb5FGGM=; b=QPLdk96Xg5KbB/vENG5OQWvMI992B6HSciCaREPXHi0zPu6CopZauLoTQiYCxoJ77w QGMjvrjfUW5M+CNalyisnEpdSkWXElit8oVb4FVlj45y5JFpL3NDSKOz2QZ4nBLhB6jc nZp4mnwFlEG9miTi2zWRWVx7zCXJSl4fswcJOZZ1axbweUvjM5hDWUknGXtmD6qE3SB/ XeRoxcz0GJQyA4fac23wyftlYlKOmXS0yyyIxcVQHwkZJWDOYShj/62OFFDh3/5lYixz y5Rm6OKVKwTTcayJ6JGyalNIOyxOtqPjPADv3fuS0I6KpDoJWkCE41q6i+62SIJ0kzj7 fiiw== X-Gm-Message-State: AOAM5321spTiyRlLT9IqQs3kKsWmp9wnRainq2OeKQDKlEYymb3446WZ rfldQ0fXi2F94QM8MqcqM64yJw== X-Received: by 2002:a9d:6d12:: with SMTP id o18mr15617446otp.71.1635784654611; Mon, 01 Nov 2021 09:37:34 -0700 (PDT) Received: from ripper (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id q5sm4219363otc.79.2021.11.01.09.37.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 09:37:34 -0700 (PDT) Date: Mon, 1 Nov 2021 09:39:17 -0700 From: Bjorn Andersson To: Sandeep Maheswaram Cc: Andy Gross , Greg Kroah-Hartman , Felipe Balbi , Stephen Boyd , Doug Anderson , Matthias Kaehlcke , Mathias Nyman , linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, quic_pkondeti@quicinc.com, quic_ppratap@quicinc.com Subject: Re: [PATCH v9 3/5] usb: dwc3: qcom: Add helper functions to enable,disable wake irqs Message-ID: References: <1635753224-23975-1-git-send-email-quic_c_sanm@quicinc.com> <1635753224-23975-4-git-send-email-quic_c_sanm@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1635753224-23975-4-git-send-email-quic_c_sanm@quicinc.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 01 Nov 00:53 PDT 2021, Sandeep Maheswaram wrote: > Adding helper functions to enable,disable wake irqs to make > the code simple and readable. > > Signed-off-by: Sandeep Maheswaram > Reviewed-by: Matthias Kaehlcke > --- > drivers/usb/dwc3/dwc3-qcom.c | 58 ++++++++++++++++++++------------------------ > 1 file changed, 26 insertions(+), 32 deletions(-) > > diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c > index 9abbd01..54461f1 100644 > --- a/drivers/usb/dwc3/dwc3-qcom.c > +++ b/drivers/usb/dwc3/dwc3-qcom.c > @@ -296,50 +296,44 @@ static void dwc3_qcom_interconnect_exit(struct dwc3_qcom *qcom) > icc_put(qcom->icc_path_apps); > } > > +static void dwc3_qcom_enable_wakeup_irq(int irq) > +{ > + if (!irq) > + return; > + > + enable_irq(irq); > + enable_irq_wake(irq); > +} > + > +static void dwc3_qcom_disable_wakeup_irq(int irq) > +{ > + if (!irq) > + return; > + > + disable_irq_wake(irq); Now that you touch this code path. I presume keeping these interrupts enabled during runtime would cause the interrupt to fire during normal operation, but why do we need to toggle the irq_wake? Can't we just leave that flag set always? > + disable_irq_nosync(irq); > +} > + > static void dwc3_qcom_disable_interrupts(struct dwc3_qcom *qcom) > { > - if (qcom->hs_phy_irq) { > - disable_irq_wake(qcom->hs_phy_irq); > - disable_irq_nosync(qcom->hs_phy_irq); > - } > + dwc3_qcom_disable_wakeup_irq(qcom->hs_phy_irq); Why don't we just replace *_phy_irq with an array and turn these two function into two loops? That seems to be quite suitable for the multi-port dwc found in e.g. sc8180x as well... Regards, Bjorn > > - if (qcom->dp_hs_phy_irq) { > - disable_irq_wake(qcom->dp_hs_phy_irq); > - disable_irq_nosync(qcom->dp_hs_phy_irq); > - } > + dwc3_qcom_disable_wakeup_irq(qcom->dp_hs_phy_irq); > > - if (qcom->dm_hs_phy_irq) { > - disable_irq_wake(qcom->dm_hs_phy_irq); > - disable_irq_nosync(qcom->dm_hs_phy_irq); > - } > + dwc3_qcom_disable_wakeup_irq(qcom->dm_hs_phy_irq); > > - if (qcom->ss_phy_irq) { > - disable_irq_wake(qcom->ss_phy_irq); > - disable_irq_nosync(qcom->ss_phy_irq); > - } > + dwc3_qcom_disable_wakeup_irq(qcom->ss_phy_irq); > } > > static void dwc3_qcom_enable_interrupts(struct dwc3_qcom *qcom) > { > - if (qcom->hs_phy_irq) { > - enable_irq(qcom->hs_phy_irq); > - enable_irq_wake(qcom->hs_phy_irq); > - } > + dwc3_qcom_enable_wakeup_irq(qcom->hs_phy_irq); > > - if (qcom->dp_hs_phy_irq) { > - enable_irq(qcom->dp_hs_phy_irq); > - enable_irq_wake(qcom->dp_hs_phy_irq); > - } > + dwc3_qcom_enable_wakeup_irq(qcom->dp_hs_phy_irq); > > - if (qcom->dm_hs_phy_irq) { > - enable_irq(qcom->dm_hs_phy_irq); > - enable_irq_wake(qcom->dm_hs_phy_irq); > - } > + dwc3_qcom_enable_wakeup_irq(qcom->dm_hs_phy_irq); > > - if (qcom->ss_phy_irq) { > - enable_irq(qcom->ss_phy_irq); > - enable_irq_wake(qcom->ss_phy_irq); > - } > + dwc3_qcom_enable_wakeup_irq(qcom->ss_phy_irq); > } > > static int dwc3_qcom_suspend(struct dwc3_qcom *qcom) > -- > 2.7.4 >