diff options
Diffstat (limited to 'drivers/dax/pmem.c')
-rw-r--r-- | drivers/dax/pmem.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/dax/pmem.c b/drivers/dax/pmem.c index 9f2a0b4fd801..8d8c852ba8f2 100644 --- a/drivers/dax/pmem.c +++ b/drivers/dax/pmem.c | |||
@@ -58,13 +58,12 @@ static void dax_pmem_percpu_kill(void *data) | |||
58 | 58 | ||
59 | static int dax_pmem_probe(struct device *dev) | 59 | static int dax_pmem_probe(struct device *dev) |
60 | { | 60 | { |
61 | int rc; | ||
62 | void *addr; | 61 | void *addr; |
63 | struct resource res; | 62 | struct resource res; |
63 | int rc, id, region_id; | ||
64 | struct nd_pfn_sb *pfn_sb; | 64 | struct nd_pfn_sb *pfn_sb; |
65 | struct dev_dax *dev_dax; | 65 | struct dev_dax *dev_dax; |
66 | struct dax_pmem *dax_pmem; | 66 | struct dax_pmem *dax_pmem; |
67 | struct nd_region *nd_region; | ||
68 | struct nd_namespace_io *nsio; | 67 | struct nd_namespace_io *nsio; |
69 | struct dax_region *dax_region; | 68 | struct dax_region *dax_region; |
70 | struct nd_namespace_common *ndns; | 69 | struct nd_namespace_common *ndns; |
@@ -123,14 +122,17 @@ static int dax_pmem_probe(struct device *dev) | |||
123 | /* adjust the dax_region resource to the start of data */ | 122 | /* adjust the dax_region resource to the start of data */ |
124 | res.start += le64_to_cpu(pfn_sb->dataoff); | 123 | res.start += le64_to_cpu(pfn_sb->dataoff); |
125 | 124 | ||
126 | nd_region = to_nd_region(dev->parent); | 125 | rc = sscanf(dev_name(&ndns->dev), "namespace%d.%d", ®ion_id, &id); |
127 | dax_region = alloc_dax_region(dev, nd_region->id, &res, | 126 | if (rc != 2) |
127 | return -EINVAL; | ||
128 | |||
129 | dax_region = alloc_dax_region(dev, region_id, &res, | ||
128 | le32_to_cpu(pfn_sb->align), addr, PFN_DEV|PFN_MAP); | 130 | le32_to_cpu(pfn_sb->align), addr, PFN_DEV|PFN_MAP); |
129 | if (!dax_region) | 131 | if (!dax_region) |
130 | return -ENOMEM; | 132 | return -ENOMEM; |
131 | 133 | ||
132 | /* TODO: support for subdividing a dax region... */ | 134 | /* TODO: support for subdividing a dax region... */ |
133 | dev_dax = devm_create_dev_dax(dax_region, &res, 1); | 135 | dev_dax = devm_create_dev_dax(dax_region, id, &res, 1); |
134 | 136 | ||
135 | /* child dev_dax instances now own the lifetime of the dax_region */ | 137 | /* child dev_dax instances now own the lifetime of the dax_region */ |
136 | dax_region_put(dax_region); | 138 | dax_region_put(dax_region); |