Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3261052lqp; Tue, 26 Mar 2024 04:35:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUAYBfIHGR/LZW0if6Tsen34LPnxitJ3Fth6HVyxcUTdOQSZQ28NjLVoSfPKQjEiglyB5suWNIIXGH41sj269y3lFVXNbOXxbTOohEhcw== X-Google-Smtp-Source: AGHT+IGNIRyo1l76mzAMaXLMR3wNGrPPt8vcjJGA/CY7f6C5qGkeBne34lDDcdF397SCe596nLvr X-Received: by 2002:a05:6808:60c:b0:3c3:adc6:8935 with SMTP id y12-20020a056808060c00b003c3adc68935mr9954253oih.14.1711452948605; Tue, 26 Mar 2024 04:35:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711452948; cv=pass; d=google.com; s=arc-20160816; b=1CUolGUjHC6WbXbWbumGiLpAT9CeBugq9fjfzMjypB6oJM3dBxrCTveP+34ZS2vlkk dFLAqp3Dha/Bf/2z7cQ9CfW6T8iUsqhJwqJeW4izSA+kGoLnUabbkEe/7YIcOK4nXpDB I2QwB58P8hQU0tSFDHcKRun0qJo5RU6hQxU8Tqi1WZmBRVQw1mP/kTor4smS7wH3ZBcN yerCytKYDSe2Cj7zsei6KrMNXCz/beZ6Z8SDQgwHAyHQXLyaKp2A0s3XiIAB+U7kDxlU eIrOIiP76970hpUqSpvQJRwdO8+qiEfg7HCNjfJ5+zeqjuNPLR33cRk7A3vMIlpSgWmr 6LUg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=loF04AMCW/vlX+IACFVbp2fBcecuggobccGXCFGEFLs=; fh=rCVsw0ADKhTADdWslfxGcKb2/OuP7S3j40Ot+ZbMR4o=; b=KjJxpgJoWT71ebhw8q/HyL3nMUuLd7gK/PrmFCUbNbp05w+UtG3sG9zTu0Z+EF4tgF z2CCNJcTGlykHAR+G8EQApwQ92oNWWHaf6vBw54buNX0kyyXwWBqJoXDRE12ZeXsogSW Ikpkol61oOSiN20Kos1S6MWuXA3VINGE4AUk5lkew3/SM7wiGfDe2s/NPE/QQlAa3b/0 cE+easWEEqkO8VJIn06r+wbErJOhUyzYt69m4BJCLz1tz/prWSzX1Czkqu/hTqXz2BFR Eq3xcVZ0fK2X2wJ89fI9OhxA0wWhESS1B7Ld8gjDIL5g3G8toqIVdRgiljYR9EcXrOqA FTHA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=a5Qn9b1G; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-118896-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118896-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id l13-20020a05622a050d00b0042eb8d52057si6970790qtx.320.2024.03.26.04.35.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 04:35:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118896-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=a5Qn9b1G; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-118896-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118896-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 408B41C364B7 for ; Tue, 26 Mar 2024 11:35:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EFC075A0F0; Tue, 26 Mar 2024 11:33:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="a5Qn9b1G" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5EDF474C0D; Tue, 26 Mar 2024 11:33:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711452837; cv=none; b=s/vU5AdB9FnYB7fxmAD75GGI2eXCXrX9OBr8E6UW+bWgmScG770NRPEFIcKOr7bv4CGELu3YGy9iXUPVnmG531rYAaUe3px7/67P7WceKCenIg/Fl6j9/ssxnparzSa6zDXCQtGT+6Z/UWUpCgp95I60TjxsIsfdpRG3agdYhfs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711452837; c=relaxed/simple; bh=4V0eFBIjR9DPCwjlVi3fSA4aijVRdO22PtIf8wXBeyo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Be6YCaRIv4uBLMM7TVALBH7RJj1729MKqXEO8J64acAI2DexQ1foOf6mhI0ky0l5MBYDerV8zAgAeN1+pQWdkDT0l65GsayyPQVbSrQazVO3n1UjLb6Zmk3YrxOoBOtWwmjF2ERuVBAwQDhTnIC5f+gEYQHPHQ2OTbZLkqNfqhU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=a5Qn9b1G; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42Q4M2ru027206; Tue, 26 Mar 2024 11:33:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=loF04AMCW/vlX+IACFVbp2fBcecuggobccGXCFGEFLs=; b=a5 Qn9b1GmFGedgQFbppVjCF1g+lyJVkB7p5ZkXpUek359YQOEbCvGjyiE+XmTHU00e xDkNSaqGW6lbKfZjSD0JJVu4v9qbHBnUEMG2LI1V7SBwC+NFnMSwosPHKxYKEFQ0 yl8HePRscqbd6WDgeaMFiTizt+mzpEGfeQctRIHubjr2FNLuJYCEMUmp2+3Ed+pe wMbwSqGNQve1Z4SwunzzTy8mNHcGFPepNfEMoGnPFeKbc++oa8YRqgp+OCtNcpjD NoMgOzfqQzljp44Wc/QUCJaYqXt4ST2QfIQhfj0QD1WG7daXvIxMNMb7sXbCU3Rb wQUhBL4hTiHACaNKpb5Q== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3x3n0nse88-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 Mar 2024 11:33:49 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42QBXmPs029138 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 Mar 2024 11:33:48 GMT Received: from hu-kriskura-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 26 Mar 2024 04:33:42 -0700 From: Krishna Kurapati To: Krzysztof Kozlowski , Rob Herring , Bjorn Andersson , Wesley Cheng , Konrad Dybcio , "Greg Kroah-Hartman" , Conor Dooley , Thinh Nguyen , Felipe Balbi , Johan Hovold CC: , , , , , , Krishna Kurapati , Johan Hovold Subject: [PATCH v18 6/9] usb: dwc3: qcom: Add helper function to request wakeup interrupts Date: Tue, 26 Mar 2024 17:02:50 +0530 Message-ID: <20240326113253.3010447-7-quic_kriskura@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240326113253.3010447-1-quic_kriskura@quicinc.com> References: <20240326113253.3010447-1-quic_kriskura@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 3yDUmIl7DglIYSKdYrNUQHONmTIg5O5p X-Proofpoint-ORIG-GUID: 3yDUmIl7DglIYSKdYrNUQHONmTIg5O5p X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-26_05,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 mlxlogscore=902 adultscore=0 clxscore=1015 spamscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 suspectscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2403260079 The logic for requesting interrupts is duplicated for each interrupt. In the upcoming patches that introduces support for multiport, it would be better to clean up the duplication before reading mulitport related interrupts. Refactor interrupt setup call by adding a new helper function for requesting the wakeup interrupts. To simplify implementation, make the display name same as the interrupt name expected in DT. Signed-off-by: Krishna Kurapati Reviewed-by: Johan Hovold --- drivers/usb/dwc3/dwc3-qcom.c | 53 ++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index f6b2fab49d5e..cae5dab8fcfc 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -501,6 +501,22 @@ static void dwc3_qcom_select_utmi_clk(struct dwc3_qcom *qcom) PIPE_UTMI_CLK_DIS); } +static int dwc3_qcom_request_irq(struct dwc3_qcom *qcom, int irq, + const char *name) +{ + int ret; + + /* Keep wakeup interrupts disabled until suspend */ + ret = devm_request_threaded_irq(qcom->dev, irq, NULL, + qcom_dwc3_resume_irq, + IRQF_ONESHOT | IRQF_NO_AUTOEN, + name, qcom); + if (ret) + dev_err(qcom->dev, "failed to request irq %s: %d\n", name, ret); + + return ret; +} + static int dwc3_qcom_setup_irq(struct platform_device *pdev) { struct dwc3_qcom *qcom = platform_get_drvdata(pdev); @@ -509,54 +525,33 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev) irq = platform_get_irq_byname_optional(pdev, "qusb2_phy"); if (irq > 0) { - /* Keep wakeup interrupts disabled until suspend */ - ret = devm_request_threaded_irq(qcom->dev, irq, NULL, - qcom_dwc3_resume_irq, - IRQF_ONESHOT | IRQF_NO_AUTOEN, - "qcom_dwc3 QUSB2", qcom); - if (ret) { - dev_err(qcom->dev, "qusb2_phy_irq failed: %d\n", ret); + ret = dwc3_qcom_request_irq(qcom, irq, "qusb2_phy"); + if (ret) return ret; - } qcom->qusb2_phy_irq = irq; } irq = platform_get_irq_byname_optional(pdev, "dp_hs_phy_irq"); if (irq > 0) { - ret = devm_request_threaded_irq(qcom->dev, irq, NULL, - qcom_dwc3_resume_irq, - IRQF_ONESHOT | IRQF_NO_AUTOEN, - "qcom_dwc3 DP_HS", qcom); - if (ret) { - dev_err(qcom->dev, "dp_hs_phy_irq failed: %d\n", ret); + ret = dwc3_qcom_request_irq(qcom, irq, "dp_hs_phy_irq"); + if (ret) return ret; - } qcom->dp_hs_phy_irq = irq; } irq = platform_get_irq_byname_optional(pdev, "dm_hs_phy_irq"); if (irq > 0) { - ret = devm_request_threaded_irq(qcom->dev, irq, NULL, - qcom_dwc3_resume_irq, - IRQF_ONESHOT | IRQF_NO_AUTOEN, - "qcom_dwc3 DM_HS", qcom); - if (ret) { - dev_err(qcom->dev, "dm_hs_phy_irq failed: %d\n", ret); + ret = dwc3_qcom_request_irq(qcom, irq, "dm_hs_phy_irq"); + if (ret) return ret; - } qcom->dm_hs_phy_irq = irq; } irq = platform_get_irq_byname_optional(pdev, "ss_phy_irq"); if (irq > 0) { - ret = devm_request_threaded_irq(qcom->dev, irq, NULL, - qcom_dwc3_resume_irq, - IRQF_ONESHOT | IRQF_NO_AUTOEN, - "qcom_dwc3 SS", qcom); - if (ret) { - dev_err(qcom->dev, "ss_phy_irq failed: %d\n", ret); + ret = dwc3_qcom_request_irq(qcom, irq, "ss_phy_irq"); + if (ret) return ret; - } qcom->ss_phy_irq = irq; } -- 2.34.1