From patchwork Thu Aug 28 08:38:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 36160 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C76B9202DD for ; Thu, 28 Aug 2014 08:39:16 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id et14sf15369231pad.10 for ; Thu, 28 Aug 2014 01:39:16 -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=cTK7F+whUs2N43a/47h9KKB7kIEGHP91K63zQUg4fOL8AsOoFBuld3OQXJ7JLZyhmd eiYRLcKyusM8pli67zL4gizrjWN0qYImDMzz2A04eJdGkt1j3gupsx/Qus1qkBU0x2M5 3tlHGehABK5f/PC3jEByyYw8q0ILlJOTI4G88BF6TTH/o6SIuhpEyjNGsA0XLQaNb5GV iTZIJtZsgES4fp7EdIsBeY81XpFUIY0eyxem7Ce65VAa42gp4lRouvbe1BGvS2x+C0ib jFzhTRFqWHuMeu/72Sjo9Yd7pRVv0vTDOHQ9DPoWNW5H3qXGaMVz4fybi6HRncodhT8s pl/A== X-Gm-Message-State: ALoCoQkXIrcjMfa2LHFSuQAJSQ1JAi0qSPMaBGD/Cqs/WCj3E0q4KO1+Vnujyu3Mxv4GwRwYV1Mp X-Received: by 10.66.66.196 with SMTP id h4mr1437483pat.18.1409215155282; Thu, 28 Aug 2014 01:39:15 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.42.87 with SMTP id b81ls476570qga.19.gmail; Thu, 28 Aug 2014 01:39:15 -0700 (PDT) X-Received: by 10.220.168.210 with SMTP id v18mr1935880vcy.3.1409215155148; Thu, 28 Aug 2014 01:39:15 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id ew3si2947568vdb.11.2014.08.28.01.39.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Aug 2014 01:39:15 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id la4so466320vcb.1 for ; Thu, 28 Aug 2014 01:39:15 -0700 (PDT) X-Received: by 10.220.122.194 with SMTP id m2mr414189vcr.17.1409215155077; Thu, 28 Aug 2014 01:39:15 -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 uj3csp201143vcb; Thu, 28 Aug 2014 01:39:14 -0700 (PDT) X-Received: by 10.152.42.194 with SMTP id q2mr2724272lal.32.1409215153537; Thu, 28 Aug 2014 01:39:13 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com [209.85.217.169]) by mx.google.com with ESMTPS id j4si4171392lbn.98.2014.08.28.01.39.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Aug 2014 01:39:13 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by mail-lb0-f169.google.com with SMTP id l4so499591lbv.28 for ; Thu, 28 Aug 2014 01:39:13 -0700 (PDT) X-Received: by 10.112.247.11 with SMTP id ya11mr2569013lbc.28.1409215152979; Thu, 28 Aug 2014 01:39:12 -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 t12sm4826676lbp.44.2014.08.28.01.39.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Aug 2014 01:39:12 -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 v2 1/9] ACPI / PM: Let acpi_dev_pm_detach() return an error code Date: Thu, 28 Aug 2014 10:38:54 +0200 Message-Id: <1409215142-8218-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1409215142-8218-1-git-send-email-ulf.hansson@linaro.org> References: <1409215142-8218-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.170 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 --- 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