From patchwork Tue Nov 3 22:45:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 7547421 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6CF9B9F2F7 for ; Tue, 3 Nov 2015 22:45:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7E9F320765 for ; Tue, 3 Nov 2015 22:45:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A77A320794 for ; Tue, 3 Nov 2015 22:45:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932171AbbKCWpd (ORCPT ); Tue, 3 Nov 2015 17:45:33 -0500 Received: from mail-wi0-f180.google.com ([209.85.212.180]:36875 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755197AbbKCWp2 (ORCPT ); Tue, 3 Nov 2015 17:45:28 -0500 Received: by wicfv8 with SMTP id fv8so21354127wic.0; Tue, 03 Nov 2015 14:45:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GTBjlw3ZhvmFlm9K7J/UgzuOvOvVpj7c/IkLxdn3axs=; b=EtO0gGtSyr1PKqgMil3bm7W7Zg/djmL5q87JbRG8wLtJyshEdedAiTU0+rl/PIR4Gt OgKybCe4j5zahBrybS9N/PAnuP+balcCqlT+Gi3WF9duxfM+WJcRKVPh1bClF1JyCtPd 9sQFDZVB11hXwk1RsiiiribcEtXC4vNx7q68QvZJ8o2wJPO6QU2u8qDKyOFtR7RcGxjB XL6TtPd5tVXvqnxGIYN79x50uTPF3JGwkntfPz2s95zhQ9qLV6dCwY5FpfefOGNMGCc8 OTn5LaZMGi9ZGwdQTeRf46GcNw2ppceLJCN+yNzpIC/rvz2o0+DpgOLIg7Wp4d8GghBK AaFA== X-Received: by 10.194.91.164 with SMTP id cf4mr31635846wjb.139.1446590727486; Tue, 03 Nov 2015 14:45:27 -0800 (PST) Received: from omega.localdomain (p20030064A95442B5E2CB4EFFFE1BB546.dip0.t-ipconnect.de. [2003:64:a954:42b5:e2cb:4eff:fe1b:b546]) by smtp.gmail.com with ESMTPSA id e189sm25555378wma.4.2015.11.03.14.45.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Nov 2015 14:45:26 -0800 (PST) From: Alexander Aring To: linux-rpi-kernel@lists.infradead.org Cc: robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, galak@codeaurora.org, swarren@wwwdotorg.org, lee@kernel.org, eric@anholt.net, linux@arm.linux.org.uk, f.fainelli@gmail.com, rjui@broadcom.com, sbranden@broadcom.com, rjw@rjwysocki.net, khilman@kernel.org, ulf.hansson@linaro.org, len.brown@intel.com, pavel@ucw.cz, gregkh@linuxfoundation.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, kernel@pengutronix.de, Alexander Aring Subject: [RFCv2 1/2] power: domain: add pm_genpd_uninit Date: Tue, 3 Nov 2015 23:45:10 +0100 Message-Id: <1446590711-18928-2-git-send-email-alex.aring@gmail.com> X-Mailer: git-send-email 2.6.1 In-Reply-To: <1446590711-18928-1-git-send-email-alex.aring@gmail.com> References: <1446590711-18928-1-git-send-email-alex.aring@gmail.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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 This patch adds function pm_genpd_uninit for undo a pm_genpd_init. This is useful for multiple power domains while probing. If the probing fails after one pm_genpd_init was called we need to undo all previous registrations of generic pm domains inside the gpd_list list. There is a check on IS_ERR_OR_NULL(genpd) which is useful to check again registered power domains and not registered domains, the driver can use this mechanism to have an array with registered and non-registered power domains, where non-registered power domains are NULL. Cc: Rafael J. Wysocki Cc: Kevin Hilman Cc: Ulf Hansson Cc: Pavel Machek Cc: Len Brown Cc: Greg Kroah-Hartman Signed-off-by: Alexander Aring --- drivers/base/power/domain.c | 15 +++++++++++++++ include/linux/pm_domain.h | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 16550c6..65b9d1a 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1730,6 +1730,21 @@ void pm_genpd_init(struct generic_pm_domain *genpd, } EXPORT_SYMBOL_GPL(pm_genpd_init); +/** + * pm_genpd_uninit - Uninitialize a generic I/O PM domain object. + * @genpd: PM domain object to initialize. + */ +void pm_genpd_uninit(struct generic_pm_domain *genpd) +{ + if (IS_ERR_OR_NULL(genpd)) + return; + + mutex_lock(&gpd_list_lock); + list_del(&genpd->gpd_list_node); + mutex_unlock(&gpd_list_lock); +} +EXPORT_SYMBOL_GPL(pm_genpd_uninit); + #ifdef CONFIG_PM_GENERIC_DOMAINS_OF /* * Device Tree based PM domain providers. diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index b1cf7e7..45d4f7a 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -143,6 +143,7 @@ extern int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd); extern int pm_genpd_name_detach_cpuidle(const char *name); extern void pm_genpd_init(struct generic_pm_domain *genpd, struct dev_power_governor *gov, bool is_off); +extern void pm_genpd_uninit(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); @@ -212,6 +213,9 @@ static inline void pm_genpd_init(struct generic_pm_domain *genpd, struct dev_power_governor *gov, bool is_off) { } +static inline void pm_genpd_uninit(struct generic_pm_domain *genpd) +{ +} static inline int pm_genpd_poweron(struct generic_pm_domain *genpd) { return -ENOSYS;