aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cxl/core/memdev.c
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2023-10-16 10:57:48 -0700
committerDan Williams <dan.j.williams@intel.com>2023-10-27 20:29:41 -0700
commit458ba8189cb4380aa6a6cc4d52ab067f80a64829 (patch)
tree1f5220e5c47e52604cf9f81f1e7b5db7e9516b1f /drivers/cxl/core/memdev.c
parenttools/testing/cxl: Slow down the mock firmware transfer (diff)
downloadlinux-458ba8189cb4380aa6a6cc4d52ab067f80a64829.tar.gz
linux-458ba8189cb4380aa6a6cc4d52ab067f80a64829.zip
cxl: Add cxl_decoders_committed() helper
Add a helper to retrieve the number of decoders committed for the port. Replace all the open coding of the calculation with the helper. Link: https://lore.kernel.org/linux-cxl/651c98472dfed_ae7e729495@dwillia2-xfh.jf.intel.com.notmuch/ Suggested-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Jim Harris <jim.harris@samsung.com> Reviewed-by: Alison Schofield <alison.schofield@intel.com> Link: https://lore.kernel.org/r/169747906849.272156.1729290904857372335.stgit@djiang5-mobl3 Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/cxl/core/memdev.c')
-rw-r--r--drivers/cxl/core/memdev.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c
index fed9573cf355..fc5c2b414793 100644
--- a/drivers/cxl/core/memdev.c
+++ b/drivers/cxl/core/memdev.c
@@ -231,7 +231,7 @@ int cxl_trigger_poison_list(struct cxl_memdev *cxlmd)
if (rc)
return rc;
- if (port->commit_end == -1) {
+ if (cxl_num_decoders_committed(port) == 0) {
/* No regions mapped to this memdev */
rc = cxl_get_poison_by_memdev(cxlmd);
} else {
@@ -282,7 +282,7 @@ static struct cxl_region *cxl_dpa_to_region(struct cxl_memdev *cxlmd, u64 dpa)
.dpa = dpa,
};
port = cxlmd->endpoint;
- if (port && is_cxl_endpoint(port) && port->commit_end != -1)
+ if (port && is_cxl_endpoint(port) && cxl_num_decoders_committed(port))
device_for_each_child(&port->dev, &ctx, __cxl_dpa_to_region);
return ctx.cxlr;