Received: by 10.192.165.148 with SMTP id m20csp1770952imm; Thu, 26 Apr 2018 01:55:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+CHbA5snkW9hrtsUQKNy83t5M/fobaBQo7dWV+JDdyCk3pBGxg9bxngNQa6rlUpYcIkqs7 X-Received: by 10.98.253.9 with SMTP id p9mr31113456pfh.152.1524732933749; Thu, 26 Apr 2018 01:55:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524732933; cv=none; d=google.com; s=arc-20160816; b=laPPNH24/IETToDB08Yav+HWU+FTKTRft3cYAnvdMFTI2dShufOaAgfTE6r9kxK877 43eiFXdJFyQ5/L8dkJKjW55+Xjla6yXnIspWD+TDQ9vbckdozKDRa5KFFZeFUySAzlju zqRUHlNHi6pVww7v65FAaoon/EbtA29vNTVGhAFG4+3GHalYrtr+yuBZmk+F6XRksnI5 n8UKBoec1bnvgcwUT3ofYKejymYCqo26w4byqNM+OWivELQRgAmVu8N/O+7kzt13KA8v eMsVjcBx279jOruhZC7vLclCfrCdIC8WGQXkRxb7lZJxlg/gd+rtCj8gzDm8qN9vPBxN Ddew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=0GyqQznU278kM2emAIQfIFInCTzuUYGErGb1DqJIbtQ=; b=BK4jHjF2BB5CEE482rf3j+tctYRPRc9Vk75KdcAiuUAat/J0g9fbQJFgeRgK6bJXTw YtQ4TA/ggz4GocdUYMHHAM37VsaWNWk30gF/Ag4CblEwYu3Hn6AJb9zDDAVVXQMoO+n0 bN6T97/U1ONl4Oth9HUuqWqcCLacgq7I2rMgKL2E7dw926qBCY9tQb0G8L5xKJoixT/T RdLEn+Gdn2tQeIe4xajU6ySpqrMrom8I6rmdzMmr0CRTQihuNsWsGMtfz1Yc6JhmReiU CiBfKa4ngKTpDUx0anTNjvzQzurTa3CcJXLk1DJcYW19v69vI/eneUHVFkPI/8Ld6UUS iMig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZVBeT7vE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l85si17875396pfb.231.2018.04.26.01.55.19; Thu, 26 Apr 2018 01:55:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZVBeT7vE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754828AbeDZIxh (ORCPT + 99 others); Thu, 26 Apr 2018 04:53:37 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:33160 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754727AbeDZIxW (ORCPT ); Thu, 26 Apr 2018 04:53:22 -0400 Received: by mail-lf0-f67.google.com with SMTP id m18-v6so12232262lfb.0 for ; Thu, 26 Apr 2018 01:53:22 -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: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=lhAuomdmx4BTm7vmR9uskoymB+2yzwcs1D8X5KqgWc7Gafwtfc5fOiORsfEjGMzss8 VgA1Qo2E3jRL18ZCyYzJXFZmAynznBuIakevsUsag+oVsj44omzy+Zhf+/pxZVm7W8ed 3LpAumulRGJ80OqquOiN+CnhIVeWIp4bA7+EpclSZGVwtdC3gsXoCM4KSxzqPxK7ITaw ll4c9UVzWrzECl8zyC5RWYEEX1u+PclannPlv/D4BUetyWRdxTyVqnKHu//gkFanB+pa BlBTwhN7yNv8bz74N0IDnqaPDJawbF8fEurgVJqGV7PEWjvTRlsYC2wGb9ZPLwdj4QZ6 OLZw== X-Gm-Message-State: ALQs6tASblJ5RmndpZMKSfk7ufQjS8YMPcv2VNQiV84mUux/FE9wF8i+ L3E8rJBHG+oApaisIjGwOljNzA== X-Received: by 2002:a19:1462:: with SMTP id k95-v6mr16871980lfi.23.1524732801276; Thu, 26 Apr 2018 01:53:21 -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 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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(-) 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) -- 2.7.4