aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nvdimm/namespace_devs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/nvdimm/namespace_devs.c')
-rw-r--r--drivers/nvdimm/namespace_devs.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
index a518cb1b59d4..ce3e8dfa10ad 100644
--- a/drivers/nvdimm/namespace_devs.c
+++ b/drivers/nvdimm/namespace_devs.c
@@ -52,17 +52,17 @@ static void namespace_blk_release(struct device *dev)
52 kfree(nsblk); 52 kfree(nsblk);
53} 53}
54 54
55static struct device_type namespace_io_device_type = { 55static const struct device_type namespace_io_device_type = {
56 .name = "nd_namespace_io", 56 .name = "nd_namespace_io",
57 .release = namespace_io_release, 57 .release = namespace_io_release,
58}; 58};
59 59
60static struct device_type namespace_pmem_device_type = { 60static const struct device_type namespace_pmem_device_type = {
61 .name = "nd_namespace_pmem", 61 .name = "nd_namespace_pmem",
62 .release = namespace_pmem_release, 62 .release = namespace_pmem_release,
63}; 63};
64 64
65static struct device_type namespace_blk_device_type = { 65static const struct device_type namespace_blk_device_type = {
66 .name = "nd_namespace_blk", 66 .name = "nd_namespace_blk",
67 .release = namespace_blk_release, 67 .release = namespace_blk_release,
68}; 68};
@@ -962,8 +962,8 @@ static ssize_t __size_store(struct device *dev, unsigned long long val)
962 struct nvdimm_drvdata *ndd; 962 struct nvdimm_drvdata *ndd;
963 struct nd_label_id label_id; 963 struct nd_label_id label_id;
964 u32 flags = 0, remainder; 964 u32 flags = 0, remainder;
965 int rc, i, id = -1;
965 u8 *uuid = NULL; 966 u8 *uuid = NULL;
966 int rc, i;
967 967
968 if (dev->driver || ndns->claim) 968 if (dev->driver || ndns->claim)
969 return -EBUSY; 969 return -EBUSY;
@@ -972,11 +972,13 @@ static ssize_t __size_store(struct device *dev, unsigned long long val)
972 struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev); 972 struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev);
973 973
974 uuid = nspm->uuid; 974 uuid = nspm->uuid;
975 id = nspm->id;
975 } else if (is_namespace_blk(dev)) { 976 } else if (is_namespace_blk(dev)) {
976 struct nd_namespace_blk *nsblk = to_nd_namespace_blk(dev); 977 struct nd_namespace_blk *nsblk = to_nd_namespace_blk(dev);
977 978
978 uuid = nsblk->uuid; 979 uuid = nsblk->uuid;
979 flags = NSLABEL_FLAG_LOCAL; 980 flags = NSLABEL_FLAG_LOCAL;
981 id = nsblk->id;
980 } 982 }
981 983
982 /* 984 /*
@@ -1039,10 +1041,11 @@ static ssize_t __size_store(struct device *dev, unsigned long long val)
1039 1041
1040 /* 1042 /*
1041 * Try to delete the namespace if we deleted all of its 1043 * Try to delete the namespace if we deleted all of its
1042 * allocation, this is not the seed device for the region, and 1044 * allocation, this is not the seed or 0th device for the
1043 * it is not actively claimed by a btt instance. 1045 * region, and it is not actively claimed by a btt, pfn, or dax
1046 * instance.
1044 */ 1047 */
1045 if (val == 0 && nd_region->ns_seed != dev && !ndns->claim) 1048 if (val == 0 && id != 0 && nd_region->ns_seed != dev && !ndns->claim)
1046 nd_device_unregister(dev, ND_ASYNC); 1049 nd_device_unregister(dev, ND_ASYNC);
1047 1050
1048 return rc; 1051 return rc;