[PATCH 1/2] cxl/test: Removal of nvdimm_bus_register() wrapper in cxl_test

Dave Jiang
2026-02-05T00:16:39Z

Remove nvdimm_bus_register() wrapper in cxl_test driver in order to
address a fix in a different commit that fixes the issue of missing
nvdimm bus object due to an initialization race. The CXL CLI unit
test cxl-security.sh will be adjusted with this new change.

Suggested-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
drivers/cxl/pmem.c | 2 +-
include/linux/libnvdimm.h | 2 +-
tools/testing/cxl/Kbuild | 1 -
tools/testing/cxl/test/mock.c | 15 ---------------
4 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/cxl/pmem.c b/drivers/cxl/pmem.c
index e197883690ef..45486a9d23a5 100644
--- a/drivers/cxl/pmem.c
+++ b/drivers/cxl/pmem.c
@@ -334,7 +334,7 @@ static int cxl_nvdimm_bridge_probe(struct device *dev)
struct cxl_nvdimm_bridge *cxl_nvb = to_cxl_nvdimm_bridge(dev);

cxl_nvb->nd_desc = (struct nvdimm_bus_descriptor) {
- .provider_name = "CXL",
+ .provider_name = dev_name(dev->parent->parent),
.module = THIS_MODULE,
.ndctl = cxl_pmem_ctl,
};
diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
index 28f086c4a187..716163fc5e09 100644
--- a/include/linux/libnvdimm.h
+++ b/include/linux/libnvdimm.h
@@ -89,7 +89,7 @@ struct nvdimm_bus_descriptor {
unsigned long dimm_family_mask;
unsigned long bus_family_mask;
struct module *module;
- char *provider_name;
+ const char *provider_name;
struct device_node *of_node;
ndctl_fn ndctl;
int (*flush_probe)(struct nvdimm_bus_descriptor *nd_desc);
diff --git a/tools/testing/cxl/Kbuild b/tools/testing/cxl/Kbuild
index 0e151d0572d1..44abab0275e4 100644
--- a/tools/testing/cxl/Kbuild
+++ b/tools/testing/cxl/Kbuild
@@ -3,7 +3,6 @@ ldflags-y += --wrap=acpi_table_parse_cedt
ldflags-y += --wrap=is_acpi_device_node
ldflags-y += --wrap=acpi_evaluate_integer
ldflags-y += --wrap=acpi_pci_find_root
-ldflags-y += --wrap=nvdimm_bus_register
ldflags-y += --wrap=cxl_await_media_ready
ldflags-y += --wrap=devm_cxl_add_rch_dport
ldflags-y += --wrap=cxl_endpoint_parse_cdat
diff --git a/tools/testing/cxl/test/mock.c b/tools/testing/cxl/test/mock.c
index 44bce80ef3ff..47b1aadabf98 100644
--- a/tools/testing/cxl/test/mock.c
+++ b/tools/testing/cxl/test/mock.c
@@ -148,21 +148,6 @@ struct acpi_pci_root *__wrap_acpi_pci_find_root(acpi_handle handle)
}
EXPORT_SYMBOL_GPL(__wrap_acpi_pci_find_root);

-struct nvdimm_bus *
-__wrap_nvdimm_bus_register(struct device *dev,
- struct nvdimm_bus_descriptor *nd_desc)
-{
- int index;
- struct cxl_mock_ops *ops = get_cxl_mock_ops(&index);
-
- if (ops && ops->is_mock_dev(dev->parent->parent))
- nd_desc->provider_name = "cxl_test";
- put_cxl_mock_ops(index);
-
- return nvdimm_bus_register(dev, nd_desc);
-}
-EXPORT_SYMBOL_GPL(__wrap_nvdimm_bus_register);
-
int redirect_devm_cxl_switch_port_decoders_setup(struct cxl_port *port)
{
int rc, index;
--
2.52.0