aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nvdimm/namespace_devs.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2017-02-26 15:34:42 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2017-02-26 15:34:42 -0500
commit8e22e1b3499a446df48c2b26667ca36c55bf864c (patch)
tree5329f98b3eb3c95a9dcbab0fa4f9b6e62f0e788d /drivers/nvdimm/namespace_devs.c
parent00d3c14f14d51babd8aeafd5fa734ccf04f5ca3d (diff)
parent64a577196d66b44e37384bc5c4d78c61f59d5b2a (diff)
Merge airlied/drm-next into drm-misc-next
Backmerge the main pull request to sync up with all the newly landed drivers. Otherwise we'll have chaos even before 4.12 started in earnest. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
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;