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: 10398593 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 2D1FE600D0 for ; Mon, 14 May 2018 14:53:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1ADAF1FF65 for ; Mon, 14 May 2018 14:53:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 13E13280CF; Mon, 14 May 2018 14:53:55 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham 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 BE1A92856D for ; Mon, 14 May 2018 14:52:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753935AbeENOwy (ORCPT ); Mon, 14 May 2018 10:52:54 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:42279 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752349AbeENOwx (ORCPT ); Mon, 14 May 2018 10:52:53 -0400 Received: by mail-lf0-f67.google.com with SMTP id b18-v6so17750200lfa.9 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=smuDoZLIOuLiE9zcj12EJwcsbJyvs17w/dowegBBaWWcxlLkn6kgN5Rq5sL9KJezW/ P1oODrHiqVC65Ae1H76bIAV26BqIOs92cyZPJdfRSojsEtGfZ5k695DXERBgP47XoL6q gT+U+v3OQQ4eLqs+3V8NAVS+/LNXGjB8NpMUeK42v7tju3Qtl/AJ7CPc00lWWZik+UWv +LtW9UFQD3LnmC0OKVWG/MwpKPu/6LFybGVAwlAJl+3dki+l8kVbLXS1uHYfCEPFg7AN KigyOXM6eH+orBE9fhQUJOVWPeszg14O+DH4On3VGha9WLVO98CwevEdiJM+hfdb5LTx Yfng== X-Gm-Message-State: ALKqPwfcpbHalHiXkbwhH7lGqKAHCJDFDW21oTgkuRNAneubojNvrmP2 XR55DRgKXnMrBqHFp4BSEW7kvA== 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-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@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)