summaryrefslogtreecommitdiffstats
path: root/drivers/nvdimm/region_devs.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2018-04-02 13:14:25 -0700
committerDan Williams <dan.j.williams@intel.com>2018-04-03 11:51:42 -0700
commit243f29fe449bbead69076ad861dbe8f51b42c4d7 (patch)
treeec5ad09b16c163b79d0cbb59714fae785648ac96 /drivers/nvdimm/region_devs.c
parent78727137fdf49edf9f731bde79d7189067b4047a (diff)
downloadlinux-stable-243f29fe449bbead69076ad861dbe8f51b42c4d7.tar.gz
linux-stable-243f29fe449bbead69076ad861dbe8f51b42c4d7.tar.bz2
linux-stable-243f29fe449bbead69076ad861dbe8f51b42c4d7.zip
libnvdimm: add an api to cast a 'struct nd_region' to its 'struct device'
For debug, it is useful for bus providers to be able to retrieve the 'struct device' associated with an nd_region instance that it registered. We already have to_nd_region() to perform the reverse cast operation, in fact its duplicate declaration can be removed from the private drivers/nvdimm/nd.h header. Reviewed-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm/region_devs.c')
-rw-r--r--drivers/nvdimm/region_devs.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
index e6d01911e092..0af275c62bdf 100644
--- a/drivers/nvdimm/region_devs.c
+++ b/drivers/nvdimm/region_devs.c
@@ -182,6 +182,14 @@ struct nd_region *to_nd_region(struct device *dev)
}
EXPORT_SYMBOL_GPL(to_nd_region);
+struct device *nd_region_dev(struct nd_region *nd_region)
+{
+ if (!nd_region)
+ return NULL;
+ return &nd_region->dev;
+}
+EXPORT_SYMBOL_GPL(nd_region_dev);
+
struct nd_blk_region *to_nd_blk_region(struct device *dev)
{
struct nd_region *nd_region = to_nd_region(dev);