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: <201207162331.00295.rjw@sisk.pl>
Date:	Mon, 16 Jul 2012 23:30:59 +0200
From:	"Rafael J. Wysocki" <rjw@...k.pl>
To:	Linux PM list <linux-pm@...r.kernel.org>
Cc:	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Matthew Garrett <mjg59@...f.ucam.org>,
	Magnus Damm <magnus.damm@...il.com>,
	Arnd Bergmann <arnd@...db.de>,
	Grant Likely <grant.likely@...retlab.ca>,
	"Linux-sh list" <linux-sh@...r.kernel.org>
Subject: [RFC][PATCH 13/14] PM / Domains: Introduce pm_genpd_present()

From: Rafael J. Wysocki <rjw@...k.pl>

Introduce function pm_genpd_present() allowing the caller to check if
the given generic PM domain has been initialized.

Signed-off-by: Rafael J. Wysocki <rjw@...k.pl>
---
 drivers/base/power/domain.c |   22 ++++++++++++++++++++++
 include/linux/pm_domain.h   |    5 +++++
 2 files changed, 27 insertions(+)

Index: linux/drivers/base/power/domain.c
===================================================================
--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -2089,3 +2089,25 @@ void pm_genpd_init(struct generic_pm_dom
 	list_add(&genpd->gpd_list_node, &gpd_list);
 	mutex_unlock(&gpd_list_lock);
 }
+
+/**
+ * pm_genpd_present - Check if the given PM domain has been initialized
+ * @genpd: PM domain to check.
+ */
+bool pm_genpd_present(struct generic_pm_domain *genpd)
+{
+	struct generic_pm_domain *gpd = NULL;
+
+	if (IS_ERR_OR_NULL(genpd))
+		return false;
+
+	mutex_lock(&gpd_list_lock);
+
+	list_for_each_entry(gpd, &gpd_list, gpd_list_node)
+		if (gpd == genpd)
+			break;
+
+	mutex_unlock(&gpd_list_lock);
+
+	return gpd == genpd;
+}
Index: linux/include/linux/pm_domain.h
===================================================================
--- linux.orig/include/linux/pm_domain.h
+++ linux/include/linux/pm_domain.h
@@ -161,6 +161,7 @@ extern int genpd_attach_cpuidle(struct g
 extern int genpd_detach_cpuidle(struct generic_pm_domain *genpd);
 extern void pm_genpd_init(struct generic_pm_domain *genpd,
 			  struct dev_power_governor *gov, bool is_off);
+extern bool pm_genpd_present(struct generic_pm_domain *genpd);
 
 extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
 extern int pm_genpd_name_poweron(const char *domain_name);
@@ -239,6 +240,10 @@ static inline void pm_genpd_init(struct
 				 struct dev_power_governor *gov, bool is_off)
 {
 }
+static inline bool pm_genpd_present(struct generic_pm_domain *genpd)
+{
+	return false;
+}
 static inline int pm_genpd_poweron(struct generic_pm_domain *genpd)
 {
 	return -ENOSYS;

--
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