mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Hans Zhang <18255117159@163.com>
Cc: bhelgaas@google.com, lpieralisi@kernel.org, kw@linux.com,
	 krzk+dt@kernel.org, manivannan.sadhasivam@linaro.org,
	jingoohan1@gmail.com,  robh@kernel.org,
	linux-pci@vger.kernel.org,  LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] PCI: Add PCIE_SPEED2LNKCTL2_TLS_ENC conversion macro
Date: Tue, 3 Jun 2025 12:08:22 +0300 (EEST)	[thread overview]
Message-ID: <9bc475b4-4924-1b0f-af3e-ec4fa8140765@linux.intel.com> (raw)
In-Reply-To: <20250519163156.217567-2-18255117159@163.com>

On Tue, 20 May 2025, Hans Zhang wrote:

> Introduce PCIE_SPEED2LNKCTL2_TLS_ENC macro to standardize the conversion

Use () parenthesis like you'd use them in C so functions and macros in 
changelog should have them appended.

> between PCIe speed enumerations and LNKCTL2_TLS register values. This
> centralizes speed-to-register mapping logic, eliminating duplicated
> conversion code across multiple drivers.
> 
> Signed-off-by: Hans Zhang <18255117159@163.com>
> ---
>  drivers/pci/pci.h | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index f92928dadc6a..b7e2d08825c6 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -415,6 +415,15 @@ void pci_bus_put(struct pci_bus *bus);
>  	 (lnkctl2) == PCI_EXP_LNKCTL2_TLS_2_5GT ? PCIE_SPEED_2_5GT : \
>  	 PCI_SPEED_UNKNOWN)
>  
> +#define PCIE_SPEED2LNKCTL2_TLS_ENC(speed) \

I'm not a big fan of including that _ENC there, it just makes the long 
name even longer and doesn't really provide added value, IMO.

Other than those, this change logs fine.

> +	((speed) == PCIE_SPEED_2_5GT ? PCI_EXP_LNKCTL2_TLS_2_5GT : \
> +	 (speed) == PCIE_SPEED_5_0GT ? PCI_EXP_LNKCTL2_TLS_5_0GT : \
> +	 (speed) == PCIE_SPEED_8_0GT ? PCI_EXP_LNKCTL2_TLS_8_0GT : \
> +	 (speed) == PCIE_SPEED_16_0GT ? PCI_EXP_LNKCTL2_TLS_16_0GT : \
> +	 (speed) == PCIE_SPEED_32_0GT ? PCI_EXP_LNKCTL2_TLS_32_0GT : \
> +	 (speed) == PCIE_SPEED_64_0GT ? PCI_EXP_LNKCTL2_TLS_64_0GT : \
> +	 0)
> +
>  /* PCIe speed to Mb/s reduced by encoding overhead */
>  #define PCIE_SPEED2MBS_ENC(speed) \
>  	((speed) == PCIE_SPEED_64_0GT ? 64000*1/1 : \
> 

-- 
 i.


  reply	other threads:[~2025-06-03  9:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-19 16:31 [PATCH 0/3] PCIe: Refactor link speed configuration with unified macro Hans Zhang
2025-05-19 16:31 ` [PATCH 1/3] PCI: Add PCIE_SPEED2LNKCTL2_TLS_ENC conversion macro Hans Zhang
2025-06-03  9:08   ` Ilpo Järvinen [this message]
2025-06-03 15:31     ` Hans Zhang
2025-05-19 16:31 ` [PATCH 2/3] PCI: dwc: Simplify link speed configuration with macro Hans Zhang
2025-05-19 16:31 ` [PATCH 3/3] PCI/bwctrl: Replace legacy speed conversion with shared macro Hans Zhang

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=9bc475b4-4924-1b0f-af3e-ec4fa8140765@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=18255117159@163.com \
    --cc=bhelgaas@google.com \
    --cc=jingoohan1@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=robh@kernel.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

all inboxes | Powered by JetHome®