All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Luba <l.luba@partner.samsung.com>
To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Cc: b.zolnierkie@samsung.com, myungjoo.ham@samsung.com,
	cw00.choi@samsung.com, kyungmin.park@samsung.com,
	m.szyprowski@samsung.com, s.nawrocki@samsung.com,
	tkjos@google.com, joel@joelfernandes.org, chris.diamand@arm.com,
	mka@chromium.org, rostedt@goodmis.org, mingo@redhat.com,
	Lukasz Luba <l.luba@partner.samsung.com>
Subject: [PATCH v3 2/7] drivers: devfreq: change devfreq workqueue mechanism
Date: Tue, 12 Feb 2019 23:23:53 +0100	[thread overview]
Message-ID: <1550010238-24002-3-git-send-email-l.luba@partner.samsung.com> (raw)
In-Reply-To: <1550010238-24002-1-git-send-email-l.luba@partner.samsung.com>

There is no need for creating another workqueue in the system,
the existing one should meet the requirements.
This patch removes devfreq's custom workqueue and uses system one.
It switches from queue_delayed_work() to schedule_delayed_work().
It also does not wake up the system when it enters suspend (this
functionality stays the same).

Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
---
 drivers/devfreq/devfreq.c | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 0c9bff8..c200b3c 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -31,13 +31,6 @@
 
 static struct class *devfreq_class;
 
-/*
- * devfreq core provides delayed work based load monitoring helper
- * functions. Governors can use these or can implement their own
- * monitoring mechanism.
- */
-static struct workqueue_struct *devfreq_wq;
-
 /* The list of all device-devfreq governors */
 static LIST_HEAD(devfreq_governor_list);
 /* The list of all device-devfreq */
@@ -391,8 +384,8 @@ static void devfreq_monitor(struct work_struct *work)
 	if (err)
 		dev_err(&devfreq->dev, "dvfs failed with (%d) error\n", err);
 
-	queue_delayed_work(devfreq_wq, &devfreq->work,
-				msecs_to_jiffies(devfreq->profile->polling_ms));
+	schedule_delayed_work(&devfreq->work,
+			      msecs_to_jiffies(devfreq->profile->polling_ms));
 	mutex_unlock(&devfreq->lock);
 }
 
@@ -409,7 +402,7 @@ void devfreq_monitor_start(struct devfreq *devfreq)
 {
 	INIT_DELAYED_WORK(&devfreq->work, devfreq_monitor);
 	if (devfreq->profile->polling_ms)
-		queue_delayed_work(devfreq_wq, &devfreq->work,
+		schedule_delayed_work(&devfreq->work,
 			msecs_to_jiffies(devfreq->profile->polling_ms));
 }
 EXPORT_SYMBOL(devfreq_monitor_start);
@@ -473,7 +466,7 @@ void devfreq_monitor_resume(struct devfreq *devfreq)
 
 	if (!delayed_work_pending(&devfreq->work) &&
 			devfreq->profile->polling_ms)
-		queue_delayed_work(devfreq_wq, &devfreq->work,
+		schedule_delayed_work(&devfreq->work,
 			msecs_to_jiffies(devfreq->profile->polling_ms));
 
 	devfreq->last_stat_updated = jiffies;
@@ -516,7 +509,7 @@ void devfreq_interval_update(struct devfreq *devfreq, unsigned int *delay)
 
 	/* if current delay is zero, start polling with new delay */
 	if (!cur_delay) {
-		queue_delayed_work(devfreq_wq, &devfreq->work,
+		schedule_delayed_work(&devfreq->work,
 			msecs_to_jiffies(devfreq->profile->polling_ms));
 		goto out;
 	}
@@ -527,7 +520,7 @@ void devfreq_interval_update(struct devfreq *devfreq, unsigned int *delay)
 		cancel_delayed_work_sync(&devfreq->work);
 		mutex_lock(&devfreq->lock);
 		if (!devfreq->stop_polling)
-			queue_delayed_work(devfreq_wq, &devfreq->work,
+			schedule_delayed_work(&devfreq->work,
 			      msecs_to_jiffies(devfreq->profile->polling_ms));
 	}
 out:
@@ -1430,12 +1423,6 @@ static int __init devfreq_init(void)
 		return PTR_ERR(devfreq_class);
 	}
 
-	devfreq_wq = create_freezable_workqueue("devfreq_wq");
-	if (!devfreq_wq) {
-		class_destroy(devfreq_class);
-		pr_err("%s: couldn't create workqueue\n", __FILE__);
-		return -ENOMEM;
-	}
 	devfreq_class->dev_groups = devfreq_groups;
 
 	return 0;
-- 
2.7.4


  parent reply	other threads:[~2019-02-12 22:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190212222422eucas1p1624203db4db3e495035820dea542e23a@eucas1p1.samsung.com>
2019-02-12 22:23 ` [PATCH v3 0/7] drivers: devfreq: fix and optimize workqueue mechanism Lukasz Luba
     [not found]   ` <CGME20190212222430eucas1p1ad7992e29d224790c1e20ef7442e62fe@eucas1p1.samsung.com>
2019-02-12 22:23     ` [PATCH v3 1/7] drivers: devfreq: change deferred work into delayed Lukasz Luba
2019-02-14  4:10       ` Chanwoo Choi
     [not found]   ` <CGME20190212222431eucas1p1697607e6536a90283cf7dad37fa74dbb@eucas1p1.samsung.com>
2019-02-12 22:23     ` Lukasz Luba [this message]
2019-02-14  4:11       ` [PATCH v3 2/7] drivers: devfreq: change devfreq workqueue mechanism Chanwoo Choi
     [not found]   ` <CGME20190212222433eucas1p264602d67a916c644c7eb5012932fc17a@eucas1p2.samsung.com>
2019-02-12 22:23     ` [PATCH v3 3/7] Kconfig: drivers: devfreq: add default idle polling Lukasz Luba
     [not found]   ` <CGME20190212222434eucas1p134dcdce827df19704c698fd6452b0a06@eucas1p1.samsung.com>
2019-02-12 22:23     ` [PATCH v3 4/7] include: devfreq: add polling_idle_ms to 'profile' Lukasz Luba
2019-02-14  4:51       ` Chanwoo Choi
     [not found]   ` <CGME20190212222436eucas1p21eebc80796406787a2ebf9a84ee5b868@eucas1p2.samsung.com>
2019-02-12 22:23     ` [PATCH v3 5/7] drivers: devfreq: add longer polling interval in idle Lukasz Luba
     [not found]   ` <CGME20190212222437eucas1p198db6fca1f1ba3056d93c57327dd48ed@eucas1p1.samsung.com>
2019-02-12 22:23     ` [PATCH v3 6/7] trace: events: add devfreq trace event file Lukasz Luba
2019-02-12 23:14       ` Steven Rostedt
2019-02-13 13:35         ` Lukasz Luba
2019-02-14  5:01           ` Chanwoo Choi
2019-02-13 13:56       ` Steven Rostedt
2019-02-13 14:37         ` Lukasz Luba
     [not found]   ` <CGME20190212222438eucas1p27e020c2b36f2e5a2188e4df6fb18488b@eucas1p2.samsung.com>
2019-02-12 22:23     ` [PATCH v3 7/7] drivers: devfreq: add tracing for scheduling work Lukasz Luba
2019-02-14  4:57       ` Chanwoo Choi
2019-02-13  0:18   ` [PATCH v3 0/7] drivers: devfreq: fix and optimize workqueue mechanism Chanwoo Choi
2019-02-13 11:14     ` Lukasz Luba
2019-02-13 14:52       ` Lukasz Luba
2019-02-14  0:41       ` Chanwoo Choi
     [not found]   ` <CGME20190212222436eucas1p21eebc80796406787a2ebf9a84ee5b868@epcms1p3>
2019-02-18  4:33     ` [PATCH v3 5/7] drivers: devfreq: add longer polling interval in idle MyungJoo Ham
2019-02-19  8:33       ` Lukasz Luba
     [not found]       ` <CGME20190212222436eucas1p21eebc80796406787a2ebf9a84ee5b868@epcms1p7>
2019-02-21  5:56         ` MyungJoo Ham
2019-02-22 16:03           ` Lukasz Luba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1550010238-24002-3-git-send-email-l.luba@partner.samsung.com \
    --to=l.luba@partner.samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=chris.diamand@arm.com \
    --cc=cw00.choi@samsung.com \
    --cc=joel@joelfernandes.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mingo@redhat.com \
    --cc=mka@chromium.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=rostedt@goodmis.org \
    --cc=s.nawrocki@samsung.com \
    --cc=tkjos@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.