Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp1054744lqt; Fri, 19 Apr 2024 21:52:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXigfD/vxAp9HgiR5JGudikIK4yOFc5A7A59QcCZQtRDlqXV+2p2YDMMVbUjBVvCVpj9U+Mtn0DPx0ncCUwIF590Kpay/Y9YQ5shp7SFg== X-Google-Smtp-Source: AGHT+IFby0V2oTFj39yi5gNwlkC0JitgudPB7cZZ5PsiQ8L1Aa9oNb+VJgBgKw8rVwa9jIRRsslX X-Received: by 2002:aa7:c642:0:b0:571:da40:22d9 with SMTP id z2-20020aa7c642000000b00571da4022d9mr2490717edr.10.1713588722879; Fri, 19 Apr 2024 21:52:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713588722; cv=pass; d=google.com; s=arc-20160816; b=xdTw0hp4QH1Xkky3XsIia7Ui//incDRaXnYNqrJMfL6VlMa3i0lG4dTyxdnTP0TUKl frQujZK2ipQSp+h95pe191JNb8aZ4boGAcGis33xSWTRP/0qeyY5Y5ZphOMzsQtwLHEN 0o6XFaM9EmEV5E2gEI7tR4TBBjeU1bhLiGmMQsBzGo4katyeMf1QEmIlEkBy6azTxzCj 8/qOguJ9iIueJR2/my9KyV+WgV8RUAXZzTvYCA6KJ1sLoAHHIImC7RL33zK5YGWoEy2T QomwW8WfQeDj3HakPzf00qymDzi7IHy05ocNVjyHpjlfQo+WmFWB8GGENS7+xlx6Jqx8 s3iQ== 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=ImTFYiHsN7s6kBeOTNwGoPcdLcvBs2r6TS0QtljbiaI=; fh=wJPXdoqtQ0YOXy74oWJK2I5h89QLW8nuE3Wv4zOOrJE=; b=NJ5tinNMczDU9A3TFEwL/bvlzxsDqEVZp4cSkO8W2UsTPzrEZerL+cBms/rWJqhWKz DGOG9Z974k5daqmCUJ9W3podP52JxZcMfkT4rRTlR2SLUjEAUr5r1KG30dYVDmDB8hzb 5SSuYrHBk5TbUvgDdpDP8eTsLQ91fp6WqQ/LIhZaeOhEVvD0CdJjk6NXjOR504cDeDta VaEWm429p89mvUHTAFRaXbg/6JukwKmO5R45qVCaf6y9Ci2Ywpd544Cl63Qe1vwlNV5N rR4cNkPm+W01jQrK4PPw4ISFj3Hd5nTS77PYQSA2Pu4sUb8d5S1RTTLT0UEnLNAo7Nsm 2u0A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=KfG2LE3d; 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-152136-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152136-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b11-20020aa7d48b000000b0056fdadb6fe9si2985630edr.214.2024.04.19.21.52.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 21:52:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-152136-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=KfG2LE3d; 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-152136-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152136-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 9B5981F20F63 for ; Sat, 20 Apr 2024 04:52:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 64A8B3717B; Sat, 20 Apr 2024 04:50:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="KfG2LE3d" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 10FE6374F7; Sat, 20 Apr 2024 04:50:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713588605; cv=none; b=a9inOn6ln8zlKPN78+w3sPx9oULAn73CL1hGd+TXP2cnk8tPk2D3L+E/dWcD6/2F+diqpA2iHpSY1MkM6dfEfMlxsWFaMwLzBcejepdFm0lJyP/ScKD47HZFOAfyk04fMBUqgfyjt2mFTrk6MfVJ8VI3kWmmB+o5T/aLTPtdtYQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713588605; c=relaxed/simple; bh=ApOTepT7BSabp/Ale4gSiVQ+yvGDARoW3mJ2ChHSjlw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tMzcuRY7uTJi3dERCl0/sj44bFwrvL/oITcGyXJ36R1RegNz/Ap44UKxGdtW94dt1lM8VpCYvNcoZDZ+JhkXynV0zh7MRyLR0bWnIocVVNHPUYx0sKbll9uZjijSHVtBrKVPWXvKXwuIIozYMGp9y8iDddZ0p8hPmt/3BFnLJY4= 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=KfG2LE3d; arc=none smtp.client-ip=205.220.168.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 (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43K4mYSO011727; Sat, 20 Apr 2024 04:49:57 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=ImTFYiHsN7s6kBeOTNwGoPcdLcvBs2r6TS0QtljbiaI=; b=Kf G2LE3db64Gbl1cuvvbrJgLJU+AnY5MZFFYDl1xRwPdaxk5r8DxULKDLZK4zq1VkS 0NrMFW5Ml0sc0+hPQnGuN/LkIxmaWk4CphTE3+W7Smy3gNqaxYYxR1T8EroMA4Kk YbAlkGnvPRlb/mjzeWiWq6JstvhHf3fGDJW+xtsYKpX1xPYq+QfU08rJw6HCVLd8 NOQx1uK/KuHKcwoIxYcWUIWWKDl6fWQ5aaDXMBb0iZoe1WClzDUCguwNLREfO4cr cNH+ToaFlMu15wuR1GbwNeCGzyHtAP1OzhQ8//DFNz9Q4IBRoEDiq8m9d2SdjoCr jDMB3/4fS7PPNobgqQyw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xm70cg025-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 20 Apr 2024 04:49:57 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 43K4nu4K020567 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 20 Apr 2024 04:49:56 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.1544.9; Fri, 19 Apr 2024 21:49:51 -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 , Bjorn Andersson Subject: [PATCH v21 6/9] usb: dwc3: qcom: Add helper function to request wakeup interrupts Date: Sat, 20 Apr 2024 10:18:58 +0530 Message-ID: <20240420044901.884098-7-quic_kriskura@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240420044901.884098-1-quic_kriskura@quicinc.com> References: <20240420044901.884098-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: nasanex01b.na.qualcomm.com (10.46.141.250) 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: ms6EmuEGnXdNoy-YIp3P8GndYIDk07vt X-Proofpoint-ORIG-GUID: ms6EmuEGnXdNoy-YIp3P8GndYIDk07vt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-20_03,2024-04-19_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 adultscore=0 phishscore=0 clxscore=1015 suspectscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=949 spamscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404200033 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 Device tree. Signed-off-by: Krishna Kurapati Reviewed-by: Bjorn Andersson --- 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