Skip to contentSkip to conversation

cxl: Add cxl_num_decoders_committed() usage to cxl_test

PATCH Superseded Dave Jiang 1 participant 1 message Nov 3, 2023 CXL

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Dave Jiang

author maintainer
#0 lore raw

PATCH v2 1/1 cxl: Add cxl_num_decoders_committed() usage to cxl_test

Commit 458ba8189cb4 ("cxl: Add cxl_decoders_committed() helper") missed the conversion for cxl_test. Add usage of cxl_num_decoders_committed() to replace the open coding.

---
v2:
- Add missing changes, stg refresh foobar

---
 drivers/cxl/core/port.c      |    1 +
 tools/testing/cxl/test/cxl.c |    5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/cxl/core/port.c +1 -0
index 38441634e4c6..26d17c205408 100644
@@ -43,6 +43,7 @@ int cxl_num_decoders_committed(struct cxl_port *port)
 
 	return port->commit_end + 1;
 }
+EXPORT_SYMBOL_NS_GPL(cxl_num_decoders_committed, CXL);
 
 static ssize_t devtype_show(struct device *dev, struct device_attribute *attr,
 			    char *buf)
tools/testing/cxl/test/cxl.c +3 -2
index b88546299902..f4e517a0c774 100644
@@ -669,10 +669,11 @@ static int mock_decoder_commit(struct cxl_decoder *cxld)
 		return 0;
 
 	dev_dbg(&port->dev, "%s commit\n", dev_name(&cxld->dev));
-	if (port->commit_end + 1 != id) {
+	if (cxl_num_decoders_committed(port) != id) {
 		dev_dbg(&port->dev,
 			"%s: out of order commit, expected decoder%d.%d\n",
-			dev_name(&cxld->dev), port->id, port->commit_end + 1);
+			dev_name(&cxld->dev), port->id,
+			cxl_num_decoders_committed(port));
 		return -EBUSY;
 	}