Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4602174rwb; Tue, 8 Aug 2023 10:47:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnY/08X0TcHHIyY9u+U5P8XneOBmJJOgAPKfpAUxDKZjGB+PHzFS42SYU3Q723+2MkCOkC X-Received: by 2002:a05:6a20:459:b0:13f:7ffe:855e with SMTP id b25-20020a056a20045900b0013f7ffe855emr170358pzb.45.1691516858399; Tue, 08 Aug 2023 10:47:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691516858; cv=none; d=google.com; s=arc-20160816; b=kzINCp1aVVMLUV1TFxj0/d55dVH2omJaiW063Cs5dACR9Gxgl57nDq8DHdd7DGXOMd qTpSjcwh6glN1VuD4NJMbAh9hHbD0LefZHCplQb/Ja21OZYD++qP6/nepsKbtmJkt9Xy D0HWCgHDJK5wJEsh0Jqgxcx38oyaNRZz8A7M1Wat0sy5UxJydmS3j38gZKBg8lih6Q9i zZXSHDKsrUJ2FUccLrf3ewf2EvbPzUBEifb88F3ibFPd4sL7LaFEsnc7Gt22Y5vKNMmv nK5o9sL5+fgEkaFdGs73jVpDCf3QuedieK4iejdKpVzWcn5J0eV7nZo9YRd8IANv4/g7 lUEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :from:content-language:references:cc:to:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=/zypaBxPLVAPc31qUuCjXrOIoE2MnVMIBlcoWFCbsKI=; fh=oY+0Xz/b3iq805E1/L58Jrd5UHfKiM9vockV7VKOfqI=; b=iuEf49YlNB9ziV+dhFA14Cut2/ZmHAGAvkb1sdc7aUYMgP0Xqw68X+aUfziO80IERl HyCPcU5jeStXl2iPqDKNyKnClZBBS/BkwwurQ1FhKO5BcDMMF09j/5sUJRMY29b+46wQ b9GkfIGBthpbVhYvIvj/YGREjjdE/oROCjT1Q3X9KQPNNW8bhVlxoSpLGYMj4jVAnuB5 PrNoovKMf20Mm6tEDsHIc4f8g6CKGizQaEkaXlU5JrRgkvcNhUAu0tr6WLNjOLKycVte 8wDw2RoUYKe/ZcnlBRrDVXDplj0OgtCIGuZfIqhyLpbgGcBZeyjwKADXal5AVAF0jEQg jZOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iBFORKJq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be9-20020a056a001f0900b006866be8eed2si7467610pfb.137.2023.08.08.10.47.25; Tue, 08 Aug 2023 10:47:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iBFORKJq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232521AbjHHQ1O (ORCPT + 99 others); Tue, 8 Aug 2023 12:27:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232637AbjHHQZO (ORCPT ); Tue, 8 Aug 2023 12:25:14 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35B918902 for ; Tue, 8 Aug 2023 08:50:19 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3fe2d218eedso50015565e9.0 for ; Tue, 08 Aug 2023 08:50:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691509817; x=1692114617; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=/zypaBxPLVAPc31qUuCjXrOIoE2MnVMIBlcoWFCbsKI=; b=iBFORKJq/rT3xrGAACLA+UTN9xpid/F4BU3QgnMZma5MZeCz6BoAFWY3kuYGOBxDtp CUgzksORbEH30hH1VMEg3USA5QLMWkvmcENqxvpsNITtNrm002vqa49vYaNxopZFhauM sivXPddJCCfsyO/EHFiy1t2/wYXTNKWqaQw6V78slyqpcomPi9Zz/aBrcCHX5RAx1HLG Flfj9q4co0plMAZPSY8uQM23OMxe/OQuhgqfmmHUa34FJK8FBgpMjtciUcV9MH79SkDm 1nrIjKtdIVd47dwD6knwbTx/xZZZfwBC1zEKngb63BPbXktJ2Nc9FNV7+QA+QRffu2lW Wbog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691509817; x=1692114617; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/zypaBxPLVAPc31qUuCjXrOIoE2MnVMIBlcoWFCbsKI=; b=jIJn3lx4QaJasjFFzuKOAUmtG+oyl9tU6pUlnwRlowLXk78jLLC2taqtliy0GMzBsF mWUS/cPFeKJtlPbVxcGHnzADFPhg3KaADUf/Rl0WOVicXNiZixbLu74YgeMC3ye1buCn 7jsd4FeB8ta0xEmpSxk8SoH8z3L6diPnOy2VWvJBw+mDdXY8c9u34/2eUEHGVW2FIOAD auq/MmNe70h5uIFXwwGuztF6GNas8Q9hOdkg1Y0cqvVtXQMcKVqUY2xo35sb+8kIwvD+ /6MkcnO9V//0O/NpktJiV6fVNwgqtIRj3c/1fmd+FAIpHNSTQ+rHjeLWNItCIGYxtTph awCQ== X-Gm-Message-State: AOJu0YzKpGmPlhbaqjjmfu9qqgQryGT8QrxkTOcFv9lrekZTikFcvqPO khrl4OU3MSx8m0BXUdCQOIXDrOqjBilXNu+xhMI= X-Received: by 2002:ac2:4e8b:0:b0:4fe:181f:272c with SMTP id o11-20020ac24e8b000000b004fe181f272cmr6904189lfr.41.1691495409134; Tue, 08 Aug 2023 04:50:09 -0700 (PDT) Received: from [192.168.1.101] (abxi185.neoplus.adsl.tpnet.pl. [83.9.2.185]) by smtp.gmail.com with ESMTPSA id v2-20020ac25922000000b004fe4a1f046asm1856888lfi.266.2023.08.08.04.50.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Aug 2023 04:50:08 -0700 (PDT) Message-ID: <30b1fe67-bab5-4add-8d89-cc8e06cd8c7f@linaro.org> Date: Tue, 8 Aug 2023 13:50:06 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v10 06/11] usb: dwc3: qcom: Refactor IRQ handling in QCOM Glue driver To: Krishna Kurapati PSSNV , Bjorn Andersson Cc: Thinh Nguyen , Greg Kroah-Hartman , Philipp Zabel , Andy Gross , Rob Herring , Krzysztof Kozlowski , Felipe Balbi , Wesley Cheng , Johan Hovold , Mathias Nyman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, quic_pkondeti@quicinc.com, quic_ppratap@quicinc.com, quic_jackp@quicinc.com, ahalaney@redhat.com, quic_shazhuss@quicinc.com References: <20230727223307.8096-1-quic_kriskura@quicinc.com> <20230727223307.8096-7-quic_kriskura@quicinc.com> Content-Language: en-US From: Konrad Dybcio Autocrypt: addr=konrad.dybcio@linaro.org; keydata= xsFNBF9ALYUBEADWAhxdTBWrwA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fNI8AfttmAQL9cwo6C8yDTXKdho920W4WUR9k8NT/OBqWSyk bGqMHex48FVZhexNPYOd58EY9/7mL5u0sJmo+jTeb4JBgIbFPJCFyng4HwbniWgQJZ1WqaUC nas9J77uICis2WH7N8Bs9jy0wQYezNzqS+FxoNXmDQg2jetX8en4bO2Di7Pmx0jXA4TOb9TM izWDgYvmBE8= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8.08.2023 10:32, Krishna Kurapati PSSNV wrote: >  + >>> +enum dwc3_qcom_phy_irq_identifier { >>> +    HS_PHY_IRQ = 0, >>> +    DP_HS_PHY_IRQ, >>> +    DM_HS_PHY_IRQ, >>> +    SS_PHY_IRQ, >>>   }; >> >> This enum is unused. >> > > Hi Bjorn, > >  I didn't use the enum directly, but used its members in the get_port_irq call below. > >> [..] >>> +static int dwc3_get_acpi_index(const struct dwc3_acpi_pdata *pdata, int irq_index) >>> +{ >>> +    int acpi_index = -1; >>> + >>> +    if (!pdata) >>> +        return -1; >>> + >>> +    if (irq_index == DP_HS_PHY_IRQ) >>> +        acpi_index = pdata->dp_hs_phy_irq_index; >>> +    else if (irq_index == DM_HS_PHY_IRQ) >>> +        acpi_index = pdata->dm_hs_phy_irq_index; >>> +    else if (irq_index == SS_PHY_IRQ) >>> +        acpi_index = pdata->ss_phy_irq_index; >> >> It looks favourable to put these in an array, instead of having to pull >> them out of 4 different variables conditionally. >> >>> + >>> +    return acpi_index; >>> +} >>> + >>> +static int dwc3_get_port_irq(struct platform_device *pdev, u8 port_index) >>> +{ >>> +    struct dwc3_qcom *qcom = platform_get_drvdata(pdev); >>> +    bool is_mp_supported = (qcom->data->num_ports > 1) ? true : false; >>> +    const struct dwc3_acpi_pdata *pdata = qcom->acpi_pdata; >>> +    char *disp_name; >>> +    int acpi_index; >>> +    char *dt_name; >>> +    int ret; >>> +    int irq; >>> +    int i; >>> + >>> +    /* >>> +     * We need to read only DP/DM/SS IRQ's here. >>> +     * So loop over from 1->3 and accordingly modify respective phy_irq[]. >>> +     */ >>> +    for (i = 1; i < MAX_PHY_IRQ; i++) { >>> + >>> +        if (!is_mp_supported && (port_index == 0)) { >>> +            if (i == DP_HS_PHY_IRQ) { >>> +                dt_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, >>> +                    "dp_hs_phy_irq"); >>> +                disp_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, >>> +                    "qcom_dwc3 DP_HS"); >>> +            } else if (i == DM_HS_PHY_IRQ) { >>> +                dt_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, >>> +                    "dm_hs_phy_irq"); >>> +                disp_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, >>> +                    "qcom_dwc3 DM_HS"); >>> +            } else if (i == SS_PHY_IRQ) { >>> +                dt_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, >>> +                    "ss_phy_irq"); >>> +                disp_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, >>> +                    "qcom_dwc3 SS"); > Bjorn, Konrad, > > If we are to remove this repetitive loops, we might need to make a 2D array for all of Dp/Dm/Ss interrutps and make a global array of names to be used for irq lookup and use them to reduce the if-else-if stuff here. If that is fine, I can make those changes, else I would like to stick to this approach for now because if we don't add the global array of names, prepping them seperately for dp/dm/ss would again lead us to making if-else loops like above. > > Please let me know your thoughts on this. Can we not just reuse the associated interrupt-names from the devicetree if present? Konrad