int mxr_power_get(struct mxr_device *mdev)
{
	/* If runtime PM is not implemented, mxr_runtime_resume
	 * function is directly called.
	 */
#ifdef CONFIG_PM_RUNTIME
	int ret = pm_runtime_get_sync(mdev->dev);
	/* returning 1 means that power is already enabled,
	 * so zero success be returned */
	if (IS_ERR_VALUE(ret))
		return ret;
	return 0;
#else
	mxr_runtime_resume(mdev->dev);
	return 0;
#endif
}
예제 #2
0
int mxr_power_get(struct mxr_device *mdev)
{
	int ret = 0;

	++mdev->n_power;
	mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_power);
	/* If runtime PM is not implemented, mxr_runtime_resume
	 * function is directly called.
	 */
	if (mdev->n_power == 1) {
#ifdef CONFIG_PM_RUNTIME
		ret = pm_runtime_get_sync(mdev->dev);
#else
		mxr_runtime_resume(mdev->dev);
#endif
	}
	return ret;
}