History

nvdimm: Drop nd_device_lock()

Now that all NVDIMM subsystem locking is validated with custom lock classes, there is no need for the custom usage of the lockdep_mutex.

Dan Williams committed 4 years ago

Commit 81beea51 parent 1550a1711 files · +66 −155Browse files

Unified · Split

11 files
  1. drivers/nvdimm/btt_devs.c +8 −8
  2. drivers/nvdimm/bus.c +9 −15
  3. drivers/nvdimm/core.c +5 −5
  4. drivers/nvdimm/dimm_devs.c +4 −4
  5. drivers/nvdimm/namespace_devs.c +18 −18
  6. drivers/nvdimm/nd-core.h +0 −66
  7. drivers/nvdimm/pfn_devs.c +12 −12
  8. drivers/nvdimm/pmem.c +1 −1
  9. drivers/nvdimm/region.c +1 −1
  10. drivers/nvdimm/region_devs.c +8 −8
  11. lib/Kconfig.debug +0 −17
drivers/nvdimm/btt_devs.c+8−8
@@ -50,14 +50,14 @@ static ssize_t sector_size_store(struct device *dev, · 49 unmodified lines
5050 struct nd_btt *nd_btt = to_nd_btt(dev);
5151 ssize_t rc;
5252
53− nd_device_lock(dev);
53+ device_lock(dev);
5454 nvdimm_bus_lock(dev);
5555 rc = nd_size_select_store(dev, buf, &nd_btt->lbasize,
5656 btt_lbasize_supported);
5757 dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf,
5858 buf[len - 1] == '\n' ? "" : "\n");
5959 nvdimm_bus_unlock(dev);
60− nd_device_unlock(dev);
60+ device_unlock(dev);
6161
6262 return rc ? rc : len;
6363 }
@@ -79,11 +79,11 @@ static ssize_t uuid_store(struct device *dev, · 15 unmodified lines
7979 struct nd_btt *nd_btt = to_nd_btt(dev);
8080 ssize_t rc;
8181
82− nd_device_lock(dev);
82+ device_lock(dev);
8383 rc = nd_uuid_store(dev, &nd_btt->uuid, buf, len);
8484 dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf,
8585 buf[len - 1] == '\n' ? "" : "\n");
86− nd_device_unlock(dev);
86+ device_unlock(dev);
8787
8888 return rc ? rc : len;
8989 }
@@ -108,13 +108,13 @@ static ssize_t namespace_store(struct device *dev, · 18 unmodified lines
108108 struct nd_btt *nd_btt = to_nd_btt(dev);
109109 ssize_t rc;
110110
111− nd_device_lock(dev);
111+ device_lock(dev);
112112 nvdimm_bus_lock(dev);
113113 rc = nd_namespace_store(dev, &nd_btt->ndns, buf, len);
114114 dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf,
115115 buf[len - 1] == '\n' ? "" : "\n");
116116 nvdimm_bus_unlock(dev);
117− nd_device_unlock(dev);
117+ device_unlock(dev);
118118
119119 return rc;
120120 }
@@ -126,14 +126,14 @@ static ssize_t size_show(struct device *dev, · 5 unmodified lines
126126 struct nd_btt *nd_btt = to_nd_btt(dev);
127127 ssize_t rc;
128128
129− nd_device_lock(dev);
129+ device_lock(dev);
130130 if (dev->driver)
131131 rc = sprintf(buf, "%llu\n", nd_btt->size);
132132 else {
133133 /* no size to convey if the btt instance is disabled */
134134 rc = -ENXIO;
135135 }
136− nd_device_unlock(dev);
136+ device_unlock(dev);
137137
138138 return rc;
139139 }
drivers/nvdimm/bus.c+9−15
@@ -88,10 +88,7 @@ static int nvdimm_bus_probe(struct device *dev) · 87 unmodified lines
8888 dev->driver->name, dev_name(dev));
8989
9090 nvdimm_bus_probe_start(nvdimm_bus);
91− debug_nvdimm_lock(dev);
9291 rc = nd_drv->probe(dev);
93− debug_nvdimm_unlock(dev);
94−
9592 if ((rc == 0 || rc == -EOPNOTSUPP) &&
9693 dev->parent && is_nd_region(dev->parent))
9794 nd_region_advance_seeds(to_nd_region(dev->parent), dev);
@@ -111,11 +108,8 @@ static void nvdimm_bus_remove(struct device *dev) · 13 unmodified lines
111108 struct module *provider = to_bus_provider(dev);
112109 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev);
113110
114− if (nd_drv->remove) {
115− debug_nvdimm_lock(dev);
111+ if (nd_drv->remove)
116112 nd_drv->remove(dev);
117− debug_nvdimm_unlock(dev);
118− }
119113
120114 dev_dbg(&nvdimm_bus->dev, "%s.remove(%s)\n", dev->driver->name,
121115 dev_name(dev));
@@ -139,7 +133,7 @@ static void nvdimm_bus_shutdown(struct device *dev) · 17 unmodified lines
139133
140134 void nd_device_notify(struct device *dev, enum nvdimm_event event)
141135 {
142− nd_device_lock(dev);
136+ device_lock(dev);
143137 if (dev->driver) {
144138 struct nd_device_driver *nd_drv;
145139
@@ -147,7 +141,7 @@ void nd_device_notify(struct device *dev, enum nvdimm_event event) · 1 unmodified line
147141 if (nd_drv->notify)
148142 nd_drv->notify(dev, event);
149143 }
150− nd_device_unlock(dev);
144+ device_unlock(dev);
151145 }
152146 EXPORT_SYMBOL(nd_device_notify);
153147
@@ -569,9 +563,9 @@ void nd_device_unregister(struct device *dev, enum nd_async_mode mode) · 415 unmodified lines
569563 * or otherwise let the async path handle it if the
570564 * unregistration was already queued.
571565 */
572− nd_device_lock(dev);
566+ device_lock(dev);
573567 killed = kill_device(dev);
574− nd_device_unlock(dev);
568+ device_unlock(dev);
575569
576570 if (!killed)
577571 return;
@@ -930,10 +924,10 @@ void wait_nvdimm_bus_probe_idle(struct device *dev) · 352 unmodified lines
930924 if (nvdimm_bus->probe_active == 0)
931925 break;
932926 nvdimm_bus_unlock(dev);
933− nd_device_unlock(dev);
927+ device_unlock(dev);
934928 wait_event(nvdimm_bus->wait,
935929 nvdimm_bus->probe_active == 0);
936− nd_device_lock(dev);
930+ device_lock(dev);
937931 nvdimm_bus_lock(dev);
938932 } while (true);
939933 }
@@ -1167,7 +1161,7 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm, · 227 unmodified lines
11671161 goto out;
11681162 }
11691163
1170− nd_device_lock(dev);
1164+ device_lock(dev);
11711165 nvdimm_bus_lock(dev);
11721166 rc = nd_cmd_clear_to_send(nvdimm_bus, nvdimm, func, buf);
11731167 if (rc)
@@ -1189,7 +1183,7 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm, · 15 unmodified lines
11891183
11901184 out_unlock:
11911185 nvdimm_bus_unlock(dev);
1192− nd_device_unlock(dev);
1186+ device_unlock(dev);
11931187 out:
11941188 kfree(in_env);
11951189 kfree(out_env);
drivers/nvdimm/core.c+5−5
@@ -215,7 +215,7 @@ EXPORT_SYMBOL_GPL(to_nvdimm_bus_dev); · 214 unmodified lines
215215 *
216216 * Enforce that uuids can only be changed while the device is disabled
217217 * (driver detached)
218− * LOCKING: expects nd_device_lock() is held on entry
218+ * LOCKING: expects device_lock() is held on entry
219219 */
220220 int nd_uuid_store(struct device *dev, uuid_t **uuid_out, const char *buf,
221221 size_t len)
@@ -316,15 +316,15 @@ static DEVICE_ATTR_RO(provider); · 94 unmodified lines
316316
317317 static int flush_namespaces(struct device *dev, void *data)
318318 {
319− nd_device_lock(dev);
320− nd_device_unlock(dev);
319+ device_lock(dev);
320+ device_unlock(dev);
321321 return 0;
322322 }
323323
324324 static int flush_regions_dimms(struct device *dev, void *data)
325325 {
326− nd_device_lock(dev);
327− nd_device_unlock(dev);
326+ device_lock(dev);
327+ device_unlock(dev);
328328 device_for_each_child(dev, NULL, flush_namespaces);
329329 return 0;
330330 }
drivers/nvdimm/dimm_devs.c+4−4
@@ -341,9 +341,9 @@ static ssize_t available_slots_show(struct device *dev, · 340 unmodified lines
341341 {
342342 ssize_t rc;
343343
344− nd_device_lock(dev);
344+ device_lock(dev);
345345 rc = __available_slots_show(dev_get_drvdata(dev), buf);
346− nd_device_unlock(dev);
346+ device_unlock(dev);
347347
348348 return rc;
349349 }
@@ -386,12 +386,12 @@ static ssize_t security_store(struct device *dev, · 36 unmodified lines
386386 * done while probing is idle and the DIMM is not in active use
387387 * in any region.
388388 */
389− nd_device_lock(dev);
389+ device_lock(dev);
390390 nvdimm_bus_lock(dev);
391391 wait_nvdimm_bus_probe_idle(dev);
392392 rc = nvdimm_security_store(dev, buf, len);
393393 nvdimm_bus_unlock(dev);
394− nd_device_unlock(dev);
394+ device_unlock(dev);
395395
396396 return rc;
397397 }
drivers/nvdimm/namespace_devs.c+18−18
@@ -264,7 +264,7 @@ static ssize_t alt_name_store(struct device *dev, · 263 unmodified lines
264264 struct nd_region *nd_region = to_nd_region(dev->parent);
265265 ssize_t rc;
266266
267− nd_device_lock(dev);
267+ device_lock(dev);
268268 nvdimm_bus_lock(dev);
269269 wait_nvdimm_bus_probe_idle(dev);
270270 rc = __alt_name_store(dev, buf, len);
@@ -272,7 +272,7 @@ static ssize_t alt_name_store(struct device *dev, · 1 unmodified line
272272 rc = nd_namespace_label_update(nd_region, dev);
273273 dev_dbg(dev, "%s(%zd)\n", rc < 0 ? "fail " : "", rc);
274274 nvdimm_bus_unlock(dev);
275− nd_device_unlock(dev);
275+ device_unlock(dev);
276276
277277 return rc < 0 ? rc : len;
278278 }
@@ -846,7 +846,7 @@ static ssize_t size_store(struct device *dev, · 567 unmodified lines
846846 if (rc)
847847 return rc;
848848
849− nd_device_lock(dev);
849+ device_lock(dev);
850850 nvdimm_bus_lock(dev);
851851 wait_nvdimm_bus_probe_idle(dev);
852852 rc = __size_store(dev, val);
@@ -868,7 +868,7 @@ static ssize_t size_store(struct device *dev, · 15 unmodified lines
868868 dev_dbg(dev, "%llx %s (%d)\n", val, rc < 0 ? "fail" : "success", rc);
869869
870870 nvdimm_bus_unlock(dev);
871− nd_device_unlock(dev);
871+ device_unlock(dev);
872872
873873 return rc < 0 ? rc : len;
874874 }
@@ -1043,7 +1043,7 @@ static ssize_t uuid_store(struct device *dev, · 168 unmodified lines
10431043 } else
10441044 return -ENXIO;
10451045
1046− nd_device_lock(dev);
1046+ device_lock(dev);
10471047 nvdimm_bus_lock(dev);
10481048 wait_nvdimm_bus_probe_idle(dev);
10491049 if (to_ndns(dev)->claim)
@@ -1059,7 +1059,7 @@ static ssize_t uuid_store(struct device *dev, · 9 unmodified lines
10591059 dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf,
10601060 buf[len - 1] == '\n' ? "" : "\n");
10611061 nvdimm_bus_unlock(dev);
1062− nd_device_unlock(dev);
1062+ device_unlock(dev);
10631063
10641064 return rc < 0 ? rc : len;
10651065 }
@@ -1118,7 +1118,7 @@ static ssize_t sector_size_store(struct device *dev, · 52 unmodified lines
11181118 } else
11191119 return -ENXIO;
11201120
1121− nd_device_lock(dev);
1121+ device_lock(dev);
11221122 nvdimm_bus_lock(dev);
11231123 if (to_ndns(dev)->claim)
11241124 rc = -EBUSY;
@@ -1129,7 +1129,7 @@ static ssize_t sector_size_store(struct device *dev, · 4 unmodified lines
11291129 dev_dbg(dev, "result: %zd %s: %s%s", rc, rc < 0 ? "tried" : "wrote",
11301130 buf, buf[len - 1] == '\n' ? "" : "\n");
11311131 nvdimm_bus_unlock(dev);
1132− nd_device_unlock(dev);
1132+ device_unlock(dev);
11331133
11341134 return rc ? rc : len;
11351135 }
@@ -1239,9 +1239,9 @@ static ssize_t holder_show(struct device *dev, · 103 unmodified lines
12391239 struct nd_namespace_common *ndns = to_ndns(dev);
12401240 ssize_t rc;
12411241
1242− nd_device_lock(dev);
1242+ device_lock(dev);
12431243 rc = sprintf(buf, "%s\n", ndns->claim ? dev_name(ndns->claim) : "");
1244− nd_device_unlock(dev);
1244+ device_unlock(dev);
12451245
12461246 return rc;
12471247 }
@@ -1278,7 +1278,7 @@ static ssize_t holder_class_store(struct device *dev, · 30 unmodified lines
12781278 struct nd_region *nd_region = to_nd_region(dev->parent);
12791279 int rc;
12801280
1281− nd_device_lock(dev);
1281+ device_lock(dev);
12821282 nvdimm_bus_lock(dev);
12831283 wait_nvdimm_bus_probe_idle(dev);
12841284 rc = __holder_class_store(dev, buf);
@@ -1286,7 +1286,7 @@ static ssize_t holder_class_store(struct device *dev, · 1 unmodified line
12861286 rc = nd_namespace_label_update(nd_region, dev);
12871287 dev_dbg(dev, "%s(%d)\n", rc < 0 ? "fail " : "", rc);
12881288 nvdimm_bus_unlock(dev);
1289− nd_device_unlock(dev);
1289+ device_unlock(dev);
12901290
12911291 return rc < 0 ? rc : len;
12921292 }
@@ -1297,7 +1297,7 @@ static ssize_t holder_class_show(struct device *dev, · 4 unmodified lines
12971297 struct nd_namespace_common *ndns = to_ndns(dev);
12981298 ssize_t rc;
12991299
1300− nd_device_lock(dev);
1300+ device_lock(dev);
13011301 if (ndns->claim_class == NVDIMM_CCLASS_NONE)
13021302 rc = sprintf(buf, "\n");
13031303 else if ((ndns->claim_class == NVDIMM_CCLASS_BTT) ||
@@ -1309,7 +1309,7 @@ static ssize_t holder_class_show(struct device *dev, · 5 unmodified lines
13091309 rc = sprintf(buf, "dax\n");
13101310 else
13111311 rc = sprintf(buf, "<unknown>\n");
1312− nd_device_unlock(dev);
1312+ device_unlock(dev);
13131313
13141314 return rc;
13151315 }
@@ -1323,7 +1323,7 @@ static ssize_t mode_show(struct device *dev, · 7 unmodified lines
13231323 char *mode;
13241324 ssize_t rc;
13251325
1326− nd_device_lock(dev);
1326+ device_lock(dev);
13271327 claim = ndns->claim;
13281328 if (claim && is_nd_btt(claim))
13291329 mode = "safe";
@@ -1336,7 +1336,7 @@ static ssize_t mode_show(struct device *dev, · 6 unmodified lines
13361336 else
13371337 mode = "raw";
13381338 rc = sprintf(buf, "%s\n", mode);
1339− nd_device_unlock(dev);
1339+ device_unlock(dev);
13401340
13411341 return rc;
13421342 }
@@ -1456,8 +1456,8 @@ struct nd_namespace_common *nvdimm_namespace_common_probe(struct device *dev) · 113 unmodified lines
14561456 * Flush any in-progess probes / removals in the driver
14571457 * for the raw personality of this namespace.
14581458 */
1459− nd_device_lock(&ndns->dev);
1460− nd_device_unlock(&ndns->dev);
1459+ device_lock(&ndns->dev);
1460+ device_unlock(&ndns->dev);
14611461 if (ndns->dev.driver) {
14621462 dev_dbg(&ndns->dev, "is active, can't bind %s\n",
14631463 dev_name(dev));
drivers/nvdimm/nd-core.h+0−66
@@ -161,70 +161,4 @@ static inline void devm_nsio_disable(struct device *dev, · 160 unmodified lines
161161 {
162162 }
163163 #endif
164−
165−#ifdef CONFIG_PROVE_NVDIMM_LOCKING
166−extern struct class *nd_class;
167−
168−enum {
169− LOCK_BUS,
170− LOCK_NDCTL,
171− LOCK_REGION,
172− LOCK_DIMM = LOCK_REGION,
173− LOCK_NAMESPACE,
174− LOCK_CLAIM,
175−};
176−
177−static inline void debug_nvdimm_lock(struct device *dev)
178−{
179− if (is_nd_region(dev))
180− mutex_lock_nested(&dev->lockdep_mutex, LOCK_REGION);
181− else if (is_nvdimm(dev))
182− mutex_lock_nested(&dev->lockdep_mutex, LOCK_DIMM);
183− else if (is_nd_btt(dev) || is_nd_pfn(dev) || is_nd_dax(dev))
184− mutex_lock_nested(&dev->lockdep_mutex, LOCK_CLAIM);
185− else if (dev->parent && (is_nd_region(dev->parent)))
186− mutex_lock_nested(&dev->lockdep_mutex, LOCK_NAMESPACE);
187− else if (is_nvdimm_bus(dev))
188− mutex_lock_nested(&dev->lockdep_mutex, LOCK_BUS);
189− else if (dev->class && dev->class == nd_class)
190− mutex_lock_nested(&dev->lockdep_mutex, LOCK_NDCTL);
191− else
192− dev_WARN(dev, "unknown lock level\n");
193−}
194−
195−static inline void debug_nvdimm_unlock(struct device *dev)
196−{
197− mutex_unlock(&dev->lockdep_mutex);
198−}
199−
200−static inline void nd_device_lock(struct device *dev)
201−{
202− device_lock(dev);
203− debug_nvdimm_lock(dev);
204−}
205−
206−static inline void nd_device_unlock(struct device *dev)
207−{
208− debug_nvdimm_unlock(dev);
209− device_unlock(dev);
210−}
211−#else
212−static inline void nd_device_lock(struct device *dev)
213−{
214− device_lock(dev);
215−}
216−
217−static inline void nd_device_unlock(struct device *dev)
218−{
219− device_unlock(dev);
220−}
221−
222−static inline void debug_nvdimm_lock(struct device *dev)
223−{
224−}
225−
226−static inline void debug_nvdimm_unlock(struct device *dev)
227−{
228−}
229−#endif
230164 #endif /* __ND_CORE_H__ */
drivers/nvdimm/pfn_devs.c+12−12
@@ -55,7 +55,7 @@ static ssize_t mode_store(struct device *dev, · 54 unmodified lines
5555 struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev);
5656 ssize_t rc = 0;
5757
58− nd_device_lock(dev);
58+ device_lock(dev);
5959 nvdimm_bus_lock(dev);
6060 if (dev->driver)
6161 rc = -EBUSY;
@@ -77,7 +77,7 @@ static ssize_t mode_store(struct device *dev, · 15 unmodified lines
7777 dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf,
7878 buf[len - 1] == '\n' ? "" : "\n");
7979 nvdimm_bus_unlock(dev);
80− nd_device_unlock(dev);
80+ device_unlock(dev);
8181
8282 return rc ? rc : len;
8383 }
@@ -123,14 +123,14 @@ static ssize_t align_store(struct device *dev, · 39 unmodified lines
123123 unsigned long aligns[MAX_NVDIMM_ALIGN] = { [0] = 0, };
124124 ssize_t rc;
125125
126− nd_device_lock(dev);
126+ device_lock(dev);
127127 nvdimm_bus_lock(dev);
128128 rc = nd_size_select_store(dev, buf, &nd_pfn->align,
129129 nd_pfn_supported_alignments(aligns));
130130 dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf,
131131 buf[len - 1] == '\n' ? "" : "\n");
132132 nvdimm_bus_unlock(dev);
133− nd_device_unlock(dev);
133+ device_unlock(dev);
134134
135135 return rc ? rc : len;
136136 }
@@ -152,11 +152,11 @@ static ssize_t uuid_store(struct device *dev, · 15 unmodified lines
152152 struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev);
153153 ssize_t rc;
154154
155− nd_device_lock(dev);
155+ device_lock(dev);
156156 rc = nd_uuid_store(dev, &nd_pfn->uuid, buf, len);
157157 dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf,
158158 buf[len - 1] == '\n' ? "" : "\n");
159− nd_device_unlock(dev);
159+ device_unlock(dev);
160160
161161 return rc ? rc : len;
162162 }
@@ -181,13 +181,13 @@ static ssize_t namespace_store(struct device *dev, · 18 unmodified lines
181181 struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev);
182182 ssize_t rc;
183183
184− nd_device_lock(dev);
184+ device_lock(dev);
185185 nvdimm_bus_lock(dev);
186186 rc = nd_namespace_store(dev, &nd_pfn->ndns, buf, len);
187187 dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf,
188188 buf[len - 1] == '\n' ? "" : "\n");
189189 nvdimm_bus_unlock(dev);
190− nd_device_unlock(dev);
190+ device_unlock(dev);
191191
192192 return rc;
193193 }
@@ -199,7 +199,7 @@ static ssize_t resource_show(struct device *dev, · 5 unmodified lines
199199 struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev);
200200 ssize_t rc;
201201
202− nd_device_lock(dev);
202+ device_lock(dev);
203203 if (dev->driver) {
204204 struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb;
205205 u64 offset = __le64_to_cpu(pfn_sb->dataoff);
@@ -213,7 +213,7 @@ static ssize_t resource_show(struct device *dev, · 7 unmodified lines
213213 /* no address to convey if the pfn instance is disabled */
214214 rc = -ENXIO;
215215 }
216− nd_device_unlock(dev);
216+ device_unlock(dev);
217217
218218 return rc;
219219 }
@@ -225,7 +225,7 @@ static ssize_t size_show(struct device *dev, · 5 unmodified lines
225225 struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev);
226226 ssize_t rc;
227227
228− nd_device_lock(dev);
228+ device_lock(dev);
229229 if (dev->driver) {
230230 struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb;
231231 u64 offset = __le64_to_cpu(pfn_sb->dataoff);
@@ -241,7 +241,7 @@ static ssize_t size_show(struct device *dev, · 9 unmodified lines
241241 /* no size to convey if the pfn instance is disabled */
242242 rc = -ENXIO;
243243 }
244− nd_device_unlock(dev);
244+ device_unlock(dev);
245245
246246 return rc;
247247 }
drivers/nvdimm/pmem.c+1−1
@@ -573,7 +573,7 @@ static void nd_pmem_remove(struct device *dev) · 572 unmodified lines
573573 nvdimm_namespace_detach_btt(to_nd_btt(dev));
574574 else {
575575 /*
576− * Note, this assumes nd_device_lock() context to not
576+ * Note, this assumes device_lock() context to not
577577 * race nd_pmem_notify()
578578 */
579579 sysfs_put(pmem->bb_state);
drivers/nvdimm/region.c+1−1
@@ -95,7 +95,7 @@ static void nd_region_remove(struct device *dev) · 94 unmodified lines
9595 nvdimm_bus_unlock(dev);
9696
9797 /*
98− * Note, this assumes nd_device_lock() context to not race
98+ * Note, this assumes device_lock() context to not race
9999 * nd_region_notify()
100100 */
101101 sysfs_put(nd_region->bb_state);
drivers/nvdimm/region_devs.c+8−8
@@ -279,7 +279,7 @@ static ssize_t set_cookie_show(struct device *dev, · 278 unmodified lines
279279 * the v1.1 namespace label cookie definition. To read all this
280280 * data we need to wait for probing to settle.
281281 */
282− nd_device_lock(dev);
282+ device_lock(dev);
283283 nvdimm_bus_lock(dev);
284284 wait_nvdimm_bus_probe_idle(dev);
285285 if (nd_region->ndr_mappings) {
@@ -296,7 +296,7 @@ static ssize_t set_cookie_show(struct device *dev, · 10 unmodified lines
296296 }
297297 }
298298 nvdimm_bus_unlock(dev);
299− nd_device_unlock(dev);
299+ device_unlock(dev);
300300
301301 if (rc)
302302 return rc;
@@ -353,12 +353,12 @@ static ssize_t available_size_show(struct device *dev, · 50 unmodified lines
353353 * memory nvdimm_bus_lock() is dropped, but that's userspace's
354354 * problem to not race itself.
355355 */
356− nd_device_lock(dev);
356+ device_lock(dev);
357357 nvdimm_bus_lock(dev);
358358 wait_nvdimm_bus_probe_idle(dev);
359359 available = nd_region_available_dpa(nd_region);
360360 nvdimm_bus_unlock(dev);
361− nd_device_unlock(dev);
361+ device_unlock(dev);
362362
363363 return sprintf(buf, "%llu\n", available);
364364 }
@@ -370,12 +370,12 @@ static ssize_t max_available_extent_show(struct device *dev, · 5 unmodified lines
370370 struct nd_region *nd_region = to_nd_region(dev);
371371 unsigned long long available = 0;
372372
373− nd_device_lock(dev);
373+ device_lock(dev);
374374 nvdimm_bus_lock(dev);
375375 wait_nvdimm_bus_probe_idle(dev);
376376 available = nd_region_allocatable_dpa(nd_region);
377377 nvdimm_bus_unlock(dev);
378− nd_device_unlock(dev);
378+ device_unlock(dev);
379379
380380 return sprintf(buf, "%llu\n", available);
381381 }
@@ -549,12 +549,12 @@ static ssize_t region_badblocks_show(struct device *dev, · 167 unmodified lines
549549 struct nd_region *nd_region = to_nd_region(dev);
550550 ssize_t rc;
551551
552− nd_device_lock(dev);
552+ device_lock(dev);
553553 if (dev->driver)
554554 rc = badblocks_show(&nd_region->bb, buf, 0);
555555 else
556556 rc = -ENXIO;
557− nd_device_unlock(dev);
557+ device_unlock(dev);
558558
559559 return rc;
560560 }
lib/Kconfig.debug+0−17
@@ -1544,23 +1544,6 @@ config CSD_LOCK_WAIT_DEBUG · 1543 unmodified lines
15441544 include the IPI handler function currently executing (if any)
15451545 and relevant stack traces.
15461546
1547−choice
1548− prompt "Lock debugging: prove subsystem device_lock() correctness"
1549− depends on PROVE_LOCKING
1550− help
1551− For subsystems that have instrumented their usage of the device_lock()
1552− with nested annotations, enable lock dependency checking. The locking
1553− hierarchy 'subclass' identifiers are not compatible across
1554− sub-systems, so only one can be enabled at a time.
1555−
1556−config PROVE_NVDIMM_LOCKING
1557− bool "NVDIMM"
1558− depends on LIBNVDIMM
1559− help
1560− Enable lockdep to validate nd_device_lock() usage.
1561−
1562−endchoice
1563−
15641547 endmenu # lock debugging
15651548
15661549 config TRACE_IRQFLAGS