Skip to content

Commit 1ff19f4

Browse files
oohaldjbw
authored andcommitted
libnvdimm: Add of_node to region and bus descriptors
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@gmail.com> Acked-by: Dan Williams <dan.j.williams@intel.com> Acked-by: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 60ce0f9 commit 1ff19f4

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

drivers/nvdimm/bus.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ struct nvdimm_bus *nvdimm_bus_register(struct device *parent,
358358
nvdimm_bus->dev.release = nvdimm_bus_release;
359359
nvdimm_bus->dev.groups = nd_desc->attr_groups;
360360
nvdimm_bus->dev.bus = &nvdimm_bus_type;
361+
nvdimm_bus->dev.of_node = nd_desc->of_node;
361362
dev_set_name(&nvdimm_bus->dev, "ndbus%d", nvdimm_bus->id);
362363
rc = device_register(&nvdimm_bus->dev);
363364
if (rc) {

drivers/nvdimm/region_devs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,7 @@ static struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus,
10131013
dev->parent = &nvdimm_bus->dev;
10141014
dev->type = dev_type;
10151015
dev->groups = ndr_desc->attr_groups;
1016+
dev->of_node = ndr_desc->of_node;
10161017
nd_region->ndr_size = resource_size(ndr_desc->res);
10171018
nd_region->ndr_start = ndr_desc->res->start;
10181019
nd_device_register(dev);

include/linux/libnvdimm.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,14 @@ typedef int (*ndctl_fn)(struct nvdimm_bus_descriptor *nd_desc,
7676
struct nvdimm *nvdimm, unsigned int cmd, void *buf,
7777
unsigned int buf_len, int *cmd_rc);
7878

79+
struct device_node;
7980
struct nvdimm_bus_descriptor {
8081
const struct attribute_group **attr_groups;
8182
unsigned long bus_dsm_mask;
8283
unsigned long cmd_mask;
8384
struct module *module;
8485
char *provider_name;
86+
struct device_node *of_node;
8587
ndctl_fn ndctl;
8688
int (*flush_probe)(struct nvdimm_bus_descriptor *nd_desc);
8789
int (*clear_to_send)(struct nvdimm_bus_descriptor *nd_desc,
@@ -123,6 +125,7 @@ struct nd_region_desc {
123125
int num_lanes;
124126
int numa_node;
125127
unsigned long flags;
128+
struct device_node *of_node;
126129
};
127130

128131
struct device;

0 commit comments

Comments
 (0)