From patchwork Mon May 14 14:52:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10398597 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 090C7601E7 for ; Mon, 14 May 2018 14:53:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9FB128334 for ; Mon, 14 May 2018 14:53:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0B6C1FFB2; Mon, 14 May 2018 14:53:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DFA2282E8 for ; Mon, 14 May 2018 14:53:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753939AbeENOwy (ORCPT ); Mon, 14 May 2018 10:52:54 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:43636 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752525AbeENOwx (ORCPT ); Mon, 14 May 2018 10:52:53 -0400 Received: by mail-lf0-f65.google.com with SMTP id n18-v6so11994477lfh.10 for ; Mon, 14 May 2018 07:52:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=hMwtwC6pPoFOb+p5COoqLcA7rrvuAJjwDKgin0b8KP0=; b=CqHcNM5NMMHEnT3VIgmonG8FZzZCeQaOX/xnXh3svUJ+1ruMnLonHFq5AlLIH6FNKp e4lYMLjsbQYF9hW5oR9OC1Dr7kTHBMjjNZKA0lxyWlcbGP7TmeLXHtreVUBuvCAnGMvw tEI0g3kdpquYBDXYhI2d0ySNzvNWf0yT8zzAE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hMwtwC6pPoFOb+p5COoqLcA7rrvuAJjwDKgin0b8KP0=; b=OEW9HK9hJP7gDcE87LMg8f+sZAZ2L4Eph+ui+vxoL3xDyaFqeihy+ghZNMoHNwczPH ZOo8VPD/xyIGSn2CzMcgi9nTuJu2aYldgv+W6ea2lo7fNo+gCLTTgNcZ+PMWPHvuiEB7 Ws+TLIzWvYXeivxrZTRpTdk2UaKfsKA/+BacawWU2BZDhWaaH8K2hbPta/EWPKI6qao1 msdXv30jL2/qRln0DzSr3S97QWGg7KdXnlpeqPRoUVrYcRZ1u5S4W+2xdj95eJ481iSE XpWnTGHPnjLnhkLbvVgYk8fXf8GlPdpde5dhio1yrqq6nM8dDQAl9xIzGMWB3oZlHA2y LPog== X-Gm-Message-State: ALKqPwdlWEqWCHnaTWxPYlqnvQH7XDUEMjhrwOM5YvhpEst5IZutrzTt rz3XnxayMuKbXRlpUQH24/p18OHFM5c= X-Google-Smtp-Source: AB8JxZoX7az944KsOBTtqjkopidkgffOaFrnCUb15gpktdGjToA7WPhCVAvHJvAzz0uxv/bNoMAX4g== X-Received: by 2002:a19:27c2:: with SMTP id n185-v6mr8829673lfn.25.1526309572063; Mon, 14 May 2018 07:52:52 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id q133-v6sm2467318lfe.27.2018.05.14.07.52.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 May 2018 07:52:51 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Ulf Hansson , Krzysztof Kozlowski , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, "linux-samsung-soc @ vger . kernel . org" , Sylwester Nawrocki , Marek Szyprowski Subject: [PATCH] PM / Domains: Don't return -EEXIST at attach when PM domain exists Date: Mon, 14 May 2018 16:52:37 +0200 Message-Id: <1526309557-7995-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As dev_pm_domain_attach() isn't the only way to assign PM domain pointers to devices, clearly we must allow a device to have the pointer already being assigned. For this reason, return 0 instead of -EEXIST. Cc: Sylwester Nawrocki Cc: Marek Szyprowski Reported-by: Krzysztof Kozlowski Signed-off-by: Ulf Hansson Tested-by: Tested-by: Krzysztof Kozlowski Tested-by: Tony Lindgren --- Krzysztof reported problems for an Exynos5 board, where some devices are added to their PM domains (genpd) via calling of_genpd_add_device(). As also pointed out by Sylvester, this leads to probe failure when dev_pm_domain_attach() returns -EXISTS. Rafael, potentially this change could be squashed with the recently queued patch: "PM / Domains: Check for existing PM domain in dev_pm_domain_attach()", but perhaps its too late for that and the fix is better applied on top!? --- drivers/base/power/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c index 5e4b481..390868c 100644 --- a/drivers/base/power/common.c +++ b/drivers/base/power/common.c @@ -106,7 +106,7 @@ int dev_pm_domain_attach(struct device *dev, bool power_on) int ret; if (dev->pm_domain) - return -EEXIST; + return 0; ret = acpi_dev_pm_attach(dev, power_on); if (!ret)