[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250715191143.1023512-7-rrichter@amd.com>
Date: Tue, 15 Jul 2025 21:11:29 +0200
From: Robert Richter <rrichter@....com>
To: Alison Schofield <alison.schofield@...el.com>, Vishal Verma
<vishal.l.verma@...el.com>, Ira Weiny <ira.weiny@...el.com>, Dan Williams
<dan.j.williams@...el.com>, Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Dave Jiang <dave.jiang@...el.com>, Davidlohr Bueso <dave@...olabs.net>
CC: <linux-cxl@...r.kernel.org>, <linux-kernel@...r.kernel.org>, Gregory Price
<gourry@...rry.net>, "Fabio M. De Francesco"
<fabio.m.de.francesco@...ux.intel.com>, Terry Bowman <terry.bowman@....com>,
Robert Richter <rrichter@....com>
Subject: [PATCH v1 06/20] cxl/region: Remove dev_err() from cxl_find_root_decoder()
cxl_find_root_decoder() is a small helper function. Remove dev_err()
from there and instead move it to the next higher level where other
messages are generated too and all parameters are available to
generate the message. This simplifies code in cxl_find_root_decoder().
Signed-off-by: Robert Richter <rrichter@....com>
---
drivers/cxl/core/region.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index cfcd286251d5..760455c760e8 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -3250,22 +3250,14 @@ cxl_port_find_switch_decoder(struct cxl_port *port, struct range *hpa)
static struct cxl_root_decoder *
cxl_find_root_decoder(struct cxl_endpoint_decoder *cxled)
{
- struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
struct cxl_port *port = cxled_to_port(cxled);
struct cxl_root *cxl_root __free(put_cxl_root) = find_cxl_root(port);
- struct cxl_decoder *root, *cxld = &cxled->cxld;
- struct range *hpa = &cxld->hpa_range;
+ struct range *hpa = &cxled->cxld.hpa_range;
+ struct cxl_decoder *root;
root = cxl_port_find_switch_decoder(&cxl_root->port, hpa);
- if (!root) {
- dev_err(cxlmd->dev.parent,
- "%s:%s no CXL window for range %#llx:%#llx\n",
- dev_name(&cxlmd->dev), dev_name(&cxld->dev),
- cxld->hpa_range.start, cxld->hpa_range.end);
- return NULL;
- }
- return to_cxl_root_decoder(&root->dev);
+ return root ? to_cxl_root_decoder(&root->dev) : NULL;
}
static int match_region_by_range(struct device *dev, const void *data)
@@ -3444,6 +3436,7 @@ static struct cxl_region *construct_region(struct cxl_root_decoder *cxlrd,
int cxl_add_to_region(struct cxl_endpoint_decoder *cxled)
{
+ struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
struct range *hpa = &cxled->cxld.hpa_range;
struct cxl_region_params *p;
bool attach = false;
@@ -3451,8 +3444,14 @@ int cxl_add_to_region(struct cxl_endpoint_decoder *cxled)
struct cxl_root_decoder *cxlrd __free(put_cxl_root_decoder) =
cxl_find_root_decoder(cxled);
- if (!cxlrd)
+
+ if (!cxlrd) {
+ dev_err(cxlmd->dev.parent,
+ "%s:%s no CXL window for range %#llx:%#llx\n",
+ dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev),
+ hpa->start, hpa->end);
return -ENXIO;
+ }
/*
* Ensure that if multiple threads race to construct_region() for @hpa
--
2.39.5
Powered by blists - more mailing lists