devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 01/10] of: Rename "poweroff-source" property to "system-power-controller"
@ 2014-10-27 16:26 Romain Perier
  2014-10-27 16:26 ` [PATCH v1 02/10] dt-bindings: Document the standard property "system-power-controller" Romain Perier
                   ` (10 more replies)
  0 siblings, 11 replies; 36+ messages in thread
From: Romain Perier @ 2014-10-27 16:26 UTC (permalink / raw)
  To: heiko
  Cc: devicetree, broonie, lgirdwood, linux-kernel, grant.likely, robh,
	mark.rutland, johan, linux-pm, linux, lee.jones, balbi, robh+dt,
	pawel.moll, ijc+devicetree, galak, linux, swarren, thierry.reding,
	gnurou, linux-arm-kernel, linux-tegra

As discussed on the mailing list, it makes more sense to rename this property
to "system-power-controller". Problem being that the word "source" usually tends
to be used for inputs and that is out of control of the OS. The poweroff
capability is an output which simply turns the system-power off. Also, this
property might be used by drivers which power-off the system and power back on
subsequent RTC alarms. This seems to suggest to remove "poweroff" from the
property name and to choose "system-power-controller" as the more generic name.
This patchs adds the required renaming changes and defines an helper function
which is compatible with both properties, the old one prefixed by a vendor name
and the new one without any prefix.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
---
 include/linux/of.h | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/include/linux/of.h b/include/linux/of.h
index 27b3ba1..c1ed2a5 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -867,14 +867,33 @@ static inline int of_changeset_update_property(struct of_changeset *ocs,
 extern int of_resolve_phandles(struct device_node *tree);
 
 /**
- * of_system_has_poweroff_source - Tells if poweroff-source is found for device_node
+ * of_is_system_power_controller - Tells if the property for controlling system
+ * power is found in device_node.
  * @np: Pointer to the given device_node
  *
  * return true if present false otherwise
  */
-static inline bool of_system_has_poweroff_source(const struct device_node *np)
-{
-	return of_property_read_bool(np, "poweroff-source");
+static inline bool of_is_system_power_controller(const struct device_node *np)
+{
+	struct property *pp;
+	unsigned long flags;
+	char *sep;
+	bool found = false;
+
+	raw_spin_lock_irqsave(&devtree_lock, flags);
+	for_each_property_of_node(np, pp) {
+		if (of_prop_cmp(pp->name, "system-power-controller") == 0) {
+			found = true;
+			break;
+		}
+		sep = strchr(pp->name, ',');
+		if (sep && sep - pp->name && of_prop_cmp(sep + 1, "system-power-controller") == 0) {
+			found = true;
+			break;
+		}
+	}
+	raw_spin_unlock_irqrestore(&devtree_lock, flags);
+	return found;
 }
 
 #endif /* _LINUX_OF_H */
-- 
1.9.1


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

end of thread, other threads:[~2014-10-28  7:25 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-27 16:26 [PATCH v1 01/10] of: Rename "poweroff-source" property to "system-power-controller" Romain Perier
2014-10-27 16:26 ` [PATCH v1 02/10] dt-bindings: Document the standard property "system-power-controller" Romain Perier
     [not found]   ` <1414427215-14380-2-git-send-email-romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-10-27 16:39     ` Felipe Balbi
2014-10-27 17:26       ` Mark Brown
2014-10-27 17:30         ` Felipe Balbi
2014-10-27 17:57           ` Mark Brown
2014-10-28  7:25             ` Romain Perier
2014-10-27 16:26 ` [PATCH v1 03/10] regulator: act8865: Use of_is_system_power_controller helper function Romain Perier
     [not found]   ` <1414427215-14380-3-git-send-email-romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-10-27 16:40     ` Felipe Balbi
2014-10-27 17:03       ` Heiko Stübner
2014-10-27 16:26 ` [PATCH v2 04/10] ARM: dts: rockchip: Enable power off in pmic for Radxa Rock Romain Perier
2014-10-27 16:26 ` [PATCH v1 05/10] dt-bindings: act8865: Update documentation about property system-power-controller Romain Perier
2014-10-27 16:26 ` [PATCH v2 06/10] mfd: tps65910: Use the standard DT " Romain Perier
     [not found]   ` <1414427215-14380-6-git-send-email-romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-10-27 16:35     ` Lucas Stach
2014-10-27 16:41       ` Felipe Balbi
2014-10-27 16:43         ` Johan Hovold
2014-10-27 16:53           ` Romain Perier
2014-10-27 16:49         ` Heiko Stübner
2014-10-27 16:49           ` Felipe Balbi
2014-10-27 16:41   ` Felipe Balbi
2014-10-27 16:26 ` [PATCH v2 07/10] ARM: dts: tegra: Use standard power-off property in tps65911 for tegra30 apalis Romain Perier
     [not found]   ` <1414427215-14380-7-git-send-email-romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-10-27 16:42     ` Felipe Balbi
2014-10-28  4:34       ` Alexandre Courbot
2014-10-28  6:47         ` Romain Perier
2014-10-27 16:26 ` [PATCH v2 08/10] ARM: dts: tegra: Use standard power-off property in tps65911 for tegra30 beaver Romain Perier
2014-10-27 16:42   ` Felipe Balbi
2014-10-27 16:26 ` [PATCH v2 09/10] ARM: dts: tegra: Use standard power-off property in tps65911 for tegra30 cardhu Romain Perier
2014-10-27 16:26 ` [PATCH v2 10/10] ARM: dts: tegra: Use standard power-off property in tps65911 for tegra30 colibri Romain Perier
2014-10-27 16:38 ` [PATCH v1 01/10] of: Rename "poweroff-source" property to "system-power-controller" Felipe Balbi
2014-10-27 16:41   ` Johan Hovold
2014-10-27 16:47     ` Felipe Balbi
2014-10-27 17:02       ` Johan Hovold
2014-10-27 17:05       ` Heiko Stübner
2014-10-27 17:08         ` Felipe Balbi
2014-10-27 17:16 ` Johan Hovold
2014-10-27 18:16   ` Romain Perier

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