summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSantosh Sivaraj <santosh@fossix.org>2020-12-22 05:22:35 +0100
committerDan Williams <dan.j.williams@intel.com>2021-01-28 09:22:49 +0100
commit107b04e970cae754100efb99a5312c321208ca03 (patch)
treec18e49cba910fa59aaaa6e1ae72c5673229fe127 /tools
parenttesting/nvdimm: Add test module for non-nfit platforms (diff)
downloadlinux-107b04e970cae754100efb99a5312c321208ca03.tar.xz
linux-107b04e970cae754100efb99a5312c321208ca03.zip
ndtest: Add compatability string to treat it as PAPR family
Since this module is written to be platform agnostic, the module is made part of the PAPR_FAMILY. ndctl identifies the family using the compatible string inside of_node dir-entry. Signed-off-by: Santosh Sivaraj <santosh@fossix.org> Link: https://lore.kernel.org/r/20201222042240.2983755-3-santosh@fossix.org Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/nvdimm/test/ndtest.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/testing/nvdimm/test/ndtest.c b/tools/testing/nvdimm/test/ndtest.c
index f89d74fdcdee..001527b37a23 100644
--- a/tools/testing/nvdimm/test/ndtest.c
+++ b/tools/testing/nvdimm/test/ndtest.c
@@ -65,11 +65,34 @@ static int ndtest_ctl(struct nvdimm_bus_descriptor *nd_desc,
return 0;
}
+static ssize_t compatible_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return sprintf(buf, "nvdimm_test");
+}
+static DEVICE_ATTR_RO(compatible);
+
+static struct attribute *of_node_attributes[] = {
+ &dev_attr_compatible.attr,
+ NULL
+};
+
+static const struct attribute_group of_node_attribute_group = {
+ .name = "of_node",
+ .attrs = of_node_attributes,
+};
+
+static const struct attribute_group *ndtest_attribute_groups[] = {
+ &of_node_attribute_group,
+ NULL,
+};
+
static int ndtest_bus_register(struct ndtest_priv *p)
{
p->bus_desc.ndctl = ndtest_ctl;
p->bus_desc.module = THIS_MODULE;
p->bus_desc.provider_name = NULL;
+ p->bus_desc.attr_groups = ndtest_attribute_groups;
p->bus = nvdimm_bus_register(&p->pdev.dev, &p->bus_desc);
if (!p->bus) {