hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/nvdimm/region.c
....@@ -1,14 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright(c) 2013-2015 Intel Corporation. All rights reserved.
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of version 2 of the GNU General Public License as
6
- * published by the Free Software Foundation.
7
- *
8
- * This program is distributed in the hope that it will be useful, but
9
- * WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
- * General Public License for more details.
124 */
135 #include <linux/cpumask.h>
146 #include <linux/module.h>
....@@ -43,7 +35,10 @@
4335 return rc;
4436
4537 if (is_memory(&nd_region->dev)) {
46
- struct resource ndr_res;
38
+ struct range range = {
39
+ .start = nd_region->ndr_start,
40
+ .end = nd_region->ndr_start + nd_region->ndr_size - 1,
41
+ };
4742
4843 if (devm_init_badblocks(dev, &nd_region->bb))
4944 return -ENODEV;
....@@ -52,9 +47,7 @@
5247 if (!nd_region->bb_state)
5348 dev_warn(&nd_region->dev,
5449 "'badblocks' notification disabled\n");
55
- ndr_res.start = nd_region->ndr_start;
56
- ndr_res.end = nd_region->ndr_start + nd_region->ndr_size - 1;
57
- nvdimm_badblocks_populate(nd_region, &nd_region->bb, &ndr_res);
50
+ nvdimm_badblocks_populate(nd_region, &nd_region->bb, &range);
5851 }
5952
6053 rc = nd_region_register_namespaces(nd_region, &err);
....@@ -110,7 +103,7 @@
110103 nvdimm_bus_unlock(dev);
111104
112105 /*
113
- * Note, this assumes device_lock() context to not race
106
+ * Note, this assumes nd_device_lock() context to not race
114107 * nd_region_notify()
115108 */
116109 sysfs_put(nd_region->bb_state);
....@@ -129,14 +122,16 @@
129122 {
130123 if (event == NVDIMM_REVALIDATE_POISON) {
131124 struct nd_region *nd_region = to_nd_region(dev);
132
- struct resource res;
133125
134126 if (is_memory(&nd_region->dev)) {
135
- res.start = nd_region->ndr_start;
136
- res.end = nd_region->ndr_start +
137
- nd_region->ndr_size - 1;
127
+ struct range range = {
128
+ .start = nd_region->ndr_start,
129
+ .end = nd_region->ndr_start +
130
+ nd_region->ndr_size - 1,
131
+ };
132
+
138133 nvdimm_badblocks_populate(nd_region,
139
- &nd_region->bb, &res);
134
+ &nd_region->bb, &range);
140135 if (nd_region->bb_state)
141136 sysfs_notify_dirent(nd_region->bb_state);
142137 }