@@ -4465,6 +4465,14 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev,
if (ret)
goto out_release_instance;
+ /*
+ * Initialize latency tolerance controls. The sysfs files won't
+ * be visible to userspace unless the device actually supports APST.
+ */
+ ctrl->device->power.set_latency_tolerance = nvme_set_latency_tolerance;
+ dev_pm_qos_update_user_latency_tolerance(ctrl->device,
+ min(default_ps_max_latency_us, (unsigned long)S32_MAX));
+
nvme_fault_inject_init(&ctrl->fault_inject, dev_name(ctrl->device));
nvme_mpath_init_ctrl(ctrl);
nvme_get_ctrl(ctrl);
@@ -4474,14 +4482,6 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev,
if (ret)
goto out_free_name;
- /*
- * Initialize latency tolerance controls. The sysfs files won't
- * be visible to userspace unless the device actually supports APST.
- */
- ctrl->device->power.set_latency_tolerance = nvme_set_latency_tolerance;
- dev_pm_qos_update_user_latency_tolerance(ctrl->device,
- min(default_ps_max_latency_us, (unsigned long)S32_MAX));
-
return 0;
out_free_name:
In order to avoid any initialization after cdev_device_add() move dev pm qos latency tolerance before cdev_device_add(). Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com> --- drivers/nvme/host/core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)