@@ -343,6 +343,7 @@ struct cxl_memdev *devm_cxl_add_memdev(struct cxl_dev_state *cxlds)
cxlmd->cxlds = cxlds;
cdev = &cxlmd->cdev;
+ cxl_set_lock_class(dev);
rc = cdev_device_add(cdev, dev);
if (rc)
goto err;
@@ -165,6 +165,7 @@ struct cxl_nvdimm_bridge *devm_cxl_add_nvdimm_bridge(struct device *host,
if (rc)
goto err;
+ cxl_set_lock_class(dev);
rc = device_add(dev);
if (rc)
goto err;
@@ -261,6 +262,7 @@ int devm_cxl_add_nvdimm(struct device *host, struct cxl_memdev *cxlmd)
if (rc)
goto err;
+ cxl_set_lock_class(dev);
rc = device_add(dev);
if (rc)
goto err;
@@ -469,6 +469,7 @@ struct cxl_port *devm_cxl_add_port(struct device *host, struct device *uport,
if (rc)
goto err;
+ cxl_set_lock_class(dev);
rc = device_add(dev);
if (rc)
goto err;
@@ -1349,6 +1350,7 @@ int cxl_decoder_add_locked(struct cxl_decoder *cxld, int *target_map)
if (is_root_decoder(dev))
cxld->platform_res.name = dev_name(dev);
+ cxl_set_lock_class(dev);
return device_add(dev);
}
EXPORT_SYMBOL_NS_GPL(cxl_decoder_add_locked, CXL);
@@ -456,5 +456,14 @@ static inline int cxl_lock_class(struct device *dev)
else
return CXL_ANON_LOCK;
}
+
+static inline void cxl_set_lock_class(struct device *dev)
+{
+ device_set_lock_class(dev, cxl_lock_class(dev));
+}
+#else
+static inline void cxl_set_lock_class(struct device *dev)
+{
+}
#endif
#endif /* __CXL_H__ */