From patchwork Tue Jan 27 20:13:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 5720101 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C51D3C058E for ; Tue, 27 Jan 2015 20:14:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0638D2024D for ; Tue, 27 Jan 2015 20:14:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1FBDA2025A for ; Tue, 27 Jan 2015 20:14:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759666AbbA0UOZ (ORCPT ); Tue, 27 Jan 2015 15:14:25 -0500 Received: from mail-lb0-f173.google.com ([209.85.217.173]:42261 "EHLO mail-lb0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759650AbbA0UOX (ORCPT ); Tue, 27 Jan 2015 15:14:23 -0500 Received: by mail-lb0-f173.google.com with SMTP id p9so15125301lbv.4 for ; Tue, 27 Jan 2015 12:14:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CdOL3ve+ZVRxQnBMYVLjBLPCZKEXU8IC2TmRCpWC/7Y=; b=LfkgR4vWEBOX1qpiqRimy8cFgHlEPCw9MjmqjQJBeBJDWWHNoCkOeKU2s22xs82Gff lcAVgb8NFy7BTjJcMspDgh4v0RAmYoanN75SmARB3XfkkjFQnnYjiQXzkLgVjJB8kZE7 NCz37xGXb7ZMUA/BLDeeIhVapIEzr4HrMIvmf+u/ZvthkEhKSbH9YGsg7Vo0Y8oEfhq1 tHjULspQELkXpM/3uMnKl7KVhyDH7vpS5KYfHs+Vqm7qP/vA8OCdaYvAAE3McuC5rSim a9b9fLrC26nb33Qefs6oaEWgS1+kBD9syryOa2k6nZwtIwxlTxJ2uZXiiJnEkaPITJCW apYQ== X-Gm-Message-State: ALoCoQmkC5vSXr/Ls/O6u+4uUWMdsdrQE3pwwLzJD2yo1nlfKw+B7QQT9I/2Pvgxud0Ngk7OtO42 X-Received: by 10.112.14.6 with SMTP id l6mr3892349lbc.91.1422389661866; Tue, 27 Jan 2015 12:14:21 -0800 (PST) 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 ya4sm713470lbb.32.2015.01.27.12.14.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Jan 2015 12:14:21 -0800 (PST) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , Kevin Hilman , linux-pm@vger.kernel.org Cc: Geert Uytterhoeven , Dmitry Torokhov , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Ulf Hansson Subject: [PATCH 8/8] PM / Domains: Handle errors from genpd's ->attach_dev() callback Date: Tue, 27 Jan 2015 21:13:45 +0100 Message-Id: <1422389625-11730-9-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1422389625-11730-1-git-send-email-ulf.hansson@linaro.org> References: <1422389625-11730-1-git-send-email-ulf.hansson@linaro.org> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The optional genpd's ->attach_dev() callback is invoked from __pm_genpd_add_device(). Let's add error handling from the response from this callback and propagate the error code. When __pm_genpd_add_device() is invoked through the generic OF-based PM domain look-up path, the device is being probed. Returning an error will mean the device won't be attached to its PM domain. Errors of -EPROBE_DEFER get special treatment and is propagated to the driver core. Therefore this change also enables the ->attach_dev() callback to be able to request for a deferred probe sequence. Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 0fd5ee1..ba4abbe 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1467,8 +1467,9 @@ int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, goto out; } - if (genpd->attach_dev) - genpd->attach_dev(genpd, dev); + ret = genpd->attach_dev ? genpd->attach_dev(genpd, dev) : 0; + if (ret) + goto out; genpd->device_count++; genpd->max_off_time_changed = true;