From patchwork Thu Apr 26 08:53:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 134427 Delivered-To: patches@linaro.org Received: by 10.46.151.6 with SMTP id r6csp1973324lji; Thu, 26 Apr 2018 01:53:21 -0700 (PDT) X-Received: by 10.46.153.153 with SMTP id w25mr7239767lji.34.1524732801567; Thu, 26 Apr 2018 01:53:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524732801; cv=none; d=google.com; s=arc-20160816; b=E6J9/4RW6aJiaMCXKoCRCosDbNWAdzGOqzfyY5WLJSNoM36XX69SPZchLaY/1UgJ8+ nusLWFBgyqdkBg2Av+/bVtGA5zJcY2f+z8rNvWCTYhTCkZlbIt303SoJOKJr0rf6no0N eSyX/zACZo2SpRsUYoOuJDIPv12rRs/gac67I//sHHHeHYFNM1+dcssj2n2bgzPibtGh xO401j27wHBLAngkoRHXz0vWxceRCZKabWDh1OMtMPvmekBksVq/TpnjhqU/4zWZdimu 8yUrJY1sUPmkIAm97vInEQR1Jew5V6Xj7hBKmDqnMJGIC0O5V+CM/Stizeanp+TGD+63 VR3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=0GyqQznU278kM2emAIQfIFInCTzuUYGErGb1DqJIbtQ=; b=qzuHog7yFDN4Si7TFYi2eQHAySgHvYztV7rOLtbzooZ/7G86/50+yMja3P/riudHpQ CNWWxcSsw2fuNRqO+dyXxb5mmQwLjG/NGEqg1P/i2c5im0jB5+h/3R/COd1OvZ+FhZXh JystGVE8yyubSiQVDHwenqvsuFcqtXooG/696oUC/M0pRFwnTCLGMYrJYRch2xryqRBv Kxzdk6+r9qA9JJili6ehR8MsJhr2bUDQiX58/91RIyHxmtHAfagNDB3tAnvA4j44nsf2 AI+NXVUCOigJEfu0Mjp6TtmCEOSvJGrjSa6udjP3ZWLzVW6oHcpSvEh9SF33Hwzdb43w 1Z+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZVBeT7vE; 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 g29-v6sor974240lfi.26.2018.04.26.01.53.21 for (Google Transport Security); Thu, 26 Apr 2018 01:53:21 -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=ZVBeT7vE; 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:in-reply-to:references; bh=0GyqQznU278kM2emAIQfIFInCTzuUYGErGb1DqJIbtQ=; b=ZVBeT7vEelur7ywutblazacQt0thtbPcy1AA8wejXPWGHVfsi/gGd4fLGNwS+z2SS/ kYsNNEb+O18tpmTu/p8kJgSTja7Sjq5GmT/ZT0PEEKzebodwJBs2N8dw40eHtKGPs0dD IHibcnOYi/1lJbzJqJaVLdUoItTMnG7U5vT8s= 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:in-reply-to :references; bh=0GyqQznU278kM2emAIQfIFInCTzuUYGErGb1DqJIbtQ=; b=s3njrUhxand7Kc/WhOmvA8gy6Ea/h+QWQ+U1iZqL97yyF46xM+qCTddEIS4teK5suW l/Z7tgbEwoMhHeJaYLdoM+d08Kbhk39oaNJaICswIZRithwGTjaOfuZGHgiBS1Zdob+t oj9Jxr2Tmk8OOY2X0heMSsS3hw5aGPBG2RXxwwWtgEyEH4DNDPt5oOUwkrbJJQFuH0VM GXv2UjnOpsCC8i+Umfjzb5LgxgvpWvxT+b+gA0fkS9X+XHYoA9TcFjWLPPFDB9BbwjC1 Jt8cAaKdzZwnzh4IqXPZwszIjNa9nEny9uYl7Fsndd1gUSVFI85EQ5ZetFtWQLmY0DkM 7Wbg== X-Gm-Message-State: ALQs6tBZhSNHdGpcNyb2wvUfKgn1xCW/q8zba2xJg+L4DEYjdMWQrH1p zigtiQZmRsw/3RW364lN/2JpoKrY X-Google-Smtp-Source: AB8JxZpUhL3m3fgj9e1oO7eZFkyPRdW/mrAPcSsU4ZM6YwUIxSxl70Afa/JiuZr1NtwnnRR3A0mMKg== X-Received: by 2002:a19:1462:: with SMTP id k95-v6mr16871980lfi.23.1524732801276; Thu, 26 Apr 2018 01:53:21 -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 u83-v6sm681097lff.65.2018.04.26.01.53.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Apr 2018 01:53:20 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Greg Kroah-Hartman , linux-pm@vger.kernel.org Cc: Ulf Hansson , Kevin Hilman , Geert Uytterhoeven , Viresh Kumar , Vincent Guittot , Mark Brown , Vinod Koul , Sanyog Kale , Pierre-Louis Bossart , Wolfram Sang , Russell King , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 04/11] PM / Domains: Check for existing PM domain in dev_pm_domain_attach() Date: Thu, 26 Apr 2018 10:53:03 +0200 Message-Id: <1524732790-2234-5-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524732790-2234-1-git-send-email-ulf.hansson@linaro.org> References: <1524732790-2234-1-git-send-email-ulf.hansson@linaro.org> Instead of checking if an existing PM domain pointer has been assigned in genpd_dev_pm_attach() and acpi_dev_pm_attach(), move the check to the common path in dev_pm_domain_attach(), thus potentially avoid one unnecessary check. Signed-off-by: Ulf Hansson --- drivers/acpi/device_pm.c | 3 --- drivers/base/power/common.c | 3 +++ drivers/base/power/domain.c | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 3d96e4d..d006300 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c @@ -1259,9 +1259,6 @@ int acpi_dev_pm_attach(struct device *dev, bool power_on) if (!adev) return -ENODEV; - if (dev->pm_domain) - return -EEXIST; - /* * Only attach the power domain to the first device if the * companion is shared by multiple. This is to prevent doing power diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c index f6a9ad5..f3cf61f 100644 --- a/drivers/base/power/common.c +++ b/drivers/base/power/common.c @@ -104,6 +104,9 @@ int dev_pm_domain_attach(struct device *dev, bool power_on) { int ret; + if (dev->pm_domain) + return -EEXIST; + ret = acpi_dev_pm_attach(dev, power_on); if (ret) ret = genpd_dev_pm_attach(dev); diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index d4b96ed..b816adb 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2194,9 +2194,6 @@ int genpd_dev_pm_attach(struct device *dev) if (!dev->of_node) return -ENODEV; - if (dev->pm_domain) - return -EEXIST; - ret = of_parse_phandle_with_args(dev->of_node, "power-domains", "#power-domain-cells", 0, &pd_args); if (ret < 0)