提交 10b9d3f8 编写于 作者: D Daniel Lezcano 提交者: Rafael J. Wysocki

cpuidle: Check cpuidle_enable_device() return value

We previously changed the ordering of the cpuidle framework
initialization so that the governors are registered before the
drivers which can register their devices right from the start.

Now, we can safely remove the __cpuidle_register_device() call hack
in cpuidle_enable_device() and check if the driver has been
registered before enabling it.  Then, cpuidle_register_device() can
consistently check the cpuidle_enable_device() return value when
enabling the device.

[rjw: Changelog]
Signed-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 137b944e
......@@ -292,15 +292,12 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
if (!drv || !cpuidle_curr_governor)
return -EIO;
if (!dev->registered)
return -EINVAL;
if (!dev->state_count)
dev->state_count = drv->state_count;
if (dev->registered == 0) {
ret = __cpuidle_register_device(dev);
if (ret)
return ret;
}
poll_idle_init(drv);
ret = cpuidle_add_device_sysfs(dev);
......@@ -415,13 +412,17 @@ int cpuidle_register_device(struct cpuidle_device *dev)
return ret;
}
cpuidle_enable_device(dev);
ret = cpuidle_enable_device(dev);
if (ret) {
mutex_unlock(&cpuidle_lock);
return ret;
}
cpuidle_install_idle_handler();
mutex_unlock(&cpuidle_lock);
return 0;
}
EXPORT_SYMBOL_GPL(cpuidle_register_device);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册