From patchwork Tue Sep 9 11:36:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 37095 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 01E8120491 for ; Tue, 9 Sep 2014 11:36:43 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id kx10sf14611925pab.8 for ; Tue, 09 Sep 2014 04:36:43 -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=IOGXRDVCTRkdLdQKOq9H2mIAPs7Vq23v6bVP0v/JJnM=; b=CfSdsB9YTOGIYshVVx9/fIqvqL/W6Rd9aQHZpsfYhzfEEq9EyZm2/q61173es7Y4Bk 2E6wAj6iPLfFspYC/c418C1ZWVnPuZG+i/CDnjVyGCqOIolJ7M0PVMpWdRzJu1FMGT3g JZhYDqOHmzOvChX9Nbwia1w/3LK2kfz2PAABmofRcVt2JgTcxODAX2J7VjgqAPnnAexJ RDqdXWIOaONzeZhbAP+aapvhEg9EsFdqeEgWyyNE4lHixShy5HlW3yMJ35u2W7lMXljB diQeVccd8mpM3moCuNVkup7Zixy3ClWi/mvPELTWLAGcxDTGsP+QK/mTTxu3JyKM9USK Djww== X-Gm-Message-State: ALoCoQlmToDAvS3JlJx7BGwfqa0Y1fQiW8V5QAuHtpADNiE0Pli0063JFcmQoa25ZypsSbCyr/Pc X-Received: by 10.66.66.196 with SMTP id h4mr20704425pat.18.1410262603296; Tue, 09 Sep 2014 04:36:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.94.231 with SMTP id g94ls1926871qge.74.gmail; Tue, 09 Sep 2014 04:36:43 -0700 (PDT) X-Received: by 10.220.186.196 with SMTP id ct4mr1518112vcb.51.1410262603125; Tue, 09 Sep 2014 04:36:43 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id ui7si510677vcb.55.2014.09.09.04.36.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Sep 2014 04:36:43 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id lf12so16827934vcb.39 for ; Tue, 09 Sep 2014 04:36:43 -0700 (PDT) X-Received: by 10.220.77.65 with SMTP id f1mr1601179vck.48.1410262603032; Tue, 09 Sep 2014 04:36:43 -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 uj3csp270160vcb; Tue, 9 Sep 2014 04:36:42 -0700 (PDT) X-Received: by 10.112.167.103 with SMTP id zn7mr33438810lbb.63.1410262601394; Tue, 09 Sep 2014 04:36:41 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by mx.google.com with ESMTPS id ur16si17489924lbb.71.2014.09.09.04.36.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Sep 2014 04:36:41 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id w7so3741449lbi.18 for ; Tue, 09 Sep 2014 04:36:40 -0700 (PDT) X-Received: by 10.152.1.6 with SMTP id 6mr35337087lai.22.1410262600689; Tue, 09 Sep 2014 04:36:40 -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 gn7sm4476961lbc.10.2014.09.09.04.36.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Sep 2014 04:36:35 -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 v4 1/9] ACPI / PM: Let acpi_dev_pm_detach() return an error code Date: Tue, 9 Sep 2014 13:36:02 +0200 Message-Id: <1410262570-22785-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1410262570-22785-1-git-send-email-ulf.hansson@linaro.org> References: <1409838756-31963-1-git-send-email-ulf.hansson@linaro.org> <1410262570-22785-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.180 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 Reviewed-by: Kevin Hilman --- 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