summaryrefslogtreecommitdiff
path: root/drivers/cxl/pmem.c
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2022-11-30 12:23:01 -0700
committerDan Williams <dan.j.williams@intel.com>2022-12-01 12:42:35 -0800
commit452996fa079b1a8751a02ac04c54b1d69f512249 (patch)
tree02ba5235eb484f97e652873cb61edd9231a96cde /drivers/cxl/pmem.c
parent18fa556375c0e28f067f4a52e9f11d4fd2cf6842 (diff)
cxl/pmem: add provider name to cxl pmem dimm attribute group
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. Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/166983618174.2734609.15600031015423828810.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/cxl/pmem.c')
-rw-r--r--drivers/cxl/pmem.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/cxl/pmem.c b/drivers/cxl/pmem.c
index 0493ddcfe32c..403e41bcbf2b 100644
--- a/drivers/cxl/pmem.c
+++ b/drivers/cxl/pmem.c
@@ -51,6 +51,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);
@@ -63,6 +72,7 @@ static DEVICE_ATTR_RO(id);
static struct attribute *cxl_dimm_attributes[] = {
&dev_attr_id.attr,
+ &dev_attr_provider.attr,
NULL
};