From patchwork Wed Nov 13 14:45:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 21488 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gg0-f198.google.com (mail-gg0-f198.google.com [209.85.161.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B0920202DA for ; Wed, 13 Nov 2013 14:45:15 +0000 (UTC) Received: by mail-gg0-f198.google.com with SMTP id l2sf696553ggn.9 for ; Wed, 13 Nov 2013 06:45:15 -0800 (PST) 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=qvk2nhnEDgnnoaMDP/AIFT+/FybcBWFOBXWxjpYKDx4=; b=adsY5D+ld9ONwJQdfh52W1rsZc0MIp+eu1l2GPvkW0fAPk7f/y4rGTMtPKhac77UvN tHg6pqEkMPA/BhqgRdZwGX/HFlecKS84RDDB1UcT4ncITHGzXNh6/xq7HHCaeIso9A7e tcT831MCbgTCbmT6HtpY74dcSfD0YD0oJqo9cpnTb7TOLzuJyu3F/20dh70hDjNrTak3 //x8NCnJLr0iUoRf5I6TdPHEkt341jE/GJ2AjOQlqJYttxWygUYFK8a7m84OaUYYWyjH lxvzkcAACXBMvR1fFbi4tEE7aW9Z6USV/HE2XzF3w2nE3VWSURt1vu9q8QqdTJuWuntP lRug== X-Gm-Message-State: ALoCoQnBOztv0l7CZYDRTFfps5V9B3S7TCnw1BETsUpcp/qaAdufUOSpz4ddWIh74qHnbxT6vdDo X-Received: by 10.236.130.140 with SMTP id k12mr5575922yhi.42.1384353915055; Wed, 13 Nov 2013 06:45:15 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.94.196 with SMTP id de4ls577013qeb.77.gmail; Wed, 13 Nov 2013 06:45:14 -0800 (PST) X-Received: by 10.52.106.201 with SMTP id gw9mr375709vdb.49.1384353914951; Wed, 13 Nov 2013 06:45:14 -0800 (PST) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id x5si5060609vce.145.2013.11.13.06.45.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Nov 2013 06:45:14 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id ld13so343302vcb.21 for ; Wed, 13 Nov 2013 06:45:14 -0800 (PST) X-Received: by 10.221.24.70 with SMTP id rd6mr425360vcb.42.1384353914449; Wed, 13 Nov 2013 06:45:14 -0800 (PST) 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.220.174.196 with SMTP id u4csp243969vcz; Wed, 13 Nov 2013 06:45:13 -0800 (PST) X-Received: by 10.180.185.101 with SMTP id fb5mr21048538wic.11.1384353913394; Wed, 13 Nov 2013 06:45:13 -0800 (PST) Received: from mail-we0-f170.google.com (mail-we0-f170.google.com [74.125.82.170]) by mx.google.com with ESMTPS id cu5si14014412wjc.50.2013.11.13.06.45.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Nov 2013 06:45:13 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.170 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=74.125.82.170; Received: by mail-we0-f170.google.com with SMTP id p61so524862wes.29 for ; Wed, 13 Nov 2013 06:45:12 -0800 (PST) X-Received: by 10.180.9.139 with SMTP id z11mr21019150wia.22.1384353912481; Wed, 13 Nov 2013 06:45:12 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id fu1sm24210907wib.8.2013.11.13.06.45.10 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Nov 2013 06:45:11 -0800 (PST) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org Cc: Greg Kroah-Hartman , Ulf Hansson , Kevin Hilman , Alan Stern Subject: [PATCH] PM / Runtime: Fix error path for prepare Date: Wed, 13 Nov 2013 15:45:03 +0100 Message-Id: <1384353903-29661-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , If a device prepare callback for some reason would fail, the PM core prevented the device from going inactive forever. In this case, to reverse the pm_runtime_get_noresume() we invokes the asyncronous pm_runtime_put(), thus restoring the usage count. Cc: Kevin Hilman Cc: Alan Stern Signed-off-by: Ulf Hansson --- drivers/base/power/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index ee039af..2a1b06a 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -1350,6 +1350,9 @@ static int device_prepare(struct device *dev, pm_message_t state) device_unlock(dev); + if (error) + pm_runtime_put(dev); + return error; }