Add provider name in order to associate cxl test dimm from cxl_test to the cxl pmem device when going through sysfs for security testing.
Signed-off-by: Dave Jiang <dave.ji...@intel.com> --- drivers/cxl/pmem.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/cxl/pmem.c b/drivers/cxl/pmem.c index 9f34f8701b57..cb303edb925d 100644 --- a/drivers/cxl/pmem.c +++ b/drivers/cxl/pmem.c @@ -48,6 +48,15 @@ static void unregister_nvdimm(void *nvdimm) cxl_nvd->bridge = NULL; } +static ssize_t provider_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct nvdimm *nvdimm = to_nvdimm(dev); + struct cxl_nvdimm *cxl_nvd = nvdimm_provider_data(nvdimm); + + return sysfs_emit(buf, "%s\n", dev_name(&cxl_nvd->dev)); +} +static DEVICE_ATTR_RO(provider); + static ssize_t id_show(struct device *dev, struct device_attribute *attr, char *buf) { struct nvdimm *nvdimm = to_nvdimm(dev); @@ -61,6 +70,7 @@ static DEVICE_ATTR_RO(id); static struct attribute *cxl_dimm_attributes[] = { &dev_attr_id.attr, + &dev_attr_provider.attr, NULL };