Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2767001lqp; Mon, 25 Mar 2024 08:40:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVbK4lMvY2mG4z7hJTrSfUY9ECDvvpa2542LJaeDO2HSfgd27GK4fmPqQ2lMUA2lntqVqJWgy+BAJ1pSXbsdMU+4a8fX0BI7VxvHYWKVA== X-Google-Smtp-Source: AGHT+IGuihXA/qX1fBCDnOvjisw71fuOlmxPVyw6N93J8CMz/+dgN3fD2RXsrc62nrcGwQ9buRhn X-Received: by 2002:a17:907:1184:b0:a49:fa33:a413 with SMTP id uz4-20020a170907118400b00a49fa33a413mr2645586ejb.69.1711381212043; Mon, 25 Mar 2024 08:40:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711381212; cv=pass; d=google.com; s=arc-20160816; b=03Y9EUvyCBldPPG4WmIS0M6kO46O2g0ZzVlV5JlDap9n0EwLEIi10Gl+Ou5uZN+/vf VIrnCAVZtQxijNNDgtXurZIXbl3YwoL1RGjh9or9UMP8vUi6b6tCHF8a/ADTuvc15SNj zCl/1mJQuMyvGSi0pC2e557L6VN0b42/x9h/C/4nCdJK650a+P52XxK+dgznr01ti6ax /1pKJLO2EkQsP56mZhukuXP27bLlywGQ7Zh2gsgoQP9I/WCrjfXs2GQ1++R/x3EVcSkI 18heahmGRvH9em4sJ0FNp45VQ+opaeBVEbGAAyRb7f/3iEhXaoSovrUg6c5nz6UQ3xsR f3Wg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=6azWjmnjffihgzpQWtVpTkFxRLmZYV1rLUGMd3pxWlY=; fh=OO3ojXsgqHBqh7dZ3ao8kfY4uHTWZiStoiNAipDrzXA=; b=aMVntwsf7doPhUYiHs6sOrLdkQ2HfrPspR2UivsAQNnIU1H5GwXgwL+0OMRZ0DVqgb N17avXBqnKIumORQmSrgPL8czlkXA651IlbxPBN9btymLeYh/4w6HYyWV7DJIYtPmFh1 8e7/4vhmLzZKg6SfvNAnYkJPc6pUhiOYncMxSlby2IpcwRL8ztFpErHXK5Ea5CJ00YAV qBLSkFOVqNc+nJ1ZtZOPLBBHugsOv+TjhpB286ksBzSrGgxPfQSgZCpN5+KTUI30YmNr pqLoCO7adf2LrjPGlkEwxM3dBDZS9ecxffe45rJbL9Viv8i2mW2MwqQW1Xq4sn8Jsl81 VTrw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ClTeA5Pl; 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-117098-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117098-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 22-20020a170906301600b00a47377bdec3si2552999ejz.150.2024.03.25.08.40.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 08:40:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117098-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=ClTeA5Pl; 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-117098-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117098-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 9779C1F62B1E for ; Mon, 25 Mar 2024 15:40:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B3A3B13D51D; Mon, 25 Mar 2024 13:15:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="ClTeA5Pl" 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 4FC2A450EE; Mon, 25 Mar 2024 13:15:33 +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=1711372534; cv=none; b=BrYZ1L91yTv8GcfNUz09dHRnCZtDRjAOiURgkxvMSq5UqU6ED0Cexy07gVd050nDp8y3/o8iE9PPbRgGnjoM3z6Vi0Vk/qvGKpFpc33FWamHUE9gsdNgr7CPxOp3pv1cswGHJrON5PvZssZR264Lg/orF3m8F2k9E+6bl/kXwcI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711372534; c=relaxed/simple; bh=5y3GcYhD+Ve12bEfH7L7G8tw0wf4DxrQppZ1pdLJirM=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=a6dhk7KBZJqrF+ZkA+w+uWCJcXKMATrLjnCzzUl7XJ6/ZoibA/r24JF0NECv6JRKZ4NrohT7MYlAlBX3G3RwYi7R1jSYo4zC5zGTwi2QRDG2SdgqAhUI/2qYMUmk5VgVX0cnkln6/J3bb3qLS7aAvM3loQZKJTpGgv5Di7XjsFI= 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=ClTeA5Pl; 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 (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42PAUF9l021175; Mon, 25 Mar 2024 13:15:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=6azWjmnjffihgzpQWtVpTkFxRLmZYV1rLUGMd3pxWlY=; b=Cl TeA5Pl09dWRxQeUfM+UDQ9vS0pNo+gbsZfz8G2UjrJ/SD32jlwDzH/ZqCjozsE3l RWfavQA4psZ4n+5M/3Hpe4LjCXHE9fktvQVLgHSM5NDCMQC5DKSYF0ru842ByusA m02jXfbiSPcdDAIB2NdoRA0U4/azT6V+BDCImwTdPFvcN30DWcVq274Nv68BgAma uav0vUyAKKaMN6Q4+rIIUDEBa58fO2tSK+6jukBMqQwusCIDphQM4ida0e5b3kxc pJN+yqZoOe1h2E+b4v3J1cTL1jvXXMzb7F4p3YhsRujeVf6kMURyDRjDrqxXxIyV u/7sDjjHFD5egSTlT2iQ== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3x34hp0v8a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 25 Mar 2024 13:15:27 +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 42PDFQPt006955 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 25 Mar 2024 13:15:26 GMT Received: from [10.216.25.244] (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; Mon, 25 Mar 2024 06:15:21 -0700 Message-ID: <50926b91-3c61-4dbf-85c9-7558ab96e628@quicinc.com> Date: Mon, 25 Mar 2024 18:45:07 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v16 7/9] usb: dwc3: qcom: Refactor IRQ handling in glue driver Content-Language: en-US To: Johan Hovold CC: Krzysztof Kozlowski , Rob Herring , Bjorn Andersson , Wesley Cheng , Konrad Dybcio , "Greg Kroah-Hartman" , Conor Dooley , Thinh Nguyen , Felipe Balbi , , , , , , References: <20240307062052.2319851-1-quic_kriskura@quicinc.com> <20240307062052.2319851-8-quic_kriskura@quicinc.com> From: Krishna Kurapati PSSNV In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit 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-ORIG-GUID: PJMPZQSc9V_Y73u_UwQPfyE-qKV74QZa X-Proofpoint-GUID: PJMPZQSc9V_Y73u_UwQPfyE-qKV74QZa 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-25_08,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 suspectscore=0 spamscore=0 lowpriorityscore=0 phishscore=0 impostorscore=0 priorityscore=1501 clxscore=1011 mlxscore=0 adultscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2403250073 On 3/25/2024 6:18 PM, Johan Hovold wrote: > On Thu, Mar 07, 2024 at 11:50:50AM +0530, Krishna Kurapati wrote: >> On multiport supported controllers, each port has its own DP/DM >> and SS (if super speed capable) interrupts. As per the bindings, >> their interrupt names differ from standard ones having "_x" added >> as suffix (x indicates port number). Identify from the interrupt >> names whether the controller is a multiport controller or not. >> Refactor dwc3_qcom_setup_irq() call to parse multiport interrupts >> along with non-multiport ones accordingly.. >> >> Signed-off-by: Krishna Kurapati >> --- >> drivers/usb/dwc3/dwc3-qcom.c | 146 +++++++++++++++++++++++++++-------- >> 1 file changed, 112 insertions(+), 34 deletions(-) > > This is much better. Just a couple of nits below. > >> +static int dwc3_qcom_find_num_ports(struct platform_device *pdev) >> +{ >> + const char *irq_name; >> + int port_index; >> + int irq; >> + >> + irq = platform_get_irq_byname_optional(pdev, "qusb2_phy"); >> + if (irq > 0) >> + return 1; >> + >> + irq = platform_get_irq_byname_optional(pdev, "dp_hs_phy_irq"); >> + if (irq > 0) >> + return 1; >> + >> + for (port_index = 0; port_index < DWC3_MAX_PORTS; port_index++) { >> + irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "dp_hs_phy_%d", port_index + 1); > > Please use a stack allocated buffer for these strings as we don't need > them any more after this function returns. > Sure. Will replace this with "char irq_name[14]". >> + if (!irq_name) >> + return -ENOMEM; >> + >> + irq = platform_get_irq_byname_optional(pdev, irq_name); >> + if (irq <= 0) >> + return port_index; >> + } >> + >> + return port_index; > > I think explicitly returning DWC3_MAX_PORTS here would be more readable. > Will make this change. >> +} >> + >> +static int dwc3_qcom_setup_irq(struct platform_device *pdev) >> +{ >> + struct dwc3_qcom *qcom = platform_get_drvdata(pdev); >> + bool is_multiport; >> + int ret; >> + int i; >> + >> + qcom->num_ports = dwc3_qcom_find_num_ports(pdev); >> + if (qcom->num_ports < 0) >> + return -ENOMEM; > > Just return 'ret' directly. Sure, will init ret to -ENOMEM and return ret here. > >> + >> + is_multiport = (qcom->num_ports > 1) ? true : false; > > And no need for the ternary operator: ACK. > > is_multiport = (qcom->num_ports > 1); > >> + >> + for (i = 0; i < qcom->num_ports; i++) { >> + ret = dwc3_qcom_setup_port_irq(pdev, i, is_multiport); >> if (ret) >> return ret; >> - qcom->ss_phy_irq = irq; >> } >> >> return 0; > > With that fixed: > > Reviewed-by: Johan Hovold Thanks for the review Regards, Krishna,