linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpufreq: mt8173: use list_for_each_entry*()
@ 2016-04-05  2:38 Geliang Tang
  2016-04-05  3:05 ` Viresh Kumar
  0 siblings, 1 reply; 3+ messages in thread
From: Geliang Tang @ 2016-04-05  2:38 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar; +Cc: Geliang Tang, linux-pm, linux-kernel

Use list_for_each_entry*() instead of list_for_each*() to simplify
the code.

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 drivers/cpufreq/mt8173-cpufreq.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/cpufreq/mt8173-cpufreq.c b/drivers/cpufreq/mt8173-cpufreq.c
index 2058e6d..6f602c7 100644
--- a/drivers/cpufreq/mt8173-cpufreq.c
+++ b/drivers/cpufreq/mt8173-cpufreq.c
@@ -59,11 +59,8 @@ static LIST_HEAD(dvfs_info_list);
 static struct mtk_cpu_dvfs_info *mtk_cpu_dvfs_info_lookup(int cpu)
 {
 	struct mtk_cpu_dvfs_info *info;
-	struct list_head *list;
-
-	list_for_each(list, &dvfs_info_list) {
-		info = list_entry(list, struct mtk_cpu_dvfs_info, list_head);
 
+	list_for_each_entry(info, &dvfs_info_list, list_head) {
 		if (cpumask_test_cpu(cpu, &info->cpus))
 			return info;
 	}
@@ -524,8 +521,7 @@ static struct cpufreq_driver mt8173_cpufreq_driver = {
 
 static int mt8173_cpufreq_probe(struct platform_device *pdev)
 {
-	struct mtk_cpu_dvfs_info *info;
-	struct list_head *list, *tmp;
+	struct mtk_cpu_dvfs_info *info, *tmp;
 	int cpu, ret;
 
 	for_each_possible_cpu(cpu) {
@@ -559,11 +555,9 @@ static int mt8173_cpufreq_probe(struct platform_device *pdev)
 	return 0;
 
 release_dvfs_info_list:
-	list_for_each_safe(list, tmp, &dvfs_info_list) {
-		info = list_entry(list, struct mtk_cpu_dvfs_info, list_head);
-
+	list_for_each_entry_safe(info, tmp, &dvfs_info_list, list_head) {
 		mtk_cpu_dvfs_info_release(info);
-		list_del(list);
+		list_del(&info->list_head);
 	}
 
 	return ret;
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpufreq: mt8173: use list_for_each_entry*()
  2016-04-05  2:38 [PATCH] cpufreq: mt8173: use list_for_each_entry*() Geliang Tang
@ 2016-04-05  3:05 ` Viresh Kumar
  2016-04-22  0:41   ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Viresh Kumar @ 2016-04-05  3:05 UTC (permalink / raw)
  To: Geliang Tang; +Cc: Rafael J. Wysocki, linux-pm, linux-kernel

On 05-04-16, 10:38, Geliang Tang wrote:
> Use list_for_each_entry*() instead of list_for_each*() to simplify
> the code.
> 
> Signed-off-by: Geliang Tang <geliangtang@163.com>
> ---
>  drivers/cpufreq/mt8173-cpufreq.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpufreq: mt8173: use list_for_each_entry*()
  2016-04-05  3:05 ` Viresh Kumar
@ 2016-04-22  0:41   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2016-04-22  0:41 UTC (permalink / raw)
  To: Viresh Kumar, Geliang Tang; +Cc: linux-pm, linux-kernel

On Tuesday, April 05, 2016 08:35:57 AM Viresh Kumar wrote:
> On 05-04-16, 10:38, Geliang Tang wrote:
> > Use list_for_each_entry*() instead of list_for_each*() to simplify
> > the code.
> > 
> > Signed-off-by: Geliang Tang <geliangtang@163.com>
> > ---
> >  drivers/cpufreq/mt8173-cpufreq.c | 14 ++++----------
> >  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Applied, thanks!


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-22  0:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-05  2:38 [PATCH] cpufreq: mt8173: use list_for_each_entry*() Geliang Tang
2016-04-05  3:05 ` Viresh Kumar
2016-04-22  0:41   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).