Linux CXL
 help / color / mirror / Atom feed
From: Alison Schofield <alison.schofield@intel.com>
To: Foryun Ma <foryun.ma@jaguarmicro.com>
Cc: dave.jiang@intel.com, dave@stgolabs.net,
	linux-cxl@vger.kernel.org, rrichter@amd.com,
	angus.chen@jaguarmicro.com
Subject: Re: [PATCH] cxl/pci: the ctrl register should be read when it is being used
Date: Wed, 29 May 2024 09:30:36 -0700	[thread overview]
Message-ID: <ZldYLCxCyLwSzx5R@aschofie-mobl2> (raw)
In-Reply-To: <20240529093354.409-1-foryun.ma@jaguarmicro.com>

On Wed, May 29, 2024 at 05:33:54PM +0800, Foryun Ma wrote:
> When the cap register and wait_for_valid checks fail, the ctrl register
> read will be redundant.
> 

Thanks for the patch. I suggest updating the commit message to match the
style of cxl/pci.c, something like:

cxl/pci: Only read the ctrl register it checking contents

A bit more below -


> Signed-off-by: Foryun Ma <foryun.ma@jaguarmicro.com>
> ---
>  drivers/cxl/core/pci.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c
> index 8567dd11eaac..627be83881e9 100644
> --- a/drivers/cxl/core/pci.c
> +++ b/drivers/cxl/core/pci.c
> @@ -338,10 +338,6 @@ int cxl_dvsec_rr_decode(struct device *dev, int d,
>  	if (rc)
>  		return rc;
>  
> -	rc = pci_read_config_word(pdev, d + CXL_DVSEC_CTRL_OFFSET, &ctrl);
> -	if (rc)
> -		return rc;
> -
>  	if (!(cap & CXL_DVSEC_MEM_CAPABLE)) {
>  		dev_dbg(dev, "Not MEM Capable\n");
>  		return -ENXIO;
> @@ -363,6 +359,10 @@ int cxl_dvsec_rr_decode(struct device *dev, int d,
>  		return rc;
>  	}
>  
> +	rc = pci_read_config_word(pdev, d + CXL_DVSEC_CTRL_OFFSET, &ctrl);
> +	if (rc)
> +		return rc;
> +

How about moving the read a few more lines down. Put it after the
comment so that it is directly before the check.


>  	/*
>  	 * The current DVSEC values are moot if the memory capability is
>  	 * disabled, and they will remain moot after the HDM Decoder
> -- 
> 2.34.1
> 
> 

  reply	other threads:[~2024-05-29 16:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-29  9:33 [PATCH] cxl/pci: the ctrl register should be read when it is being used Foryun Ma
2024-05-29 16:30 ` Alison Schofield [this message]
2024-05-29 16:31 ` Dave Jiang

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=ZldYLCxCyLwSzx5R@aschofie-mobl2 \
    --to=alison.schofield@intel.com \
    --cc=angus.chen@jaguarmicro.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=foryun.ma@jaguarmicro.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=rrichter@amd.com \
    /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