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: 5720221 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 112E09F2ED for ; Tue, 27 Jan 2015 20:23:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4B7C120107 for ; Tue, 27 Jan 2015 20:23:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 74AD0200FE for ; Tue, 27 Jan 2015 20:23:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YGCdl-0006rF-9p; Tue, 27 Jan 2015 20:21:37 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YGCdV-0006kW-Iz for linux-arm-kernel@bombadil.infradead.org; Tue, 27 Jan 2015 20:21:21 +0000 Received: from mail-lb0-f174.google.com ([209.85.217.174]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YGCX6-0004g6-3G for linux-arm-kernel@lists.infradead.org; Tue, 27 Jan 2015 20:14:44 +0000 Received: by mail-lb0-f174.google.com with SMTP id f15so15122994lbj.5 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=EN6/nscqZsYcANB9OG5GLcQvRc1FWrd25oeqpdktI00Zb+SfN6K/kDeis8fi1E8jHz pLYIc0TQbehwDcqm5BXhp9W2rx0RIWirkoCl0XcVxOE8Q2b0v352r9I9cBPJu7BBM1xa waWq5NRLNVeY5PELjvYiwbvgUfn65OAC7bANwnvg5Z+aRMpV3E8NWOAAbLPusjsbsvnQ 4u6psoDgan7Fe6eeVjgokvMuICYbbn/5U5GoScNHPqh9GyMXwdqfieEsZmOL4Q6uaivA aYT8nSNa7dEGNMlmcIP6GNM3XEJLNldGjSMr5PXD4v3KbjNsmydmnDmvDXWoQB+AKPcc ma+g== X-Gm-Message-State: ALoCoQmgUlc/bPRBOEZbznWZ+yOF9B63OUAbj2Rp/gwNkkglpf10it7f31nv/Ytrvd32k538OSoV 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150127_201444_173390_5DB58562 X-CRM114-Status: GOOD ( 13.13 ) X-Spam-Score: -2.6 (--) Cc: linux-samsung-soc@vger.kernel.org, Ulf Hansson , Dmitry Torokhov , linux-arm-kernel@lists.infradead.org, Geert Uytterhoeven X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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;