Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2802928rdh; Wed, 27 Sep 2023 13:11:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHhSAoDHLepNxKrvCZRSI83+Mc/2uYMglNFC163oViRMKpsLndrXDFVRp7XmQFTXAt8ZzyX X-Received: by 2002:a05:6a20:13d5:b0:161:2df0:eae8 with SMTP id ho21-20020a056a2013d500b001612df0eae8mr2598687pzc.60.1695845503135; Wed, 27 Sep 2023 13:11:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695845503; cv=none; d=google.com; s=arc-20160816; b=fv0w20fhy9WMsP8h8Dir4Pcfw3O0z0hVobhSKoGp22ZY4DQU8gBwWd4NLetsP8+0Lm DmTbsq/z2nvft/Lf6UhcwRobxpd4iYAYeuK02CdE1qO60zPXCKIU2FwMZgZH9OJCpXjx E5xO3Wv2PbpuiNJgQ7nGp6tp6ZcFrGxw1O+4nhSyrmEVfw8ll4vzYtknfs/AA0cckM5w ytSYjVQoC6BAiCAvx0nUnfDNWSSa79m4ju9+bo4vyk6AFP+/wvMjgz9/GTG64NLpULim 2khLqyOVGL6cO1RksoBaFykg/sF5JebiFAV+afb+CRBgFMLzqYrw6GLTvBkLh5V40iUF 3F+w== 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:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=gGcjx0T8d9ndkjDrFc6BSXcIE1q0YyUuM9qOom+Dsxo=; fh=x5b8+TQr+ZfNT5tuauhsyXZwC5Xfg+omrmuywlYfLlY=; b=btUOxCoTbNDYdpXQPD9rowDFbFIZAfO4Ls9taSz8lddXwxrOtMy7vKFJxfAHOdCmiU a420enKUs3yYmhJcrbGYeM3lHq8xntTedbMvTu6QZnzAqwzaFs3NGqKdUnXHPJeapEq+ Ip4EUMLZUO01YY0Vit0Qn7WC3yWMOn0spXRNJfZJnz9QVsXomd4rBUWi2yhLG2/a7KOo AzSSR8XJHzGE4AFPS0tLiafRBGChYZ/b8EWVfDTRY89sqRKdvwdq7gFvQwIQ0EEZp0Ss XbIsCrOqcZ21uX0SC7D7mRFdAQ49qkiZhSKmTWnnptq17lQFg5AYUO4xzHCABgzhpcBt Xkrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lb1DFu0C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id h18-20020a056a001a5200b0069343bdd523si1343777pfv.47.2023.09.27.13.11.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 13:11:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lb1DFu0C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3D186818F6B0; Wed, 27 Sep 2023 08:07:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232295AbjI0PHD (ORCPT + 99 others); Wed, 27 Sep 2023 11:07:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232287AbjI0PHB (ORCPT ); Wed, 27 Sep 2023 11:07:01 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07BC4FC for ; Wed, 27 Sep 2023 08:07:00 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-503f39d3236so18411483e87.0 for ; Wed, 27 Sep 2023 08:06:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695827218; x=1696432018; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=gGcjx0T8d9ndkjDrFc6BSXcIE1q0YyUuM9qOom+Dsxo=; b=Lb1DFu0CDPBtlX9VyEMO69Gd0/wtNBGgoLEMqaXzwL2JMIl47sqlCUATjpI7wltjXL MELpALFE63vSE5DWq5uI1ugkWn6WRzrBFnHFPcZ7gqONHxWhRpD/QAKgg3dDxu2pk/tB fnToBlRPhfBh8YQtLmLf+FgD7BLSVBVTl8k7rgTO3+4LFyVjoZJb6dWdg5rqr+L/jPlb cMWlAVuZTd6kVLX/I5ubsbu4IiBR+RTf7EnyosTNK8IWuXkKC5Jt8A69HPIAbTlEnJLU MzJ4M0rHrn1oFf291FxL5EiVIgzJMt+ifk4Z1xHKLDro+8QMVWer6IGENGg+ReL4liad rUKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695827218; x=1696432018; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gGcjx0T8d9ndkjDrFc6BSXcIE1q0YyUuM9qOom+Dsxo=; b=upuqewTKnws3CfbXInO7pmycdSGX2jfTh6HKaoliPrJWy+C/SZ5DtaHenCR/pSqTU5 bKYfLnHQQdO2s01L4HzWXxQjXxRlQbO3Uigci8lBxIY9d9xCybbXxlKxAhy+QvwQcSGj RUbUfTzFQx1/lt6wQTpPrH6chVvc8EEfrzdaf6EZO7fM6VHxeI9NOHDzV5Hn7pw1E+pO 5ML8oHKEGCsZywVvjy5Q8No0KZPjUUWLmi8hwtM6lUhTwi1JN18yMOG1YMuObbd5bQUq nCDOXNJ11YEcO+SXkxFJy7qsjQbrEtveomMOuJ1MWwupJKP03tA6s0d/ZCCJZzmXaq1i POfQ== X-Gm-Message-State: AOJu0YxCgd0YrQZ3ykJpTb8Jcy6NpDd6pZRhxTschjsdNOXn1iRTlqr0 xdpPPX1WfW/Fir+2k1wiZYkTOw== X-Received: by 2002:a05:6512:21c8:b0:500:be57:ce53 with SMTP id d8-20020a05651221c800b00500be57ce53mr1668929lft.42.1695827217984; Wed, 27 Sep 2023 08:06:57 -0700 (PDT) Received: from [192.168.33.189] (178235177023.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.23]) by smtp.gmail.com with ESMTPSA id j6-20020aa7ca46000000b0052889d090bfsm8354407edt.79.2023.09.27.08.06.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Sep 2023 08:06:57 -0700 (PDT) Message-ID: Date: Wed, 27 Sep 2023 17:06:55 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] PCI: qcom: Make use of QCOM_PCIE_LINK_SPEED_TO_BW() macro for encoding link speed Content-Language: en-US To: Manivannan Sadhasivam , lpieralisi@kernel.org, kw@linux.com Cc: andersson@kernel.org, bhelgaas@google.com, linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, abel.vesa@linaro.org References: <20230927145738.115843-1-manivannan.sadhasivam@linaro.org> From: Konrad Dybcio Autocr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AXmW8v3gIDWyIcgYqb2v8QO2Mqx YMqL7UZxVLul4/JbllsQB8F/fNI8AfttmAQL9cwo6C8yDTXKdho920W4WUR9k8NT/OBqWSyk bGqMHex48FVZhexNPYOd58EY9/7mL5u0sJmo+jTeb4JBgIbFPJCFyng4HwbniWgQJZ1WqaUC nas9J77uICis2WH7N8Bs9jy0wQYezNzqS+FxoNXmDQg2jetX8en4bO2Di7Pmx0jXA4TOb9TM izWDgYvmBE8= In-Reply-To: <20230927145738.115843-1-manivannan.sadhasivam@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 autolearn=unavailable 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 27 Sep 2023 08:07:08 -0700 (PDT) On 27.09.2023 16:57, Manivannan Sadhasivam wrote: > Instead of hardcoding the link speed in MBps, let's make use of the > existing QCOM_PCIE_LINK_SPEED_TO_BW() macro that does the encoding of the > link speed for us. > > This eliminates the need for a switch case in qcom_pcie_icc_update() and > also works for future Gen speeds without any code modifications. > > Suggested-by: Bjorn Helgaas > Signed-off-by: Manivannan Sadhasivam > --- > > Changes in v2: > > - Switched to QCOM_PCIE_LINK_SPEED_TO_BW() macro as per Bjorn's suggestion > https://lore.kernel.org/linux-pci/20230924160713.217086-1-manivannan.sadhasivam@linaro.org/ > > drivers/pci/controller/dwc/pcie-qcom.c | 24 ++++++------------------ > 1 file changed, 6 insertions(+), 18 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > index 297442c969b6..dce80d6dc88f 100644 > --- a/drivers/pci/controller/dwc/pcie-qcom.c > +++ b/drivers/pci/controller/dwc/pcie-qcom.c > @@ -148,6 +148,9 @@ > > #define QCOM_PCIE_CRC8_POLYNOMIAL (BIT(2) | BIT(1) | BIT(0)) > > +#define QCOM_PCIE_LINK_SPEED_TO_BW(speed) \ > + MBps_to_icc(PCIE_SPEED2MBS_ENC(pcie_link_speed[speed]) / BITS_PER_BYTE) Mbps_to_icc (lowercase b) is precisely that Konrad