From patchwork Fri Nov 15 11:40:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 21538 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f70.google.com (mail-pb0-f70.google.com [209.85.160.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 48D9523FD6 for ; Fri, 15 Nov 2013 11:40:54 +0000 (UTC) Received: by mail-pb0-f70.google.com with SMTP id rp16sf6400511pbb.1 for ; Fri, 15 Nov 2013 03:40:53 -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=UA3JIZtB5AnXE2W43Zq7q5psPxHtdYXDXVx/JLf7vaDW3QxwmvgOtT6Q6Y/fjpg/1s 1qW9i9xxqzoTpUTvmE/hBu/VAOuzT5omr2u7Uyb4WBtIDQPUokZwTAhtCPGKdQXIndnC PpddAC3xZc/SDfIq02mlufMGjcL+Jv8R6xnmV8Sl924ug6ETLUYeOTbyxDAQW0YhADAN gx2FGn56rHaHAz7Orc5SDHYccFOrJzXOqBc078iP+ehPqA7ZRKt6GxdlGrq8DrSuPBIW S70Cwui5vUSB3FQC3mrl+eCM6Cv8hGw0G9SiA0iU0DEI7c/JOoJbf9Jvd2o8T+t+nnZm Ko9Q== X-Gm-Message-State: ALoCoQmoxNjf9i6L2Pdjg1QItrpw+gMvW2s58UnVrTXYoAsYn038Z653Sv1xK/ST6sv/y3HNoGiW X-Received: by 10.66.117.170 with SMTP id kf10mr2493441pab.35.1384515653127; Fri, 15 Nov 2013 03:40:53 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.2.193 with SMTP id 1ls1470713qew.22.gmail; Fri, 15 Nov 2013 03:40:53 -0800 (PST) X-Received: by 10.58.136.231 with SMTP id qd7mr4149631veb.1.1384515652971; Fri, 15 Nov 2013 03:40:52 -0800 (PST) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id at8si1363672vec.122.2013.11.15.03.40.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Nov 2013 03:40:52 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id oz11so2881607veb.31 for ; Fri, 15 Nov 2013 03:40:52 -0800 (PST) X-Received: by 10.58.108.196 with SMTP id hm4mr139852veb.28.1384515652878; Fri, 15 Nov 2013 03:40:52 -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 u4csp23597vcz; Fri, 15 Nov 2013 03:40:51 -0800 (PST) X-Received: by 10.112.13.202 with SMTP id j10mr1245029lbc.29.1384515650757; Fri, 15 Nov 2013 03:40:50 -0800 (PST) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com [209.85.215.43]) by mx.google.com with ESMTPS id y7si892658lal.149.2013.11.15.03.40.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Nov 2013 03:40:50 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.43 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id n7so2702327lam.30 for ; Fri, 15 Nov 2013 03:40:50 -0800 (PST) X-Received: by 10.112.13.72 with SMTP id f8mr1023959lbc.40.1384515649998; Fri, 15 Nov 2013 03:40:49 -0800 (PST) Received: from linaro-ulf.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id l10sm1875552lbh.13.2013.11.15.03.40.48 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Nov 2013 03:40:49 -0800 (PST) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org Cc: Greg Kroah-Hartman , linux-pci@vger.kernel.org, linux-usb@vger.kernel.org, Ulf Hansson , Kevin Hilman , Alan Stern Subject: [PATCH 1/2] PM / Runtime: Fix error path for prepare Date: Fri, 15 Nov 2013 12:40:44 +0100 Message-Id: <1384515645-8696-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.128.172 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; }