summaryrefslogtreecommitdiffstats
path: root/drivers/cxl/port.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2022-05-19 01:35:17 +0200
committerDan Williams <dan.j.williams@intel.com>2022-05-19 17:50:42 +0200
commitfcfbc93cc33ec601f00f113eca6fc484b930532d (patch)
tree34f9211524cad8a5a060d257612d9126e2bf9c22 /drivers/cxl/port.c
parentcxl/port: Move endpoint HDM Decoder Capability init to port driver (diff)
downloadlinux-fcfbc93cc33ec601f00f113eca6fc484b930532d.tar.xz
linux-fcfbc93cc33ec601f00f113eca6fc484b930532d.zip
cxl/port: Reuse 'struct cxl_hdm' context for hdm init
The port driver maps component registers for port operations. Reuse that mapping for HDM Decoder Capability setup / enable. Move devm_cxl_setup_hdm() before cxl_hdm_decode_init() and plumb @cxlhdm through the hdm init helpers. Reviewed-by: Ira Weiny <ira.weiny@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/165291691712.1426646.14336397551571515480.stgit@dwillia2-xfh Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/cxl/port.c')
-rw-r--r--drivers/cxl/port.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/cxl/port.c b/drivers/cxl/port.c
index a7deaeaf0276..3cf308f114c4 100644
--- a/drivers/cxl/port.c
+++ b/drivers/cxl/port.c
@@ -36,6 +36,19 @@ static int cxl_port_probe(struct device *dev)
struct cxl_hdm *cxlhdm;
int rc;
+
+ if (!is_cxl_endpoint(port)) {
+ rc = devm_cxl_port_enumerate_dports(port);
+ if (rc < 0)
+ return rc;
+ if (rc == 1)
+ return devm_cxl_add_passthrough_decoder(port);
+ }
+
+ cxlhdm = devm_cxl_setup_hdm(port);
+ if (IS_ERR(cxlhdm))
+ return PTR_ERR(cxlhdm);
+
if (is_cxl_endpoint(port)) {
struct cxl_memdev *cxlmd = to_cxl_memdev(port->uport);
struct cxl_dev_state *cxlds = cxlmd->cxlds;
@@ -45,7 +58,7 @@ static int cxl_port_probe(struct device *dev)
if (rc)
return rc;
- rc = cxl_hdm_decode_init(cxlds);
+ rc = cxl_hdm_decode_init(cxlds, cxlhdm);
if (rc)
return rc;
@@ -54,18 +67,8 @@ static int cxl_port_probe(struct device *dev)
dev_err(dev, "Media not active (%d)\n", rc);
return rc;
}
- } else {
- rc = devm_cxl_port_enumerate_dports(port);
- if (rc < 0)
- return rc;
- if (rc == 1)
- return devm_cxl_add_passthrough_decoder(port);
}
- cxlhdm = devm_cxl_setup_hdm(port);
- if (IS_ERR(cxlhdm))
- return PTR_ERR(cxlhdm);
-
rc = devm_cxl_enumerate_decoders(cxlhdm);
if (rc) {
dev_err(dev, "Couldn't enumerate decoders (%d)\n", rc);