lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <2345f33fd6215a0754a71b4dc1ca02f8ff874211.1376486713.git.viresh.kumar@linaro.org>
Date:	Wed, 14 Aug 2013 19:01:50 +0530
From:	Viresh Kumar <viresh.kumar@...aro.org>
To:	rjw@...k.pl
Cc:	linaro-kernel@...ts.linaro.org, patches@...aro.org,
	cpufreq@...r.kernel.org, linux-pm@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Viresh Kumar <viresh.kumar@...aro.org>,
	Andrew Lunn <andrew@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
	Eric Miao <eric.y.miao@...il.com>,
	Hans-Christian Egtvedt <egtvedt@...fundet.no>,
	Jesper Nilsson <jesper.nilsson@...s.com>,
	John Crispin <blogic@...nwrt.org>,
	Kukjin Kim <kgene.kim@...sung.com>,
	Linus Walleij <linus.walleij@...aro.org>,
	linux-cris-kernel@...s.com, linux-sh@...r.kernel.org,
	Mikael Starvik <starvik@...s.com>,
	Paul Mundt <lethal@...ux-sh.org>,
	Russell King <linux@....linux.org.uk>,
	Santosh Shilimkar <santosh.shilimkar@...com>,
	Sekhar Nori <nsekhar@...com>, Shawn Guo <shawn.guo@...aro.org>,
	spear-devel@...t.st.com, Stephen Warren <swarren@...dia.com>,
	Steven Miao <realmz6@...il.com>,
	Tony Luck <tony.luck@...el.com>
Subject: [PATCH 01/37] cpufreq: call cpufreq_driver->get() after calling ->init()

Almost all drivers set policy->cur with current cpu frequency in their ->init()
part. This can be done for all of them at core level and so they wouldn't need
to do it.

This patch adds supporting code in cpufreq core for calling get() after we have
called init() for a policy.

Cc: Andrew Lunn <andrew@...n.ch>
Cc: David S. Miller <davem@...emloft.net>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@...il.com>
Cc: Eric Miao <eric.y.miao@...il.com>
Cc: Hans-Christian Egtvedt <egtvedt@...fundet.no>
Cc: Jesper Nilsson <jesper.nilsson@...s.com>
Cc: John Crispin <blogic@...nwrt.org>
Cc: Kukjin Kim <kgene.kim@...sung.com>
Cc: Linus Walleij <linus.walleij@...aro.org>
Cc: linux-cris-kernel@...s.com
Cc: linux-sh@...r.kernel.org
Cc: Mikael Starvik <starvik@...s.com>
Cc: Paul Mundt <lethal@...ux-sh.org>
Cc: Russell King <linux@....linux.org.uk>
Cc: Santosh Shilimkar <santosh.shilimkar@...com>
Cc: Sekhar Nori <nsekhar@...com>
Cc: Shawn Guo <shawn.guo@...aro.org>
Cc: spear-devel@...t.st.com
Cc: Stephen Warren <swarren@...dia.com>
Cc: Steven Miao <realmz6@...il.com>
Cc: Tony Luck <tony.luck@...el.com>
Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
---
 drivers/cpufreq/cpufreq.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 4d37306..a7a1d3e 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1038,6 +1038,14 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
 		goto err_set_policy_cpu;
 	}
 
+	if (cpufreq_driver->get) {
+		policy->cur = cpufreq_driver->get(policy->cpu);
+		if (!policy->cur) {
+			pr_err("%s: ->get() failed\n", __func__);
+			goto err_get_freq;
+		}
+	}
+
 	/* related cpus should atleast have policy->cpus */
 	cpumask_or(policy->related_cpus, policy->related_cpus, policy->cpus);
 
@@ -1097,6 +1105,9 @@ err_out_unregister:
 	}
 	write_unlock_irqrestore(&cpufreq_driver_lock, flags);
 
+err_get_freq:
+	if (cpufreq_driver->exit)
+		cpufreq_driver->exit(policy);
 err_set_policy_cpu:
 	per_cpu(cpufreq_policy_cpu, cpu) = -1;
 	cpufreq_policy_free(policy);
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ