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: 135738 Delivered-To: patches@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1879548lji; Mon, 14 May 2018 07:52:52 -0700 (PDT) X-Received: by 2002:a2e:9816:: with SMTP id a22-v6mr1128420ljj.27.1526309572426; Mon, 14 May 2018 07:52:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526309572; cv=none; d=google.com; s=arc-20160816; b=aXC69qttEkRB07s1ttFlh5I6Uu5KW9jCTqM1v6e+T4+hJg2NRRTdX5ikLlcIupNnpa 3mZVzmgAdnvtW8cU8i2b+E+H5kXC0bnIjHDHPv6Ej0YcK9tDCjSI0tJq9RaDZtM6MOmp TsuSIAr4S33vKLS0I+bEr80G52p33FHOOnchI07vSxHEthXguUmvjAtcYY5YLyUBtly9 GI1U+Yc0P+SE0FnyAa2majArar409o36YiaHjDAXhXxPnGz/04CxKWp8jAAJto7o8ZZM /mV2LPiZLu38a6xZs+air8WbgHJzD2b2yZdtr5hFaVLVqcSaGr5eOq9qlRNUDCm+UGHE 3AoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=hMwtwC6pPoFOb+p5COoqLcA7rrvuAJjwDKgin0b8KP0=; b=x4igpCiFl7Hx6MhFQKC+Suvue1EdCxBMg+3PFwYI8O6itiErp6rqeMh7VQdr8tRKYq 453rPSydDvvMPDbopZdl4NIy13/uG1VUvFfnPjsITkfHOHYtLra6jcX9K6UIYElz8lGq VggF8uqJRfNG865S94I7Ws6XPUXrfG/nVXUzHRvlpmVkSu4PCwQP4VeliqxdQGhYWmPD QhVve4H+UZogdvu43fgBDEgeHmcvmjvdWSTDqdEXjWoq8/csqe8P7vnycXrH685FAwXg w0upB9OfvlN4Isb8UPj7tqmFJY3YRW2Pw7EazMBhNryvQhcJ7/ggnKCcLQbb5v9O7aWu qcyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CqHcNM5N; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id f4-v6sor2057208lfl.18.2018.05.14.07.52.52 for (Google Transport Security); Mon, 14 May 2018 07:52:52 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CqHcNM5N; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=EQ/FXGhUAvZ6cXTvtwrhr0cyya1OkvfHl0ZjMD0FHBt6r0nH6zZd/oOXDsBg2o7poI ImBQeaO9l7Uc2r1p0c17UzXo2QUYvbt7FLUmcIUmut1j814PPEAqB1m5ZjXQsjSi3cEN QJhXY2TvVN8O86b3DfFvbkBzb9+Yw8mBU5df/MwpdSBtgKtdUoSh338E+ubhzKOMmrU4 QYexMwXtk5RTasZ6Edc8Z+e9jM8J2NuS3ZOkvg1eiMBLSaeCsbPkPQ8vTiG1HsmsUA7V cS0LrFlzeOOkiUg7zIL4FrqkIbQ7DtD1qXoyNUUltw+H/4g2e+AXVZiFz0pbPjMKBXVe MAew== X-Gm-Message-State: ALKqPwf0kfHZGaAtAYYIylKgf7VDJFOMha6QB42fm0s3LCfSchgw4ExW RSuaXwH2uG1O9lZYNzMWj3z383Gq 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) Return-Path: 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 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 --- 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(-) -- 2.7.4 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)