devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] libnvdimm: Add of_node to region and bus descriptors
@ 2018-03-23  8:12 Oliver O'Halloran
       [not found] ` <20180323081209.31387-1-oohall-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 21+ messages in thread
From: Oliver O'Halloran @ 2018-03-23  8:12 UTC (permalink / raw)
  To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ

We want to be able to cross reference the region and bus devices
with the device tree node that they were spawned from. libNVDIMM
handles creating the actual devices for these internally, so we
need to pass in a pointer to the relevant node in the descriptor.

Signed-off-by: Oliver O'Halloran <oohall-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Acked-by: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/nvdimm/bus.c         | 1 +
 drivers/nvdimm/region_devs.c | 1 +
 include/linux/libnvdimm.h    | 3 +++
 3 files changed, 5 insertions(+)

diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index 78eabc3a1ab1..c6106914f396 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -358,6 +358,7 @@ struct nvdimm_bus *nvdimm_bus_register(struct device *parent,
 	nvdimm_bus->dev.release = nvdimm_bus_release;
 	nvdimm_bus->dev.groups = nd_desc->attr_groups;
 	nvdimm_bus->dev.bus = &nvdimm_bus_type;
+	nvdimm_bus->dev.of_node = nd_desc->of_node;
 	dev_set_name(&nvdimm_bus->dev, "ndbus%d", nvdimm_bus->id);
 	rc = device_register(&nvdimm_bus->dev);
 	if (rc) {
diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
index e6d01911e092..2f1d5771100e 100644
--- a/drivers/nvdimm/region_devs.c
+++ b/drivers/nvdimm/region_devs.c
@@ -1005,6 +1005,7 @@ static struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus,
 	dev->parent = &nvdimm_bus->dev;
 	dev->type = dev_type;
 	dev->groups = ndr_desc->attr_groups;
+	dev->of_node = ndr_desc->of_node;
 	nd_region->ndr_size = resource_size(ndr_desc->res);
 	nd_region->ndr_start = ndr_desc->res->start;
 	nd_device_register(dev);
diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
index ff855ed965fb..f61cb5050297 100644
--- a/include/linux/libnvdimm.h
+++ b/include/linux/libnvdimm.h
@@ -76,12 +76,14 @@ typedef int (*ndctl_fn)(struct nvdimm_bus_descriptor *nd_desc,
 		struct nvdimm *nvdimm, unsigned int cmd, void *buf,
 		unsigned int buf_len, int *cmd_rc);
 
+struct device_node;
 struct nvdimm_bus_descriptor {
 	const struct attribute_group **attr_groups;
 	unsigned long bus_dsm_mask;
 	unsigned long cmd_mask;
 	struct module *module;
 	char *provider_name;
+	struct device_node *of_node;
 	ndctl_fn ndctl;
 	int (*flush_probe)(struct nvdimm_bus_descriptor *nd_desc);
 	int (*clear_to_send)(struct nvdimm_bus_descriptor *nd_desc,
@@ -123,6 +125,7 @@ struct nd_region_desc {
 	int num_lanes;
 	int numa_node;
 	unsigned long flags;
+	struct device_node *of_node;
 };
 
 struct device;
-- 
2.9.5

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2018-03-29  3:10 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-23  8:12 [PATCH 1/6] libnvdimm: Add of_node to region and bus descriptors Oliver O'Halloran
     [not found] ` <20180323081209.31387-1-oohall-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-03-23  8:12   ` [PATCH 2/6] libnvdimm: Add nd_region_destroy() Oliver O'Halloran
     [not found]     ` <20180323081209.31387-2-oohall-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-03-23 16:59       ` Dan Williams
2018-03-25 23:24       ` Balbir Singh
2018-03-23  8:12   ` [PATCH 3/6] libnvdimm: Add device-tree based driver Oliver O'Halloran
     [not found]     ` <20180323081209.31387-3-oohall-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-03-23 17:07       ` Dan Williams
     [not found]         ` <CAPcyv4h=b9fCN7mCU8Yge5804oxVfErXRa_3h7QVcKdEhBbVHg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-03-26  1:07           ` Oliver
2018-03-25  2:51       ` kbuild test robot
2018-03-25  4:27       ` kbuild test robot
2018-03-25  4:28       ` [RFC PATCH] libnvdimm: bus_desc can be static kbuild test robot
2018-03-26  4:05       ` [PATCH 3/6] libnvdimm: Add device-tree based driver Balbir Singh
2018-03-23  8:12   ` [PATCH 4/6] libnvdimm/of: Symlink platform and region devices Oliver O'Halloran
     [not found]     ` <20180323081209.31387-4-oohall-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-03-23 17:08       ` Dan Williams
2018-03-23  8:12   ` [PATCH 5/6] powerpc/powernv: Create platform devs for nvdimm buses Oliver O'Halloran
2018-03-23  8:12   ` [PATCH 6/6] doc/devicetree: NVDIMM region documentation Oliver O'Halloran
     [not found]     ` <20180323081209.31387-6-oohall-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-03-26 22:24       ` Rob Herring
2018-03-27 14:53         ` Oliver
     [not found]           ` <CAOSf1CFpFwzLMx0xmM+JmbQCiOA=QU_S5g0uf-qx181vJ_Xc1w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-03-28 17:06             ` Rob Herring
     [not found]               ` <CAL_Jsq+jC2mAXbKh9c8dbLXZmWbD-sFemrk+8p-oGMkXqSMfnQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-03-28 17:25                 ` Dan Williams
2018-03-29  3:10                 ` Oliver
2018-03-25 23:16   ` [PATCH 1/6] libnvdimm: Add of_node to region and bus descriptors Balbir Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).