@@ -45,6 +45,7 @@ struct cxl_memdev {
int id;
resource_size_t creg_base;
struct cxl_dport *root_port;
+ struct cxl_port *uport;
};
static inline struct cxl_memdev *to_cxl_memdev(struct device *dev)
@@ -61,8 +61,7 @@ static void remove_endpoint(void *_cxlmd)
if (cxlmd->root_port)
sysfs_remove_link(&cxlmd->dev.kobj, "root_port");
- endpoint = dev_get_drvdata(&cxlmd->dev);
-
+ endpoint = cxlmd->uport;
devm_cxl_remove_port(endpoint);
}
@@ -83,7 +82,7 @@ static int create_endpoint(struct device *dev, struct cxl_port *parent,
device_del(&endpoint->dev);
return rc;
}
- dev_set_drvdata(dev, endpoint);
+ cxlmd->uport = endpoint;
dev_dbg(dev, "add: %s\n", dev_name(&endpoint->dev));
return devm_add_action_or_reset(dev, remove_endpoint, cxlmd);
Keeping track of an endpoint's port is important when attempting to assemble all relevant components in the CXL.mem route from root to endpoint. Without this change, the endpoint's port can be obtained through walks of the hierarchy. Signed-off-by: Ben Widawsky <ben.widawsky@intel.com> --- drivers/cxl/cxlmem.h | 1 + drivers/cxl/mem.c | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-)