From patchwork Thu Sep 4 13:52:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 36706 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f69.google.com (mail-qg0-f69.google.com [209.85.192.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 26CFE20CBB for ; Thu, 4 Sep 2014 13:52:50 +0000 (UTC) Received: by mail-qg0-f69.google.com with SMTP id q108sf2710804qgd.8 for ; Thu, 04 Sep 2014 06:52:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=Ou0RlgsXVfIDS2ESgOcueAoPt9PqQED91dHPmGSxDMU=; b=gnZnDRpxqzGJCpAwckiMsAIUO8AXWc7+5HAiLix0L68BjUaVysckRE6ST/CDulY98X GQa6av+NmDVlP5t5bqxr43bT3eSEZoIKxnQYkdK+bR7D6UUuuXGcwkAhfLdkCPP/1lR6 FhW3iG4oIK1t3fr+t0WIn1KUWp/cBNbsESW6NPNQjoHJSAHHjXLevPfm/beFoM5MnEyE cyFONKFknvscOnHMI1/NSNN5drMQyPGkjMf5blWaPuQHzAQbUCwJBka7x7zlfolxHuE/ GYrJlWrbiUHSVodiAOaBKAUoa41TdDeYTe1KfrCJumJjRX9uA9SEAKb94ctREtmXuaKN dpYw== X-Gm-Message-State: ALoCoQlvfAj7hJT/33O0fS1CwlXd3GOJCyMiDb0mltCcQmKN5mdYUt4vxA9mb4VMew3t4PmEwIui X-Received: by 10.236.150.170 with SMTP id z30mr403916yhj.58.1409838770019; Thu, 04 Sep 2014 06:52:50 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.51.51 with SMTP id t48ls284232qga.67.gmail; Thu, 04 Sep 2014 06:52:49 -0700 (PDT) X-Received: by 10.220.163.130 with SMTP id a2mr1284665vcy.52.1409838769928; Thu, 04 Sep 2014 06:52:49 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id ts3si5656955vcb.70.2014.09.04.06.52.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Sep 2014 06:52:49 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id im17so10734926vcb.13 for ; Thu, 04 Sep 2014 06:52:49 -0700 (PDT) X-Received: by 10.52.94.108 with SMTP id db12mr3345240vdb.8.1409838769829; Thu, 04 Sep 2014 06:52:49 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp841178vcb; Thu, 4 Sep 2014 06:52:49 -0700 (PDT) X-Received: by 10.112.190.2 with SMTP id gm2mr3109741lbc.5.1409838768213; Thu, 04 Sep 2014 06:52:48 -0700 (PDT) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com [209.85.217.172]) by mx.google.com with ESMTPS id z12si2625441lbg.104.2014.09.04.06.52.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Sep 2014 06:52:48 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by mail-lb0-f172.google.com with SMTP id c11so3339616lbj.3 for ; Thu, 04 Sep 2014 06:52:47 -0700 (PDT) X-Received: by 10.152.10.74 with SMTP id g10mr4757344lab.41.1409838767712; Thu, 04 Sep 2014 06:52:47 -0700 (PDT) Received: from uffe-Latitude-E6430s.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id p3sm2085260lap.14.2014.09.04.06.52.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Sep 2014 06:52:46 -0700 (PDT) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , Greg Kroah-Hartman , linux-pm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, Geert Uytterhoeven , Kevin Hilman , Alan Stern , Daniel Lezcano , Tomasz Figa , devicetree@vger.kernel.org, Linus Walleij , Simon Horman , Magnus Damm , Ben Dooks , Kukjin Kim , Stephen Boyd , Philipp Zabel , Mark Brown , Wolfram Sang , Chris Ball , Russell King , Ulf Hansson Subject: [PATCH v3 1/9] ACPI / PM: Let acpi_dev_pm_detach() return an error code Date: Thu, 4 Sep 2014 15:52:28 +0200 Message-Id: <1409838756-31963-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1409838756-31963-1-git-send-email-ulf.hansson@linaro.org> References: <1409838756-31963-1-git-send-email-ulf.hansson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , To give callers the option of acting on a errors while removing the pm_domain ops for the device in the ACPI PM domain, let acpi_dev_pm_detach() return an int to provide the error code. Signed-off-by: Ulf Hansson Tested-by: Philipp Zabel Acked-by: Pavel Machek --- drivers/acpi/device_pm.c | 8 +++++++- include/linux/acpi.h | 7 +++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 67075f8..0d52ce1 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c @@ -1055,6 +1055,8 @@ static struct dev_pm_domain acpi_general_pm_domain = { * * Callers must ensure proper synchronization of this function with power * management callbacks. + * + * Returns 0 on successfully attached PM domain or negative error code. */ int acpi_dev_pm_attach(struct device *dev, bool power_on) { @@ -1087,8 +1089,10 @@ EXPORT_SYMBOL_GPL(acpi_dev_pm_attach); * * Callers must ensure proper synchronization of this function with power * management callbacks. + * + * Returns 0 on successfully detached PM domain or negative error code. */ -void acpi_dev_pm_detach(struct device *dev, bool power_off) +int acpi_dev_pm_detach(struct device *dev, bool power_off) { struct acpi_device *adev = ACPI_COMPANION(dev); @@ -1107,7 +1111,9 @@ void acpi_dev_pm_detach(struct device *dev, bool power_off) acpi_device_wakeup(adev, ACPI_STATE_S0, false); acpi_dev_pm_low_power(dev, adev, ACPI_STATE_S0); } + return 0; } + return -EINVAL; } EXPORT_SYMBOL_GPL(acpi_dev_pm_detach); #endif /* CONFIG_PM */ diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 807cbc4..c83cca5 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -587,7 +587,7 @@ static inline int acpi_subsys_freeze(struct device *dev) { return 0; } #if defined(CONFIG_ACPI) && defined(CONFIG_PM) struct acpi_device *acpi_dev_pm_get_node(struct device *dev); int acpi_dev_pm_attach(struct device *dev, bool power_on); -void acpi_dev_pm_detach(struct device *dev, bool power_off); +int acpi_dev_pm_detach(struct device *dev, bool power_off); #else static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev) { @@ -597,7 +597,10 @@ static inline int acpi_dev_pm_attach(struct device *dev, bool power_on) { return -ENODEV; } -static inline void acpi_dev_pm_detach(struct device *dev, bool power_off) {} +static inline int acpi_dev_pm_detach(struct device *dev, bool power_off) +{ + return -ENODEV; +} #endif #ifdef CONFIG_ACPI