From: Konrad Dybcio <konrad.dybcio@linaro.org>
To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
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
Subject: Re: [PATCH v2] PCI: qcom: Make use of QCOM_PCIE_LINK_SPEED_TO_BW() macro for encoding link speed
Date: Wed, 27 Sep 2023 17:06:55 +0200 [thread overview]
Message-ID: <ea9374d9-34bc-4e9e-aba2-4ca50e5090f2@linaro.org> (raw)
In-Reply-To: <20230927145738.115843-1-manivannan.sadhasivam@linaro.org>
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 <bhelgaas@google.com>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
>
> 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
next prev parent reply other threads:[~2023-09-27 15:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-27 14:57 [PATCH v2] PCI: qcom: Make use of QCOM_PCIE_LINK_SPEED_TO_BW() macro for encoding link speed Manivannan Sadhasivam
2023-09-27 15:06 ` Konrad Dybcio [this message]
2023-09-27 15:12 ` Manivannan Sadhasivam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ea9374d9-34bc-4e9e-aba2-4ca50e5090f2@linaro.org \
--to=konrad.dybcio@linaro.org \
--cc=abel.vesa@linaro.org \
--cc=andersson@kernel.org \
--cc=bhelgaas@google.com \
--cc=kw@linux.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox