From patchwork Mon Oct 27 16:26:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 5163421 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 69C9AC11AC for ; Mon, 27 Oct 2014 16:27:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 94CA2201BB for ; Mon, 27 Oct 2014 16:27:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B8B28201BC for ; Mon, 27 Oct 2014 16:27:11 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xin5W-00084A-Uo; Mon, 27 Oct 2014 16:24:10 +0000 Received: from mail-wi0-x22f.google.com ([2a00:1450:400c:c05::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xin5T-00080c-81 for linux-arm-kernel@lists.infradead.org; Mon, 27 Oct 2014 16:24:07 +0000 Received: by mail-wi0-f175.google.com with SMTP id h11so4887768wiw.14 for ; Mon, 27 Oct 2014 09:23:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=gOdOvSMADFuc2lW2NGQc3EXGwDdZkFPeP4ET6Ux2mf0=; b=X779ipK9tMeTt1/UbruAspaZzaf9v8YYfHSFUrFczfJyP3UaJdcRCab2vLw915/Wr4 KvNUZq9e7G5ryX6u49bcLBznnuBfYLTdbjntMyrbW6rr1XyrKNPwoAyW6RVZFps//1Em rBN3gOKnfZjJN2TucJJuj2qiGGmNil6diMdaNMsvgxKbk0pXFzAItYGKfZXZiccfPoGG bEryVA9SeOjCdCXgzTX+7FK0/Qtr5AdI4UsK/CztUetZUMjAUIRKO6yEhyDcRsEFj5oX TcXGExrtaJwln0r0PQQPnqTRiW4rw0SAIzOWSd6xpSjv4rKWB3Fs1t4pQqXhxgqEXxDt gYXA== X-Received: by 10.180.93.233 with SMTP id cx9mr22126426wib.48.1414427024312; Mon, 27 Oct 2014 09:23:44 -0700 (PDT) Received: from localhost.localdomain (AToulouse-554-1-48-253.w92-149.abo.wanadoo.fr. [92.149.239.253]) by mx.google.com with ESMTPSA id q5sm12388276wiy.16.2014.10.27.09.23.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Oct 2014 09:23:43 -0700 (PDT) From: Romain Perier To: heiko@sntech.de Subject: [PATCH v1 01/10] of: Rename "poweroff-source" property to "system-power-controller" Date: Mon, 27 Oct 2014 16:26:46 +0000 Message-Id: <1414427215-14380-1-git-send-email-romain.perier@gmail.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141027_092407_440060_B7A89310 X-CRM114-Status: GOOD ( 14.19 ) X-Spam-Score: -0.1 (/) Cc: mark.rutland@arm.com, linux-kernel@vger.kernel.org, thierry.reding@gmail.com, lee.jones@linaro.org, robh@kernel.org, linux@arm.linux.org.uk, swarren@wwwdotorg.org, grant.likely@linaro.org, linux@roeck-us.net, devicetree@vger.kernel.org, pawel.moll@arm.com, ijc+devicetree@hellion.org.uk, johan@kernel.org, robh+dt@kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, lgirdwood@gmail.com, balbi@ti.com, broonie@kernel.org, galak@codeaurora.org, gnurou@gmail.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 */