Unverified Commit a548f864 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files
parents cb78e025 104955a0
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -381,8 +381,13 @@ static void devfreq_monitor(struct work_struct *work)
	if (err)
		dev_err(&devfreq->dev, "dvfs failed with (%d) error\n", err);

	if (devfreq->stop_polling)
		goto out;

	queue_delayed_work(devfreq_wq, &devfreq->work,
				msecs_to_jiffies(devfreq->profile->polling_ms));

out:
	mutex_unlock(&devfreq->lock);
}

@@ -397,10 +402,18 @@ static void devfreq_monitor(struct work_struct *work)
 */
void devfreq_monitor_start(struct devfreq *devfreq)
{
	mutex_lock(&devfreq->lock);
	if (delayed_work_pending(&devfreq->work))
		goto out;

	INIT_DEFERRABLE_WORK(&devfreq->work, devfreq_monitor);
	if (devfreq->profile->polling_ms)
		queue_delayed_work(devfreq_wq, &devfreq->work,
			msecs_to_jiffies(devfreq->profile->polling_ms));

out:
	devfreq->stop_polling = false;
	mutex_unlock(&devfreq->lock);
}
EXPORT_SYMBOL(devfreq_monitor_start);

@@ -414,6 +427,14 @@ EXPORT_SYMBOL(devfreq_monitor_start);
 */
void devfreq_monitor_stop(struct devfreq *devfreq)
{
	mutex_lock(&devfreq->lock);
	if (devfreq->stop_polling) {
		mutex_unlock(&devfreq->lock);
		return;
	}

	devfreq->stop_polling = true;
	mutex_unlock(&devfreq->lock);
	cancel_delayed_work_sync(&devfreq->work);
}
EXPORT_SYMBOL(devfreq_monitor_stop);