[PATCH v4 05/14] cxl/region: Rename function to cxl_find_decoder_early()

From: Robert Richter
Date: Thu Mar 06 2025 - 11:46:30 EST


Current function cxl_region_find_decoder() is used to find a port's
decoder during region setup. The decoder is later used to attach the
port to a region.

Rename function to cxl_find_decoder_early() to emphasize its use only
during region setup in the early pre-init setup stage when an endpoint
is not yet attached to a region (cxl_region_attach()). Once a port is
attached to a region, the region reference can be used to lookup a
region's port and decoder configuration (see struct cxl_region_ref).

Signed-off-by: Robert Richter <rrichter@xxxxxxx>
Reviewed-by: Gregory Price <gourry@xxxxxxxxxx>
Tested-by: Gregory Price <gourry@xxxxxxxxxx>
---
drivers/cxl/core/region.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index 4f79cc17c9c8..e40ae0fefddc 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -865,10 +865,18 @@ static int match_auto_decoder(struct device *dev, const void *data)
return 0;
}

+/*
+ * Only use cxl_find_decoder_early() during region setup in the early
+ * pre-init setup stage when an endpoint is not yet attached to a
+ * region (cxl_region_attach()). Once a port is attached to a region,
+ * the region reference can be used to lookup a region's port and
+ * decoder configuration (see struct cxl_region_ref).
+*/
+
static struct cxl_decoder *
-cxl_region_find_decoder(struct cxl_port *port,
- struct cxl_endpoint_decoder *cxled,
- struct cxl_region *cxlr)
+cxl_find_decoder_early(struct cxl_port *port,
+ struct cxl_endpoint_decoder *cxled,
+ struct cxl_region *cxlr)
{
struct device *dev;

@@ -932,7 +940,7 @@ alloc_region_ref(struct cxl_port *port, struct cxl_region *cxlr,
if (test_bit(CXL_REGION_F_AUTO, &cxlr->flags)) {
struct cxl_decoder *cxld;

- cxld = cxl_region_find_decoder(port, cxled, cxlr);
+ cxld = cxl_find_decoder_early(port, cxled, cxlr);
if (auto_order_ok(port, iter->region, cxld))
continue;
}
@@ -1020,7 +1028,7 @@ static int cxl_rr_alloc_decoder(struct cxl_port *port, struct cxl_region *cxlr,
{
struct cxl_decoder *cxld;

- cxld = cxl_region_find_decoder(port, cxled, cxlr);
+ cxld = cxl_find_decoder_early(port, cxled, cxlr);
if (!cxld) {
dev_dbg(&cxlr->dev, "%s: no decoder available\n",
dev_name(&port->dev));
--
2.39.5