File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -266,14 +266,24 @@ static void cxl_nvb_update_state(struct work_struct *work)
266
266
put_device (& cxl_nvb -> dev );
267
267
}
268
268
269
+ static void cxl_nvdimm_bridge_state_work (struct cxl_nvdimm_bridge * cxl_nvb )
270
+ {
271
+ /*
272
+ * Take a reference that the workqueue will drop if new work
273
+ * gets queued.
274
+ */
275
+ get_device (& cxl_nvb -> dev );
276
+ if (!queue_work (cxl_pmem_wq , & cxl_nvb -> state_work ))
277
+ put_device (& cxl_nvb -> dev );
278
+ }
279
+
269
280
static void cxl_nvdimm_bridge_remove (struct device * dev )
270
281
{
271
282
struct cxl_nvdimm_bridge * cxl_nvb = to_cxl_nvdimm_bridge (dev );
272
283
273
284
if (cxl_nvb -> state == CXL_NVB_ONLINE )
274
285
cxl_nvb -> state = CXL_NVB_OFFLINE ;
275
- if (queue_work (cxl_pmem_wq , & cxl_nvb -> state_work ))
276
- get_device (& cxl_nvb -> dev );
286
+ cxl_nvdimm_bridge_state_work (cxl_nvb );
277
287
}
278
288
279
289
static int cxl_nvdimm_bridge_probe (struct device * dev )
@@ -294,8 +304,7 @@ static int cxl_nvdimm_bridge_probe(struct device *dev)
294
304
}
295
305
296
306
cxl_nvb -> state = CXL_NVB_ONLINE ;
297
- if (queue_work (cxl_pmem_wq , & cxl_nvb -> state_work ))
298
- get_device (& cxl_nvb -> dev );
307
+ cxl_nvdimm_bridge_state_work (cxl_nvb );
299
308
300
309
return 0 ;
301
310
}
You can’t perform that action at this time.
0 commit comments