Skip to content

Commit f953b7d

Browse files
djbwdavejiang
authored andcommitted
cxl/mem: Clarify @host for devm_cxl_add_nvdimm()
The convention for devm_ helpers in the CXL driver is that the first argument is the @host for the operation (locked driver::probe() context). Reviewed-by: Terry Bowman <terry.bowman@amd.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Link: https://patch.msgid.link/20260114182055.46029-17-terry.bowman@amd.com Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
1 parent fda78d8 commit f953b7d

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

drivers/cxl/core/pmem.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,20 +237,21 @@ static void cxlmd_release_nvdimm(void *_cxlmd)
237237

238238
/**
239239
* devm_cxl_add_nvdimm() - add a bridge between a cxl_memdev and an nvdimm
240-
* @parent_port: parent port for the (to be added) @cxlmd endpoint port
241-
* @cxlmd: cxl_memdev instance that will perform LIBNVDIMM operations
240+
* @host: host device for devm operations
241+
* @port: any port in the CXL topology to find the nvdimm-bridge device
242+
* @cxlmd: parent of the to be created cxl_nvdimm device
242243
*
243244
* Return: 0 on success negative error code on failure.
244245
*/
245-
int devm_cxl_add_nvdimm(struct cxl_port *parent_port,
246+
int devm_cxl_add_nvdimm(struct device *host, struct cxl_port *port,
246247
struct cxl_memdev *cxlmd)
247248
{
248249
struct cxl_nvdimm_bridge *cxl_nvb;
249250
struct cxl_nvdimm *cxl_nvd;
250251
struct device *dev;
251252
int rc;
252253

253-
cxl_nvb = cxl_find_nvdimm_bridge(parent_port);
254+
cxl_nvb = cxl_find_nvdimm_bridge(port);
254255
if (!cxl_nvb)
255256
return -ENODEV;
256257

@@ -270,10 +271,10 @@ int devm_cxl_add_nvdimm(struct cxl_port *parent_port,
270271
if (rc)
271272
goto err;
272273

273-
dev_dbg(&cxlmd->dev, "register %s\n", dev_name(dev));
274+
dev_dbg(host, "register %s\n", dev_name(dev));
274275

275276
/* @cxlmd carries a reference on @cxl_nvb until cxlmd_release_nvdimm */
276-
return devm_add_action_or_reset(&cxlmd->dev, cxlmd_release_nvdimm, cxlmd);
277+
return devm_add_action_or_reset(host, cxlmd_release_nvdimm, cxlmd);
277278

278279
err:
279280
put_device(dev);

drivers/cxl/cxl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,8 @@ struct cxl_nvdimm_bridge *devm_cxl_add_nvdimm_bridge(struct device *host,
887887
struct cxl_port *port);
888888
struct cxl_nvdimm *to_cxl_nvdimm(struct device *dev);
889889
bool is_cxl_nvdimm(struct device *dev);
890-
int devm_cxl_add_nvdimm(struct cxl_port *parent_port, struct cxl_memdev *cxlmd);
890+
int devm_cxl_add_nvdimm(struct device *host, struct cxl_port *port,
891+
struct cxl_memdev *cxlmd);
891892
struct cxl_nvdimm_bridge *cxl_find_nvdimm_bridge(struct cxl_port *port);
892893

893894
#ifdef CONFIG_CXL_REGION

drivers/cxl/mem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static int cxl_mem_probe(struct device *dev)
153153
}
154154

155155
if (cxl_pmem_size(cxlds) && IS_ENABLED(CONFIG_CXL_PMEM)) {
156-
rc = devm_cxl_add_nvdimm(parent_port, cxlmd);
156+
rc = devm_cxl_add_nvdimm(dev, parent_port, cxlmd);
157157
if (rc) {
158158
if (rc == -ENODEV)
159159
dev_info(dev, "PMEM disabled by platform\n");

0 commit comments

Comments
 (0)