From patchwork Tue May 29 10:04:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 137135 Delivered-To: patches@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3845336lji; Tue, 29 May 2018 03:04:29 -0700 (PDT) X-Received: by 2002:a19:b587:: with SMTP id g7-v6mr8975286lfk.144.1527588269449; Tue, 29 May 2018 03:04:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527588269; cv=none; d=google.com; s=arc-20160816; b=WQMuy+ACtmaSRMW3AoRBkyWo9/EYW8MD34UFgDKwfjXAlpI49vnLH/rsMGnoNWjIkE UUqBupSt/pmVQwlRlPZ5lp+TULX4iJtHa16KpEXO9hFSRDRFvEzYunfj3gvJVGRO7GHu hXXIsAJ+x1AKRoPuKgBXNMbq1A3JMBqO4x2JHB/3tyg1PUu5Nc09KXMzr2SYdPl+A8F2 rvoGgOlEt7u+Z/0COPlH/uuqieuYoCabaetpO1WISbEwdMkvwst4TvdQFv97+vhPGCbn z4ROI3LQHf8PZfiT4FI2dmYXPJG6+MJyecTmRqVCDfZqAXwADKaqX2zdzOaFWh9Wd7cm MEWg== 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=RNBwx9Q11leZ2iF4Qt72vYGl8mmLcTrVpjkvTy5woOY=; b=OsRaTXDAJK1jtoLyQUw2kSD2eSEaCP6QY7e8HGeLHnPTFC5Igob/I/spcwXPJtixCx S6LvznqkAZG+Vaj2zbUc2MvmcsMyLufWO+eZbMfcsLkF4TLKsYbDD1MvVP0Q435VkHtr AkGKnCQiwnGX1XWG2/LIFQqwLPRiEO35vIByhFMskvOYIQlfzm77pBwbUH98h1gEhIQb /foJbrfgPWUEsej95fLsUZtpwqIseT2OV45NO+z4zDVmx/QnKEALxIOSV3hy50n9sMRv P1EvmMewCe53pdMtrUKv3LSaBDvui1ENZtQpopGwrLN2vNjzeH5nQHXiBaNEmpCQHR3W Kd1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JyiIbZ8w; 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 82-v6sor1253144lje.13.2018.05.29.03.04.29 for (Google Transport Security); Tue, 29 May 2018 03:04:29 -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=JyiIbZ8w; 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=RNBwx9Q11leZ2iF4Qt72vYGl8mmLcTrVpjkvTy5woOY=; b=JyiIbZ8wh7YZNGv9pnIcFOD5oafNJ+zlQqcKEE1CZ44YU7y7LlBh6hPVeKDXus0OS4 QlSFN8TsyThEt6g5vVS4rjGTLW7q3a2s1Ccd+NKSn2+apUgEfrWSwY7txaA0whWvepPw 8Jvo6TeOcWPvMYHRH/rhYcsq7k7mKrxs49V9Y= 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=RNBwx9Q11leZ2iF4Qt72vYGl8mmLcTrVpjkvTy5woOY=; b=kGrS0Q1BTvfTw5r/F41lSxpFLhellnQWzEviNHEflnQorRzyKXYN8QeGO6QgsCK0hr jb22Tdh740S5lkC3UkvvHTqUqYKq2pUZweEjnkZiJGyc0yrNEZwyMLjVUqAKayuEaHcJ SgVutwFI9VP6yUc0J4ag54vq70HiSosHrPV05fhlWwzISbgc4Fj6qdsyHGV8MkZ7+vST 6ZktVzWT9yzsKe4iRI/AGy1FLW6vO14NgGa0yglN83D+bs0ekpXq6c42LcD87b0IZajq GplaupJMqhXwz9Yt4fSMq8a0VnQNRD9B9akV3AZ0SmmoZjgRAp8EbBsZ9W5V5UPX4TcP W+nQ== X-Gm-Message-State: ALKqPwcskYbLgSHZBWwGVrpypWaJHcqW6KkhFFhV5OwQZeBBxJWsWC6M 4VJooxiL3fgvum6FDYXj2As2AXvK X-Google-Smtp-Source: ADUXVKJMzT40/2PTq1QaebRlZduwZauw+klH1h7H1KOqei5y3Fn80g2TLQ7ZD3gflxPlsLgTXmyeqQ== X-Received: by 2002:a2e:8794:: with SMTP id n20-v6mr10640999lji.38.1527588269201; Tue, 29 May 2018 03:04:29 -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 e21-v6sm2561718lfg.74.2018.05.29.03.04.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 03:04:28 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Ulf Hansson , Greg Kroah-Hartman , Jon Hunter , Geert Uytterhoeven , Todor Tomov , Rajendra Nayak , Viresh Kumar , Vincent Guittot , Kevin Hilman , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org Subject: [PATCH v2 1/9] PM / Domains: Drop extern declarations of functions in pm_domain.h Date: Tue, 29 May 2018 12:04:13 +0200 Message-Id: <20180529100421.31022-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180529100421.31022-1-ulf.hansson@linaro.org> References: <20180529100421.31022-1-ulf.hansson@linaro.org> Using "extern" to declare a function in a public header file is somewhat pointless, but also doesn't hurt. However, to make all the function declarations in pm_domain.h to be consistent, let's drop the use of "extern". Signed-off-by: Ulf Hansson --- include/linux/pm_domain.h | 51 ++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 28 deletions(-) -- 2.17.0 Acked-by: Viresh Kumar diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 4e5764083fd8..c847e9a3033d 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -143,21 +143,17 @@ static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev) return to_gpd_data(dev->power.subsys_data->domain_data); } -extern int __pm_genpd_add_device(struct generic_pm_domain *genpd, - struct device *dev, - struct gpd_timing_data *td); - -extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, - struct device *dev); -extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, - struct generic_pm_domain *new_subdomain); -extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, - struct generic_pm_domain *target); -extern int pm_genpd_init(struct generic_pm_domain *genpd, - struct dev_power_governor *gov, bool is_off); -extern int pm_genpd_remove(struct generic_pm_domain *genpd); -extern int dev_pm_genpd_set_performance_state(struct device *dev, - unsigned int state); +int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, + struct gpd_timing_data *td); +int pm_genpd_remove_device(struct generic_pm_domain *genpd, struct device *dev); +int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, + struct generic_pm_domain *new_subdomain); +int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, + struct generic_pm_domain *target); +int pm_genpd_init(struct generic_pm_domain *genpd, + struct dev_power_governor *gov, bool is_off); +int pm_genpd_remove(struct generic_pm_domain *genpd); +int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state); extern struct dev_power_governor simple_qos_governor; extern struct dev_power_governor pm_domain_always_on_gov; @@ -215,8 +211,8 @@ static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, } #ifdef CONFIG_PM_GENERIC_DOMAINS_SLEEP -extern void pm_genpd_syscore_poweroff(struct device *dev); -extern void pm_genpd_syscore_poweron(struct device *dev); +void pm_genpd_syscore_poweroff(struct device *dev); +void pm_genpd_syscore_poweron(struct device *dev); #else static inline void pm_genpd_syscore_poweroff(struct device *dev) {} static inline void pm_genpd_syscore_poweron(struct device *dev) {} @@ -240,14 +236,13 @@ int of_genpd_add_provider_simple(struct device_node *np, int of_genpd_add_provider_onecell(struct device_node *np, struct genpd_onecell_data *data); void of_genpd_del_provider(struct device_node *np); -extern int of_genpd_add_device(struct of_phandle_args *args, - struct device *dev); -extern int of_genpd_add_subdomain(struct of_phandle_args *parent, - struct of_phandle_args *new_subdomain); -extern struct generic_pm_domain *of_genpd_remove_last(struct device_node *np); -extern int of_genpd_parse_idle_states(struct device_node *dn, - struct genpd_power_state **states, int *n); -extern unsigned int of_genpd_opp_to_performance_state(struct device *dev, +int of_genpd_add_device(struct of_phandle_args *args, struct device *dev); +int of_genpd_add_subdomain(struct of_phandle_args *parent, + struct of_phandle_args *new_subdomain); +struct generic_pm_domain *of_genpd_remove_last(struct device_node *np); +int of_genpd_parse_idle_states(struct device_node *dn, + struct genpd_power_state **states, int *n); +unsigned int of_genpd_opp_to_performance_state(struct device *dev, struct device_node *opp_node); int genpd_dev_pm_attach(struct device *dev); @@ -304,9 +299,9 @@ struct generic_pm_domain *of_genpd_remove_last(struct device_node *np) #endif /* CONFIG_PM_GENERIC_DOMAINS_OF */ #ifdef CONFIG_PM -extern int dev_pm_domain_attach(struct device *dev, bool power_on); -extern void dev_pm_domain_detach(struct device *dev, bool power_off); -extern void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd); +int dev_pm_domain_attach(struct device *dev, bool power_on); +void dev_pm_domain_detach(struct device *dev, bool power_off); +void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd); #else static inline int dev_pm_domain_attach(struct device *dev, bool power_on) { From patchwork Tue May 29 10:04:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 137136 Delivered-To: patches@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3845370lji; Tue, 29 May 2018 03:04:31 -0700 (PDT) X-Received: by 2002:a2e:3a0f:: with SMTP id h15-v6mr10712299lja.63.1527588271109; Tue, 29 May 2018 03:04:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527588271; cv=none; d=google.com; s=arc-20160816; b=b6YPwp86Gvx2M+ciVdbfR6RB3jibgR7tPBEasG107VNXlqTwNYAqddQgxZnpzaSjwk Tydv8cnPzXyxw822OAwpUrsr+isV47ETSTTmddnmMgOcqa3VPL7GLYAkT4aKeyv64ezH peQFaL+IfgZ5TYJG+8q+eutdhwUSZ0AH/zfp0gNoB0f1xZZYdNEstV1TapyaL0AcTjUQ QxU/VR0SacholHXt8SdwXD0xwMSG551ocDNeW58r4og24+7SfdHI2sKJBU0QrvmL2258 UEyGbQy+whwQ9H7pZAT7YEmYvWibbdMhgADgqnflh8moqLdwyu01yngvbuI9u/hSx6x/ cjLg== 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=6L5ns3gkirNpoUrGXpNhs9C4kPH2lTxjmYVBDc+TIqo=; b=cQDeHVJ4L5Ld5tef2qziY2c8NGKuDK1rRfzF43O2MzeYL+1haAhTixzzPI6P5Yo3Ng L5M/dKFHnWrAmxX5baTqtySNxBwklTbPvKj3whmBY540U/3dysPOJ9Znbo0gdM52bEPH OuX0xS2jxkSBzsnED1Ka99+oSOuq2Hxv0/ZRJfQlprv1z1fFXzKCneFHhKilDbZOJJrz wEMv9Ps1XEthfIkgnMqgBq7OVkFWf3PXFgbQHHWYLApllvAHgGPzDzHTi4iUAj70gzUS Z8lEDIt3ypcS9rfPTrCkXuWs93zW5hTG1EO63lNfUuVFRa9ik5+siUMAva20G+g5S8lK gudQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ODvLSU72; 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 l18-v6sor7314015ljb.52.2018.05.29.03.04.30 for (Google Transport Security); Tue, 29 May 2018 03:04:31 -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=ODvLSU72; 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=6L5ns3gkirNpoUrGXpNhs9C4kPH2lTxjmYVBDc+TIqo=; b=ODvLSU72CdL3WZ0kO0L8V64poZhA5AicJ3BdDrzysJjL3QfT9Qj3HnqOFaty00Wkdh m37WHsR1z54eq0biQOOGLBrYExpz/gTus7m2nu9SIa+63im685PesrPd3IU2ID+CN1a5 f5PQi6GxXjvECLgl6iuTQ6Z1Rm576hF8Kvy68= 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=6L5ns3gkirNpoUrGXpNhs9C4kPH2lTxjmYVBDc+TIqo=; b=E5EKFUgaMzm66UnhBFqULqZuutZwXH+g/uiCrW/vPQfkEfCgKCcWrl2z5t6qaM4v0q pEn00yn8ATJtjjN5Wc8r0iGVwUO8XibgjSLtsga2O+5TpFFguvW6s5/HCPmMlthShjzn Cn2s8hjeumhCu4xmexWBuZ0JpiwM+3oU39xdDyvHIE4l08SKXwhOn2h7lZczqJraqzIa 7yXs0l1X7926rgORzwF+WFS9lG0zoP5IXTn0D2dzgKVz7Meipf3YDDQR7w7YbQI2/OiJ C8NdeCXhTVQeD3iWQfDsc0l7rS6QcPWxXs8MK20jpF1YhgCqMPmzARUyczBiv0LfdviX +Cog== X-Gm-Message-State: ALKqPwdRfYpgsMNUYZAHgs4fHv0DpZrdombvEgV55JM3//MDFBUB5XlT 43+Ul/w2AQUj3ye15P1ghnIna/dG X-Google-Smtp-Source: ADUXVKIRVLeNWQZBxxKOeRoSzbRsA0FXgMtzgFP18JhT/CZbrmv4FIzVa9hxX5iaFYTeDcJ0POaxwg== X-Received: by 2002:a2e:90d4:: with SMTP id o20-v6mr8837526ljg.15.1527588270783; Tue, 29 May 2018 03:04:30 -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 e21-v6sm2561718lfg.74.2018.05.29.03.04.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 03:04:30 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Ulf Hansson , Greg Kroah-Hartman , Jon Hunter , Geert Uytterhoeven , Todor Tomov , Rajendra Nayak , Viresh Kumar , Vincent Guittot , Kevin Hilman , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org Subject: [PATCH v2 2/9] PM / Domains: Drop __pm_genpd_add_device() Date: Tue, 29 May 2018 12:04:14 +0200 Message-Id: <20180529100421.31022-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180529100421.31022-1-ulf.hansson@linaro.org> References: <20180529100421.31022-1-ulf.hansson@linaro.org> There are still a few non-DT existing users of genpd, however neither of them uses __pm_genpd_add_device(), hence let's drop it. Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 10 ++++------ include/linux/pm_domain.h | 14 +++----------- 2 files changed, 7 insertions(+), 17 deletions(-) -- 2.17.0 Reviewed-by: Viresh Kumar diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 71a1cc79fbaa..469edb401811 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1414,23 +1414,21 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, } /** - * __pm_genpd_add_device - Add a device to an I/O PM domain. + * pm_genpd_add_device - Add a device to an I/O PM domain. * @genpd: PM domain to add the device to. * @dev: Device to be added. - * @td: Set of PM QoS timing parameters to attach to the device. */ -int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, - struct gpd_timing_data *td) +int pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev) { int ret; mutex_lock(&gpd_list_lock); - ret = genpd_add_device(genpd, dev, td); + ret = genpd_add_device(genpd, dev, NULL); mutex_unlock(&gpd_list_lock); return ret; } -EXPORT_SYMBOL_GPL(__pm_genpd_add_device); +EXPORT_SYMBOL_GPL(pm_genpd_add_device); static int genpd_remove_device(struct generic_pm_domain *genpd, struct device *dev) diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index c847e9a3033d..79888fb4a81f 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -143,8 +143,7 @@ static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev) return to_gpd_data(dev->power.subsys_data->domain_data); } -int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, - struct gpd_timing_data *td); +int pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev); int pm_genpd_remove_device(struct generic_pm_domain *genpd, struct device *dev); int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, struct generic_pm_domain *new_subdomain); @@ -163,9 +162,8 @@ static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev) { return ERR_PTR(-ENOSYS); } -static inline int __pm_genpd_add_device(struct generic_pm_domain *genpd, - struct device *dev, - struct gpd_timing_data *td) +static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, + struct device *dev) { return -ENOSYS; } @@ -204,12 +202,6 @@ static inline int dev_pm_genpd_set_performance_state(struct device *dev, #define pm_domain_always_on_gov (*(struct dev_power_governor *)(NULL)) #endif -static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, - struct device *dev) -{ - return __pm_genpd_add_device(genpd, dev, NULL); -} - #ifdef CONFIG_PM_GENERIC_DOMAINS_SLEEP void pm_genpd_syscore_poweroff(struct device *dev); void pm_genpd_syscore_poweron(struct device *dev); From patchwork Tue May 29 10:04:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 137137 Delivered-To: patches@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3845405lji; Tue, 29 May 2018 03:04:32 -0700 (PDT) X-Received: by 2002:a2e:1b52:: with SMTP id b79-v6mr10579462ljb.134.1527588272808; Tue, 29 May 2018 03:04:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527588272; cv=none; d=google.com; s=arc-20160816; b=04irJgt5SWwZSUZ/FtRYX+dYhqdTX/GG8/7mKPPAD/i45xcHZQ20VIbPSfgAV9LJA2 /vMOs5nZA/AHsB4VyVkVRU9CAmIpV0NB2q3QG4LCrqNYPRRllp/hYOikjxQxA7hraRRO JHO+X99e9ZM9id6lpugcMeZ3kE9GtGoMmpl8o+iWzvqeP2kyct1bO1Xg0wRpk86y7Qt+ LSc1zNuCmI+nRPVktvH18Kyn3k5HHHfrC4IO5bbrqa03JZL3lypNCftLtD+6cfbAW7Ir CQggQKvuVFjn1U/TszcrD6TYyNDDegL/hH+imBsdgvdnv5EM48c9jVg7KyMnkOczH3+y LnQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=dWpX9GjZyWi/EZMjmixZEwXhleiR7O0lE9qJPYWj4B8=; b=w6CjVFI2SQBggGAnN2/NuJUDELqpiHHg6hyf2C2EW2mBitM1Mo5bhJnOpKJ86N+fiy Vi307kZPB1F8wTLUBsRXjQy5PJ1M8mhgVS5P15BBGOdbPCEF46DmlWdfj+BqO1It+cqS ZP78RYkeDBWruA1TC/HxJveccwKGA8rMmNKlZtQzIRpUfQkziKHd9rxtpnTxawhP93U8 sQjFcdn/eCx09aLkVCfSi8qzLn2F+a1o2z23n2BPX3fNIQZS049wIfCUIyfOd5/OrAGZ epEg2j6uXF07V0omEG+AyMLpEXPWzYpW+d7sV+JVTQ0CI+x+AkIaG+6A1ALggTaw+geW eOZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XbWKu90C; 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 l24-v6sor2208654lja.61.2018.05.29.03.04.32 for (Google Transport Security); Tue, 29 May 2018 03:04:32 -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=XbWKu90C; 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 :mime-version:content-transfer-encoding; bh=dWpX9GjZyWi/EZMjmixZEwXhleiR7O0lE9qJPYWj4B8=; b=XbWKu90Co9xv1XQeW+SUI9hGDj3qL+LaMn+it6SB0ePZT7krrqevsIP5UPCHgRfCZX xzRe6yTkP8kwVvsqBcPMXP99fTT+IMbMH4twcRHqP4Dr63yQypH9quqM8GJfFhqqTsF3 6kHlt7K/Ktj8+o2Yd4Llrr+xMV/HGa1peVeFs= 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:mime-version:content-transfer-encoding; bh=dWpX9GjZyWi/EZMjmixZEwXhleiR7O0lE9qJPYWj4B8=; b=cZ9FB3mdCkQpgIXS/O3ncgVbCx/7E//sXrchfqt1QMSHCsgXvnCB8TgRS6ZbouBNeo wTnNEOY+7pIxeLYrskbi9eiJZWPKvC1uDu2rMkvz1E86SbUs3288/g3KXLoAX4wXgDpb 5br7THOqlvSAWbfCRACb5v6Ekea/Mg9mj6MiSbkgTbKjfchBLslGvbdRytfMHJHZVhQi OKokXjgr5qebazOyDpYgEVrSz5FHzMH322PRc2qeoMHFHl9zg1zWg0fbJ7q2btpPOqtY nrVShfcD1T/soe7/DONzGnjuVbukZ6o8ftTAUTU7eJNqSmTX6weMBABYvMlHDc3vuoSJ socA== X-Gm-Message-State: ALKqPwcOiGSknGwwsc3YX7zQjb7kQA/H8rgPtco5hDprZwoYPbyWsAlb KCa8jjKSA2v+6GlV5IKHqol4PByB X-Google-Smtp-Source: AB8JxZrRIwXyOABx/Xb4X51c5Lcj3oLNew6FULQYHdusf/qHmEQEeaK/yntpRkYYTI1ZwJwNwYoHxg== X-Received: by 2002:a2e:2e17:: with SMTP id u23-v6mr10592341lju.77.1527588272582; Tue, 29 May 2018 03:04:32 -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 e21-v6sm2561718lfg.74.2018.05.29.03.04.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 03:04:31 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Ulf Hansson , Greg Kroah-Hartman , Jon Hunter , Geert Uytterhoeven , Todor Tomov , Rajendra Nayak , Viresh Kumar , Vincent Guittot , Kevin Hilman , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, Alex Deucher , =?utf-8?q?Christian_K=C3=B6?= =?utf-8?q?nig?= , David Zhou Subject: [PATCH v2 3/9] PM / Domains: Drop genpd as in-param for pm_genpd_remove_device() Date: Tue, 29 May 2018 12:04:15 +0200 Message-Id: <20180529100421.31022-4-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180529100421.31022-1-ulf.hansson@linaro.org> References: <20180529100421.31022-1-ulf.hansson@linaro.org> MIME-Version: 1.0 There is no need to pass a genpd struct to pm_genpd_remove_device(), as we already have the information about the PM domain (genpd) through the device structure. Additionally, we don't allow to remove a PM domain from a device, other than the one it may have assigned to it, so really it does not make sense to have a separate in-param for it. For these reason, drop it and update the current only call to pm_genpd_remove_device() from amdgpu_acp. Cc: Alex Deucher Cc: Christian König Cc: David (ChunMing) Zhou Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 2 +- include/linux/pm_domain.h | 5 ++--- 3 files changed, 7 insertions(+), 8 deletions(-) -- 2.17.0 Reviewed-by: Viresh Kumar diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 469edb401811..c89b0ad068b7 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1475,13 +1475,13 @@ static int genpd_remove_device(struct generic_pm_domain *genpd, /** * pm_genpd_remove_device - Remove a device from an I/O PM domain. - * @genpd: PM domain to remove the device from. * @dev: Device to be removed. */ -int pm_genpd_remove_device(struct generic_pm_domain *genpd, - struct device *dev) +int pm_genpd_remove_device(struct device *dev) { - if (!genpd || genpd != genpd_lookup_dev(dev)) + struct generic_pm_domain *genpd = genpd_lookup_dev(dev); + + if (!genpd) return -EINVAL; return genpd_remove_device(genpd, dev); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c index a29362f9ef41..12558044acd4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c @@ -513,7 +513,7 @@ static int acp_hw_fini(void *handle) if (adev->acp.acp_genpd) { for (i = 0; i < ACP_DEVS ; i++) { dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i); - ret = pm_genpd_remove_device(&adev->acp.acp_genpd->gpd, dev); + ret = pm_genpd_remove_device(dev); /* If removal fails, dont giveup and try rest */ if (ret) dev_err(dev, "remove dev from genpd failed\n"); diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 79888fb4a81f..42e0d649e653 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -144,7 +144,7 @@ static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev) } int pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev); -int pm_genpd_remove_device(struct generic_pm_domain *genpd, struct device *dev); +int pm_genpd_remove_device(struct device *dev); int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, struct generic_pm_domain *new_subdomain); int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, @@ -167,8 +167,7 @@ static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, { return -ENOSYS; } -static inline int pm_genpd_remove_device(struct generic_pm_domain *genpd, - struct device *dev) +static inline int pm_genpd_remove_device(struct device *dev) { return -ENOSYS; } From patchwork Tue May 29 10:04:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 137138 Delivered-To: patches@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3845425lji; Tue, 29 May 2018 03:04:34 -0700 (PDT) X-Received: by 2002:a19:1099:: with SMTP id 25-v6mr8824861lfq.112.1527588274502; Tue, 29 May 2018 03:04:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527588274; cv=none; d=google.com; s=arc-20160816; b=0FzM2KIZKjY9NFfDJVYXg+/Ph/tqocpaIxIoStsOtviv1W85RVbxrjhLT6AAGGv4Y1 MrIpGwaQME+/iEG1FnM73Q3yQm6Nyv78GUQ7bzrQXK5mlzQFkp87vtPCeu8+mMjqWyjU YQHMtVBZqVNgg/FmmY0JjWfDQ7wZTU0I8IRk0m8mKIMAjNjiz05Fx516OHFL+fmMjrOA Vildt3cx6qui7osd6T72evfO2PNHgrVop/6BWbBB99Lab72gf0hkXGyixpPziJYxX1Ow kAk6trGM9ec7sra54MnNrz3Py3tMcUVOuoI+QbnNAM6DB/7psrPCqggAbhQxDoqiknBO 6dmg== 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=kJ4tREeZdjrEZ1PQJn9PeK0YWZ+ok/gO9XhnLg3/c5c=; b=Y7pq53ld6pMZr3Sg3RTlalGxs72NvFtHuONVHrA6pXYiOTJLZw7h2f2JeXiXgk/zny dt/UNnkHMG4VXNMgqyt3SWbhzTrr5qEygrp4vqt9+flCdkCQ6OmYkIwjQXUh8UZTluAi noCC3tkMM1cOqsI4wNEuuSJpH50gxmrTj8ZKOf+DV52B06WcOlWS9ufosTbQmYpmYKQI u9vpuuAYRrkOWBzNvThxh1aM8Nv9WluqU0cnisgQoF+ZfZg/F89PGz5baZB3LRE6eODX zt0bDuGrMT8sJDhCpGDeVC5+iTZuVVvqOd2gKdV5O9YYmIFKLI7OnbfDDRVba3vK0xWH TqAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YsanhJIF; 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 h94-v6sor6954970ljh.28.2018.05.29.03.04.34 for (Google Transport Security); Tue, 29 May 2018 03:04:34 -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=YsanhJIF; 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=kJ4tREeZdjrEZ1PQJn9PeK0YWZ+ok/gO9XhnLg3/c5c=; b=YsanhJIFu5yoEAf+9u2Mp41yhc2cK15qv3c0zWDkH5U1NdujjSCXHhFWFPs5zGjLlQ TIddHdzm/Sa15svu91vqPz7tOMZL00kUzqN6zVIFKJRXfOOznCHMBkcgiZTipyirZvfA ttITlVq46/WTAIBry5CGD5rrpFkv+WlE9DlRs= 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=kJ4tREeZdjrEZ1PQJn9PeK0YWZ+ok/gO9XhnLg3/c5c=; b=QYN2qm/sncQyDMA5pIVF2/KGquTi0LwslZMBSyc3Epq3QTY0SoLVnh3SjrWjmW/q22 DoEdHqpDK04MkeVeMPblH68U5tDTN1DytaNPQ/usUJUkhoH38bo1cXDer2G/6RSKIn07 uTi41uOJsiJ2vksmSnJMFmFIm5LuNpWjkesta5RcQKCYgeLE04NCzvWhtuZjNGX9/FlT 4C0lY8wyCOp3IvDxDXbISuKe+EcZl85H35gU3tfZBM4/Muu0qjEJqJvXgd6KBpXxT2Mu +5+i29HAAHNuLXxgunU3HbxS19RPcLnvAtwygmW2xUeAUPWdGcIZvYrAC65PCxGXiwFJ VeHw== X-Gm-Message-State: ALKqPwfXIvQYTk+wIUF4234ahIoh3gBqt485jrjZ0Q69Worhy6ihgflI 06JjNRcnBsYSDzVhs9Ozg8X7nFgl X-Google-Smtp-Source: ADUXVKInPfiT5E08mwa05atlCtkdC9jv2gdESxSgm1xjpp4CXksPDmMOR9EuCK7z+t2hX/AkBD7KFQ== X-Received: by 2002:a2e:8018:: with SMTP id j24-v6mr10481059ljg.92.1527588274274; Tue, 29 May 2018 03:04:34 -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 e21-v6sm2561718lfg.74.2018.05.29.03.04.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 03:04:33 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Ulf Hansson , Greg Kroah-Hartman , Jon Hunter , Geert Uytterhoeven , Todor Tomov , Rajendra Nayak , Viresh Kumar , Vincent Guittot , Kevin Hilman , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org Subject: [PATCH v2 4/9] PM / Domains: Drop unused parameter in genpd_allocate_dev_data() Date: Tue, 29 May 2018 12:04:16 +0200 Message-Id: <20180529100421.31022-5-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180529100421.31022-1-ulf.hansson@linaro.org> References: <20180529100421.31022-1-ulf.hansson@linaro.org> The in-parameter struct generic_pm_domain *genpd to genpd_allocate_dev_data() is unused, so let's drop it. Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.17.0 Reviewed-by: Viresh Kumar diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index c89b0ad068b7..7ebf7993273a 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1316,7 +1316,6 @@ EXPORT_SYMBOL_GPL(pm_genpd_syscore_poweron); #endif /* CONFIG_PM_SLEEP */ static struct generic_pm_domain_data *genpd_alloc_dev_data(struct device *dev, - struct generic_pm_domain *genpd, struct gpd_timing_data *td) { struct generic_pm_domain_data *gpd_data; @@ -1385,7 +1384,7 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, if (IS_ERR_OR_NULL(genpd) || IS_ERR_OR_NULL(dev)) return -EINVAL; - gpd_data = genpd_alloc_dev_data(dev, genpd, td); + gpd_data = genpd_alloc_dev_data(dev, td); if (IS_ERR(gpd_data)) return PTR_ERR(gpd_data); From patchwork Tue May 29 10:04:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 137139 Delivered-To: patches@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3845448lji; Tue, 29 May 2018 03:04:36 -0700 (PDT) X-Received: by 2002:a2e:7f02:: with SMTP id a2-v6mr10422066ljd.14.1527588276163; Tue, 29 May 2018 03:04:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527588276; cv=none; d=google.com; s=arc-20160816; b=ZAaGaX789vGFKG5QekGoHqeWEsgL60qxhKrimqErq3mRsasgfm7oXfhQ/KyOcmfo7J Rz3b9oS9p+uCUJ6kuugmi73SYZK6Bg6xlyI2GDh3f845aChyH9Y5Pv22XuZioWoDaOo6 4y1mmEM4+g7CB/xD5HH2faQK/cyN0Pf7aFu3GyorLjMom97VZCzjZjv7Qn6Fe6r0J51r IkFjGOgean3A4xXACyfq4dj66RJO+1KwEZrfBGazPdpjCYHYat/T9gZAiZ+FtFEcf0Kq psYyoiVKWstNTbT3OjOon8mUCN9sKk2fTzGTMdEg+5DZh0GKsuVWSgg7p7fvHNKDsEM0 5VWQ== 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=Y1uWf3IR6TeX72175kSKMmcxc4JqnYS9BmY6Xhncu1w=; b=xo3J2tPhTDR6ICbSrTfGRTFfdvgYkHUb36FpHdial4f0a2Whjpr18ss2iIfAukbXW2 3L3cXUayO2p57ty2ngpJ8iGvDnSh23f+UfPt1oweEuJBbTGQBl+D2ruLiUHA2nyfLxSj ORmnY/9a+fdrgs5TLmL03BY7EKnMpe/X2IhHhhiJgFO1NN4AIPa3piUVokoKan9zyPXH l/f/cBaRQv+EzPuCixOnqYK6bjjQUS/+yuI7TZ0r8v6+cuqBw1GB5N1dis+jAeUbn1u0 qiKd5CtmCKpSGohXCUNubRwNmm0g/LCD4xjHH3rmzQH+odJj0xFrm9SSSHhERj0foc1P dibw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IfPceGFx; 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 s7-v6sor7303117lji.74.2018.05.29.03.04.36 for (Google Transport Security); Tue, 29 May 2018 03:04:36 -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=IfPceGFx; 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=Y1uWf3IR6TeX72175kSKMmcxc4JqnYS9BmY6Xhncu1w=; b=IfPceGFxXcTVQGgdrcL9cl12ma8nIHSiNMIRjOOpby+mMIahSYyFnDPuO9EhLdiPEn EfWjXi7XYyrhl+hhMV857ula/5zN7NMSCw7Mv5cyT+8x69M6TBolhHOORER1ojAOUC9B Tf+z6QzzzwrlLkCoa3Iuh0IZssRGk76OjiTL8= 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=Y1uWf3IR6TeX72175kSKMmcxc4JqnYS9BmY6Xhncu1w=; b=IKWsA28WYLD5sQDty0Yja73/pzWVtLZsjD2YM/q2PKTt2Kz1e37o4iKRFHBU5+aThs VimthUphDxvo2x5Ul1RUsQrcjaY8YT3DGT7GLN0Fl14yLqrkYw9lmwOim/s3jEm8g9lp 3h4BB2h8x26IQuJLNquAgW0/uEtNcvS6GXgI7Ep0liG7tj+tYncHX1FGZ/x+xnMuHDJx q6cqZvCP4zqn1GulBObxujbJIc3ylTUIwpmloDPqe7fxt8NrPJc0YIkLiKBS4HfupZPN Be9x0j9UKC3qbmWnES0EqrrGmgYHame+LcNq1vU3jkkK9ZN+znXqqmwdRTDRPk8sHa3F osHA== X-Gm-Message-State: ALKqPwc1uWp3GoFqBPJFysLh0yZ4eFedPOLbDINYzF9Un8k3ohExc3U/ vjxmIYEBE0tHZXCGmkNGgG6r95N2 X-Google-Smtp-Source: AB8JxZoUmLU2Qxs3zDSRshLWegb/wHhLEQDZKm9FgRfhKMHuXHEncGNVpvhTmO+4ay3TZw6CBHNLCQ== X-Received: by 2002:a2e:202:: with SMTP id 2-v6mr9304467ljc.117.1527588275928; Tue, 29 May 2018 03:04:35 -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 e21-v6sm2561718lfg.74.2018.05.29.03.04.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 03:04:35 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Ulf Hansson , Greg Kroah-Hartman , Jon Hunter , Geert Uytterhoeven , Todor Tomov , Rajendra Nayak , Viresh Kumar , Vincent Guittot , Kevin Hilman , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org Subject: [PATCH v2 5/9] PM / Domains: dt: Allow power-domain property to be a list of specifiers Date: Tue, 29 May 2018 12:04:17 +0200 Message-Id: <20180529100421.31022-6-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180529100421.31022-1-ulf.hansson@linaro.org> References: <20180529100421.31022-1-ulf.hansson@linaro.org> To be able to describe topologies where devices are partitioned across multiple power domains, let's extend the power-domain property to allow being a list of PM domain specifiers. Cc: Rob Herring Cc: devicetree@vger.kernel.org Suggested-by: Jon Hunter Signed-off-by: Ulf Hansson --- Changes in v2: - Fixed comments from Geert. Re-worded to "PM domain specifiers" and clarified DT example. --- .../bindings/power/power_domain.txt | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) -- 2.17.0 Reviewed-by: Rob Herring diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt index 4733f76cbe48..9b387f861aed 100644 --- a/Documentation/devicetree/bindings/power/power_domain.txt +++ b/Documentation/devicetree/bindings/power/power_domain.txt @@ -111,8 +111,8 @@ Example 3: ==PM domain consumers== Required properties: - - power-domains : A phandle and PM domain specifier as defined by bindings of - the power controller specified by phandle. + - power-domains : A list of PM domain specifiers, as defined by bindings of + the power controller that is the PM domain provider. Example: @@ -122,9 +122,18 @@ Example: power-domains = <&power 0>; }; -The node above defines a typical PM domain consumer device, which is located -inside a PM domain with index 0 of a power controller represented by a node -with the label "power". + leaky-device@12351000 { + compatible = "foo,i-leak-current"; + reg = <0x12351000 0x1000>; + power-domains = <&power 0>, <&power 1> ; + }; + +The first example above defines a typical PM domain consumer device, which is +located inside a PM domain with index 0 of a power controller represented by a +node with the label "power". +In the second example the consumer device are partitioned across two PM domains, +the first with index 0 and the second with index 1, of a power controller that +is represented by a node with the label "power. Optional properties: - required-opps: This contains phandle to an OPP node in another device's OPP From patchwork Tue May 29 10:04:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 137140 Delivered-To: patches@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3845481lji; Tue, 29 May 2018 03:04:38 -0700 (PDT) X-Received: by 2002:a19:4b52:: with SMTP id y79-v6mr8756172lfa.49.1527588278063; Tue, 29 May 2018 03:04:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527588278; cv=none; d=google.com; s=arc-20160816; b=yBSHtBN+yCQ66lwxnPAXh9vq8TWvRoUVwxRIwysAgaoVov9ehQ3CIvlwQTRwEKZzR5 H2DejG/atlOIsltJXhHXx6zbk3IF0hOWkEhy/+RzI3l9xYWYP+tY4WEX5MKjiy9wUyRO SOIdKWBIVO2glPPzDetQm4Fhs63K+7aksjjinFJIkAOApMu7yZSme7FzAd47ri995xHP TdQdc0thEKSTUZb7riC1i+NuQEN67tkfwWn8hHzuhqxeNmS5f8kGFRIkO/8CTlfxiYrT wq3zZYPBD7r2jrR4whKP1rl6s6slraoXNE5PaZKAG2397vmPgDfdyLgwq4xfpYzt2Foi cvcA== 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=yQ4ukAh6z4qIZhwwXLKnDtTdeOmHdRuam254ohPML9I=; b=w2AIM7yUQAvk2eHNpWZDikeEbKGp8GVPb3yp9phd/up9iEpCWoKJGKIi91L0Y1BANf 0AqUhvsRkerT6et1UXa3HpvHO2SKVYFLlYIMn/lEXsT4I56whbQ3gxL+asuHrJ8lgfIq burySu5nHYX7Fb1WVbLEvSZnvCUzICna7HQYlAT7MlqYdcfcLBfTVOZ7XhAU+hDX4tYX 65yFo++jGQIPIpU6r6aFWwu7oLgQajhmQjrs7eAJB5RFMDR/BKR7/EvxbXy6P6l12DfW RmHSNtZ6owLhm0aXm85xB09Zpp0utqgPsqDzripzOTEA6GYnD4I0Q1op+yrkw4oSQC0k CXyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=baAcQg9k; 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 142-v6sor7441660ljj.43.2018.05.29.03.04.38 for (Google Transport Security); Tue, 29 May 2018 03:04:38 -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=baAcQg9k; 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=yQ4ukAh6z4qIZhwwXLKnDtTdeOmHdRuam254ohPML9I=; b=baAcQg9kaTj8nhVtTq8QF2TNt9vxE96Z3+M/1pVcZ82pkYfuX8aiN4+VP81JoiMuF5 qZgVQRq1h4Srun7c3RXORjlRnDOfdhDzI2M11Stqn1dvRMcvH5vVqPK9J5PxmNOZQQ1h sw0pGezezZm6N1vfd4lnGd3Yrb6Eup2QgWwzg= 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=yQ4ukAh6z4qIZhwwXLKnDtTdeOmHdRuam254ohPML9I=; b=n/2tBx24mDsTT1Lg5VEecFPLQhQFOeDQhmgN3yeYjv+lm1zGgSQbZq2LIqtxDoZXeR hsOTZelRFlu0Jre23Hx/X+jbcgOri5XydRiiEfdahswB43F/XqOTZlTiupQ7lCD+aqsF c1j/JOZmCjCwH4S+xpfKmR+oRoSKgbGcth37t18ihNJTfPXqxuxY3sqbGnz0U7oxnnYd 4EK3O6ANLLMmeYthL3wwfKWL6oNU4qUY2oDt2l0U0ovVmMDSh0Si0XtuMrlTNFksmths rKMRGDqXQic0ke5eF255QcQ5FWDfAAnTQR7DtenrT0hgghmS1yT2VlsT5nndmG0tm8Ij uvWg== X-Gm-Message-State: ALKqPwfPqIBpBXBS4BGcPAYllHMJOZc6NCCbyjmaBlmqA23crhav8sIH I2itDMVwiUII09Vvj1N6dd//mLzo X-Google-Smtp-Source: ADUXVKJK3dwOGTKFXDCJ5cCyWrUDOuFQ26iIEK3p1ZsbUBz4yn4KPAjlTTTzBDQDPwalUGToKncNBQ== X-Received: by 2002:a2e:1092:: with SMTP id 18-v6mr5777646ljq.115.1527588277835; Tue, 29 May 2018 03:04:37 -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 e21-v6sm2561718lfg.74.2018.05.29.03.04.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 03:04:37 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Ulf Hansson , Greg Kroah-Hartman , Jon Hunter , Geert Uytterhoeven , Todor Tomov , Rajendra Nayak , Viresh Kumar , Vincent Guittot , Kevin Hilman , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org Subject: [PATCH v2 6/9] PM / Domains: Don't attach devices in genpd with multi PM domains Date: Tue, 29 May 2018 12:04:18 +0200 Message-Id: <20180529100421.31022-7-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180529100421.31022-1-ulf.hansson@linaro.org> References: <20180529100421.31022-1-ulf.hansson@linaro.org> The power-domain DT property may now contain a list of PM domain specifiers, which represents that a device are partitioned across multiple PM domains. This leads to a new situation in genpd_dev_pm_attach(), as only one PM domain can be attached per device. To remain things simple for the most common configuration, when a single PM domain is used, let's treat the multiple PM domain case as being specific. In other words, let's change genpd_dev_pm_attach() to check for multiple PM domains and prevent it from attach any PM domain for this case. Instead, leave this to be managed separately, from following changes to genpd. Cc: Rob Herring Cc: devicetree@vger.kernel.org Suggested-by: Jon Hunter Signed-off-by: Ulf Hansson --- Changes in v2: - Minor update to changelog to mention "PM domain specifiers" rather than a "list of phandles". --- drivers/base/power/domain.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) -- 2.17.0 Acked-by: Jon Hunter Tested-by: Jon Hunter diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 7ebf7993273a..12a20f21974d 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2229,10 +2229,10 @@ static void genpd_dev_pm_sync(struct device *dev) * attaches the device to retrieved pm_domain ops. * * Returns 1 on successfully attached PM domain, 0 when the device don't need a - * PM domain or a negative error code in case of failures. Note that if a - * power-domain exists for the device, but it cannot be found or turned on, - * then return -EPROBE_DEFER to ensure that the device is not probed and to - * re-try again later. + * PM domain or when multiple power-domains exists for it, else a negative error + * code. Note that if a power-domain exists for the device, but it cannot be + * found or turned on, then return -EPROBE_DEFER to ensure that the device is + * not probed and to re-try again later. */ int genpd_dev_pm_attach(struct device *dev) { @@ -2243,10 +2243,18 @@ int genpd_dev_pm_attach(struct device *dev) if (!dev->of_node) return 0; + /* + * Devices with multiple PM domains must be attached separately, as we + * can only attach one PM domain per device. + */ + if (of_count_phandle_with_args(dev->of_node, "power-domains", + "#power-domain-cells") != 1) + return 0; + ret = of_parse_phandle_with_args(dev->of_node, "power-domains", "#power-domain-cells", 0, &pd_args); if (ret < 0) - return 0; + return ret; mutex_lock(&gpd_list_lock); pd = genpd_get_from_provider(&pd_args); From patchwork Tue May 29 10:04:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 137141 Delivered-To: patches@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3845523lji; Tue, 29 May 2018 03:04:39 -0700 (PDT) X-Received: by 2002:a2e:302:: with SMTP id 2-v6mr10608112ljd.9.1527588279682; Tue, 29 May 2018 03:04:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527588279; cv=none; d=google.com; s=arc-20160816; b=n9sGVz5EObSN+gzR3J1qwMn2+qyrfpGf/Zr2g+/5z9jMOkOxGBMEEAk5LX+ZGpdcv6 AUWTDv6mH36cyPiU118odXpvf68xfD5w01b2iB4d87Q7z8ZWCOfhvlg57ec39VIIeg56 m5T7XDWaEGpUi8xlsVccjEunOQAYARLtRZ/0Ac4BVlIGhPunNgSAGZRybj+AaGQ5wB6c XryyC9wtFdk5t6w0Cf52LhoxiFA6Hs4PJPVC9rAU2YxhyEe8CwyFDfhCJn0G4IySMGZ0 kBL+uedNbhB6t7+K2CQdcoea4iiXdsAJ7r/xJRrA4dkwX+xMzu5OuPULl9YtrPvmriyJ w+zA== 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=w08o5AzxzvUhesJImVVhXniyXaRI88njLEe6l9D4feg=; b=L3X+Aq9VLRXBY7DfSu8uYWCQgDoMYyI1vlVyDoCG+5rKU8JInCrVc8aQmbwAXWHlrD rj7FxOcDhKjSVAn37CvVgrCzrOTYL54fyriC2tJIW6SOVnu822AjyqZUe6GX3UMHUSHI AS4i0RHSDQVlolVYcEonyiq8cCt3BQlvZnQO4EwVV764ob3+B2i8JFqiPRhDowsGZ/fa A30XIzTs2zwg9M/0CYc+IGCK810lxRnwCQxTsh6KoBaG5bJ1DnQ3Ws5CcKB2TZCSw7mU dv/iRUvpZuzih0fBUmFerjb/1mOKTC450/W/QxjR1x4HksnfLG5LzoiqehihG4SnXkln P4Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Nt+688gK; 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 q62-v6sor7303462ljq.79.2018.05.29.03.04.39 for (Google Transport Security); Tue, 29 May 2018 03:04:39 -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=Nt+688gK; 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=w08o5AzxzvUhesJImVVhXniyXaRI88njLEe6l9D4feg=; b=Nt+688gKBsSkFKU5Lj4526i3xTldcMu+NNHQT001VY29Q1UhsJEzcq61e6xsZ5U88t lDzymVbNVYLpfChI6orDO7EyYlIjp0+SvMBfoTxagUIlJkmCk4o9MYSvosHkwD9CJMqN wUsgRZSLJXP0vfk4CjV+VfhLo8x9JUcI0jbLw= 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=w08o5AzxzvUhesJImVVhXniyXaRI88njLEe6l9D4feg=; b=oJvnFpjoAupVBaMgaqz+tgDqec/jU70u4vAOSv6LphEYMG/oLHUOjiS8CoDZLARZxg wioDuWItnOFWOmC2MSgxhYd6wwe6FxLBFap0tCtI17vcdoTs1MNg9DhWGFE7uaqdnUA5 9SunrUbs2WP99GZAsglZHP4MqhHRopLoAcXUCgCMfE3ZVVnjsKhNPgyYor2b7G+MUmcf rrnF134I85QXBo/hfBKeaJpVsSns8bB92O9AbzFJl6X9ZilirwNNy/ZFwhPj1RV/vIo7 66ktt+WSoXf/zXXfU6wHh8xogGPA+D/kGMQYn/spjfOTPKOz4QXjeumicSNZJq00aKMa HRyQ== X-Gm-Message-State: ALKqPwdF6fSj6ETfHWt3QGHvN+FH8OyIXGnZdqotIRu5GcH19NS3bEhx yQyJj0f1zfBFehtcmRkdk6xL4Csf X-Google-Smtp-Source: ADUXVKIJ/QliCcGCC68y02tC/ASzBcOLD+ekXuglYfH8fXzdY1EHNuWngpoa3K2ZAqaHOS1rAnoK6w== X-Received: by 2002:a2e:29cf:: with SMTP id p76-v6mr6408280ljp.12.1527588279396; Tue, 29 May 2018 03:04:39 -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 e21-v6sm2561718lfg.74.2018.05.29.03.04.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 03:04:38 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Ulf Hansson , Greg Kroah-Hartman , Jon Hunter , Geert Uytterhoeven , Todor Tomov , Rajendra Nayak , Viresh Kumar , Vincent Guittot , Kevin Hilman , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org Subject: [PATCH v2 7/9] PM / Domains: Split genpd_dev_pm_attach() Date: Tue, 29 May 2018 12:04:19 +0200 Message-Id: <20180529100421.31022-8-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180529100421.31022-1-ulf.hansson@linaro.org> References: <20180529100421.31022-1-ulf.hansson@linaro.org> To extend genpd to deal with allowing multiple PM domains per device, some of the code in genpd_dev_pm_attach() can be re-used. Let's prepare for this by moving some of the code into a sub-function. Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 60 ++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 27 deletions(-) -- 2.17.0 Acked-by: Jon Hunter Tested-by: Jon Hunter Reviewed-by: Viresh Kumar diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 12a20f21974d..2af99bfcbe3c 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2221,38 +2221,15 @@ static void genpd_dev_pm_sync(struct device *dev) genpd_queue_power_off_work(pd); } -/** - * genpd_dev_pm_attach - Attach a device to its PM domain using DT. - * @dev: Device to attach. - * - * Parse device's OF node to find a PM domain specifier. If such is found, - * attaches the device to retrieved pm_domain ops. - * - * Returns 1 on successfully attached PM domain, 0 when the device don't need a - * PM domain or when multiple power-domains exists for it, else a negative error - * code. Note that if a power-domain exists for the device, but it cannot be - * found or turned on, then return -EPROBE_DEFER to ensure that the device is - * not probed and to re-try again later. - */ -int genpd_dev_pm_attach(struct device *dev) +static int __genpd_dev_pm_attach(struct device *dev, struct device_node *np, + unsigned int index) { struct of_phandle_args pd_args; struct generic_pm_domain *pd; int ret; - if (!dev->of_node) - return 0; - - /* - * Devices with multiple PM domains must be attached separately, as we - * can only attach one PM domain per device. - */ - if (of_count_phandle_with_args(dev->of_node, "power-domains", - "#power-domain-cells") != 1) - return 0; - - ret = of_parse_phandle_with_args(dev->of_node, "power-domains", - "#power-domain-cells", 0, &pd_args); + ret = of_parse_phandle_with_args(np, "power-domains", + "#power-domain-cells", index, &pd_args); if (ret < 0) return ret; @@ -2290,6 +2267,35 @@ int genpd_dev_pm_attach(struct device *dev) return ret ? -EPROBE_DEFER : 1; } + +/** + * genpd_dev_pm_attach - Attach a device to its PM domain using DT. + * @dev: Device to attach. + * + * Parse device's OF node to find a PM domain specifier. If such is found, + * attaches the device to retrieved pm_domain ops. + * + * Returns 1 on successfully attached PM domain, 0 when the device don't need a + * PM domain or when multiple power-domains exists for it, else a negative error + * code. Note that if a power-domain exists for the device, but it cannot be + * found or turned on, then return -EPROBE_DEFER to ensure that the device is + * not probed and to re-try again later. + */ +int genpd_dev_pm_attach(struct device *dev) +{ + if (!dev->of_node) + return 0; + + /* + * Devices with multiple PM domains must be attached separately, as we + * can only attach one PM domain per device. + */ + if (of_count_phandle_with_args(dev->of_node, "power-domains", + "#power-domain-cells") != 1) + return 0; + + return __genpd_dev_pm_attach(dev, dev->of_node, 0); +} EXPORT_SYMBOL_GPL(genpd_dev_pm_attach); static const struct of_device_id idle_state_match[] = { From patchwork Tue May 29 10:04:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 137142 Delivered-To: patches@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3845547lji; Tue, 29 May 2018 03:04:41 -0700 (PDT) X-Received: by 2002:a2e:3e0c:: with SMTP id l12-v6mr10689250lja.23.1527588281429; Tue, 29 May 2018 03:04:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527588281; cv=none; d=google.com; s=arc-20160816; b=zlFJBHxWQ/NCSFFbmPdgZoSXWZGwjNX47TRHererNXhVx18GOPGCHcigXEp4SqBEM8 gkhUwlEPByZHA1ox+B1fahPkEOmmplIVNBpfdqmvNXx6ioew8Jnm2+dydDjpFTG24sWQ 20W+f4U6ticTknNiNxC0lS64TjzHPxbwKAIlcwkzAINdJF/aO2o0qO1x4k18hrU/sYM3 rsbB4q/k25LgrafIdp4iKaPIrceDeXk4V3Ib8tTCET2IP3TVkwnADpONZOuIiW8pB453 jM/xCShyAeH63KD4d8o1LU9De7qnFFDsAPFRckBXW4/f6c2g3vZI6Km2BWDu/avk4Lhu mSMw== 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=4AKcocpDu8LzFvQQptUzJpFM524E5IXAqb+rjvCBc/c=; b=phVlCZB4xbcC4ugt7Af8N4TGf7GG9A+3CL4rJFKdDnHh7tWPTnWjoeOb0CEBvV3tHX F6Gzb3As3QLz3GCGunw2Tl/4/LiOwrv5Hkw4037H6TZbW/cd1U/bmLmcS5IW7uZS1/bf mNEBbFjNsr5yxguJ3HmhRa6hH2sTtKCla6u+4LZ4/Xd0KtFD5P9h2lRW22SZEcSgjqlf qS+wV5zrhMhNUeWEYnMgbQJv20mpIFJRAJf65/6NKMGO6bfcSDqgog1XZARPHPZpGdgs sq3Rtb8svS2a7cAsRPk0c60zVC44+5kUW1Yl7RG/u6GHSdAFYn7uTbPK7xQZkpzfFPVk vkfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZZJD24OS; 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 u10-v6sor2263544ljh.109.2018.05.29.03.04.41 for (Google Transport Security); Tue, 29 May 2018 03:04:41 -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=ZZJD24OS; 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=4AKcocpDu8LzFvQQptUzJpFM524E5IXAqb+rjvCBc/c=; b=ZZJD24OSCW897IXk7gN0gsb538Ig7zxjlS3qOtp99xeQh2i2UskamIfmgRM7lHsKnr nK1yXnN+vDVZjpTWJIu0A4f6F9y/IaZnqPl2mFEhssWHHjOog4mQdHPkC/pTV8dnfq0P hIhci/jpMHG3M4VejT5BBJW/dpRmS1mqPOlzI= 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=4AKcocpDu8LzFvQQptUzJpFM524E5IXAqb+rjvCBc/c=; b=hbbI9Iacy1oBWUiCNaH5Rd1v+p9NMYLTOLFLOVStQNrmUAzRNAm8vHRmiKrcwUMSLh V5ym6DogDDVujkND3FHQZAfGsT8piJ5gswOy9jrvbdXUrH+8wzzzT78N70J80xlNkNeZ iH6Q1HqW1yBb/jpmjLCIIQoAfB+7q8vYEzL6wRKugbNJ0XMPVA72WXbhwUFLCyhYvReQ +4LXhGl29263I1BqzNegqu+eBcpPAUjJW4ZoMFUGoaY/9McvoLVsRmGDux0ypwNJHW8Q CP6W+M5NDLAC27d+XMUHHMz+FhZmUsop1mdlanYzUFR81vlgN2+3Mmm71SwjGvMjVzeg AmzA== X-Gm-Message-State: ALKqPwc71cEN0Nbb9mpfeG5/LQvL8Wh6fDDjnGtZYQeTY2j/lXj+UEv6 kBOaXCvpElW4wpQufTRS1+vrzUrIskO/Bw== X-Google-Smtp-Source: ADUXVKJeObP68e8ut4WHB00kxNq4iihomAaNX61RuLdxYWga3Fsyujl/yYKCgHyZzeWajzklXEstPw== X-Received: by 2002:a2e:8948:: with SMTP id b8-v6mr10916487ljk.31.1527588281021; Tue, 29 May 2018 03:04:41 -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 e21-v6sm2561718lfg.74.2018.05.29.03.04.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 03:04:40 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Ulf Hansson , Greg Kroah-Hartman , Jon Hunter , Geert Uytterhoeven , Todor Tomov , Rajendra Nayak , Viresh Kumar , Vincent Guittot , Kevin Hilman , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org Subject: [PATCH v2 8/9] PM / Domains: Add support for multi PM domains per device to genpd Date: Tue, 29 May 2018 12:04:20 +0200 Message-Id: <20180529100421.31022-9-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180529100421.31022-1-ulf.hansson@linaro.org> References: <20180529100421.31022-1-ulf.hansson@linaro.org> To support devices being partitioned across multiple PM domains, let's begin with extending genpd to cope with these kind of configurations. Therefore, add a new exported function genpd_dev_pm_attach_by_id(), which is similar to the existing genpd_dev_pm_attach(), but with the difference that it allows its callers to provide an index to the PM domain that it wants to attach. Note that, genpd_dev_pm_attach_by_id() shall only be called by the driver core / PM core, similar to how the existing dev_pm_domain_attach() makes use of genpd_dev_pm_attach(). However, this is implemented by following changes on top. Because, only one PM domain can be attached per device, genpd needs to create a virtual device that it can attach/detach instead. More precisely, let the new function genpd_dev_pm_attach_by_id() register a virtual struct device via calling device_register(). Then let it attach this device to the corresponding PM domain, rather than the one that is provided by the caller. The actual attaching is done via re-using the existing genpd OF functions. At successful attachment, genpd_dev_pm_attach_by_id() returns the created virtual device, which allows the caller to operate on it to deal with power management. Following changes on top, provides more details in this regards. To deal with detaching of a PM domain for the multiple PM domains case, let's also extend the existing genpd_dev_pm_detach() function, to cover the cleanup of the created virtual device, via make it call device_unregister() on it. In this way, there is no need to introduce a new function to deal with detach for the multiple PM domain case, but instead the existing one is re-used. Signed-off-by: Ulf Hansson --- Changes in v2: - Fixed comments from Jon. Clarified function descriptions and changelog. --- drivers/base/power/domain.c | 80 +++++++++++++++++++++++++++++++++++++ include/linux/pm_domain.h | 8 ++++ 2 files changed, 88 insertions(+) -- 2.17.0 diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 2af99bfcbe3c..2b496d79159d 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2171,6 +2171,15 @@ struct generic_pm_domain *of_genpd_remove_last(struct device_node *np) } EXPORT_SYMBOL_GPL(of_genpd_remove_last); +static void genpd_release_dev(struct device *dev) +{ + kfree(dev); +} + +static struct bus_type genpd_bus_type = { + .name = "genpd", +}; + /** * genpd_dev_pm_detach - Detach a device from its PM domain. * @dev: Device to detach. @@ -2208,6 +2217,10 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off) /* Check if PM domain can be powered off after removing this device. */ genpd_queue_power_off_work(pd); + + /* Unregister the device if it was created by genpd. */ + if (dev->bus == &genpd_bus_type) + device_unregister(dev); } static void genpd_dev_pm_sync(struct device *dev) @@ -2298,6 +2311,67 @@ int genpd_dev_pm_attach(struct device *dev) } EXPORT_SYMBOL_GPL(genpd_dev_pm_attach); +/** + * genpd_dev_pm_attach_by_id() - Attach a device to one of its PM domain. + * @dev: Device to attach. + * @index: The index of the PM domain. + * + * Parse device's OF node to find a PM domain specifier at the provided @index. + * If such is found, creates a virtual device and attaches it to the retrieved + * pm_domain ops. To deal with detaching of the virtual device, the ->detach() + * callback in the struct dev_pm_domain are assigned to genpd_dev_pm_detach(). + * + * Returns the created virtual device if successfully attached PM domain, NULL + * when the device don't need a PM domain, else an ERR_PTR() in case of + * failures. If a power-domain exists for the device, but cannot be found or + * turned on, then ERR_PTR(-EPROBE_DEFER) is returned to ensure that the device + * is not probed and to re-try again later. + */ +struct device *genpd_dev_pm_attach_by_id(struct device *dev, + unsigned int index) +{ + struct device *genpd_dev; + int num_domains; + int ret; + + if (!dev->of_node) + return NULL; + + /* Deal only with devices using multiple PM domains. */ + num_domains = of_count_phandle_with_args(dev->of_node, "power-domains", + "#power-domain-cells"); + if (num_domains < 2 || index >= num_domains) + return NULL; + + /* Allocate and register device on the genpd bus. */ + genpd_dev = kzalloc(sizeof(*genpd_dev), GFP_KERNEL); + if (!genpd_dev) + return ERR_PTR(-ENOMEM); + + dev_set_name(genpd_dev, "genpd:%u:%s", index, dev_name(dev)); + genpd_dev->bus = &genpd_bus_type; + genpd_dev->release = genpd_release_dev; + + ret = device_register(genpd_dev); + if (ret) { + kfree(genpd_dev); + return ERR_PTR(ret); + } + + /* Try to attach the device to the PM domain at the specified index. */ + ret = __genpd_dev_pm_attach(genpd_dev, dev->of_node, index); + if (ret < 1) { + device_unregister(genpd_dev); + return ret ? ERR_PTR(ret) : NULL; + } + + pm_runtime_set_active(genpd_dev); + pm_runtime_enable(genpd_dev); + + return genpd_dev; +} +EXPORT_SYMBOL_GPL(genpd_dev_pm_attach_by_id); + static const struct of_device_id idle_state_match[] = { { .compatible = "domain-idle-state", }, { } @@ -2457,6 +2531,12 @@ unsigned int of_genpd_opp_to_performance_state(struct device *dev, } EXPORT_SYMBOL_GPL(of_genpd_opp_to_performance_state); +static int __init genpd_bus_init(void) +{ + return bus_register(&genpd_bus_type); +} +core_initcall(genpd_bus_init); + #endif /* CONFIG_PM_GENERIC_DOMAINS_OF */ diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 42e0d649e653..82458e8e2e01 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -237,6 +237,8 @@ unsigned int of_genpd_opp_to_performance_state(struct device *dev, struct device_node *opp_node); int genpd_dev_pm_attach(struct device *dev); +struct device *genpd_dev_pm_attach_by_id(struct device *dev, + unsigned int index); #else /* !CONFIG_PM_GENERIC_DOMAINS_OF */ static inline int of_genpd_add_provider_simple(struct device_node *np, struct generic_pm_domain *genpd) @@ -282,6 +284,12 @@ static inline int genpd_dev_pm_attach(struct device *dev) return 0; } +static inline struct device *genpd_dev_pm_attach_by_id(struct device *dev, + unsigned int index) +{ + return NULL; +} + static inline struct generic_pm_domain *of_genpd_remove_last(struct device_node *np) { From patchwork Tue May 29 10:04:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 137143 Delivered-To: patches@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3845576lji; Tue, 29 May 2018 03:04:43 -0700 (PDT) X-Received: by 2002:a19:eb4d:: with SMTP id j74-v6mr8659350lfh.1.1527588283195; Tue, 29 May 2018 03:04:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527588283; cv=none; d=google.com; s=arc-20160816; b=cp8pAWCKsqerKjHGz4l8uRC/LDksOPe/ugLcjD6CTjVgtBu+GWyRWntHXT9Vpkc9Em 6Argr886Y1bqLkvYvV8iLda6OUET60QZ5wKjc+PqWM9vcKv8EKjzepIFFSWVS6eVkD0e X+dDAAHfUjTmRlq2Yy82EZ8k5vHydZtF74C/wbTYnZU37UQwzqlE1fzKtLPM2wfbyZJR vUPO4fFAEt6muwthGVi/SnKxdrsuDPqdJQGX6vRIOqgxo7TX4VCJHqzLjxhitrIymdMj sIrYwnj86qw+2cBO2rGnZe8XrMqcmgdjUVB/h62fcN/d6vhnVNCeNoPqZZrs3+d917Nk zwrA== 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=26+aFTQcf8NYAmN2QvZuXP7NjVudzK5mSbJ9dDrOxiE=; b=l2rBvfgXGwnVMjZdcD/tQrnbLntWsn7oY2uGaPas8QxXCjHUKGoFhJNwfbBD7B4Zf6 HqbaMa8KF+gR8IWIo90B/WCDkdtVonUwicgycwxnb7d9QRPJ65svrMObPXWlzIShuEMO rLkOnupVB0s530ALtXM4YlPQrTFmSWmAti07yH74Odd/dJITdHunJhHapzOAOZBl0bRe OuJsjB2GLjjl0LgYi8L+cAX2GpTpriGG0AT2/ek0z6NIM8um244qFsG14kor1ggzzOeO zoPbtc1S2e/CAOlEBFPITyg/avGB6T/bAejrXOPEwtHqVyL9kH8mV9Sa3IH6xxmbvgBG NOeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ecNCmJsd; 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 142-v6sor7441702ljj.43.2018.05.29.03.04.43 for (Google Transport Security); Tue, 29 May 2018 03:04:43 -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=ecNCmJsd; 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=26+aFTQcf8NYAmN2QvZuXP7NjVudzK5mSbJ9dDrOxiE=; b=ecNCmJsd9VWpG9MyI81I76oV8PL2zVXy1+IbyAK/4m8OCwk65hXqimHuJsJCkwrs2S sqUpv45VVoDFv4ZGBXkOy9Tn38tMC/XRQAkR6OAUrDoe79YKVhiQMYrSbMdSpjAKOAtw en1I3yRfN7ewd4NHbeWuXayE7NZdmPC9kqQTg= 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=26+aFTQcf8NYAmN2QvZuXP7NjVudzK5mSbJ9dDrOxiE=; b=OXnB/1d+xuA9HyCIBcS6FyXbXXY4OhV7TtRtIT2tA5786y+sx2JV/KJAgaekb5xhO1 /Vqw+jzgXCMcAt9ICWMaDmMufvhlRcOcKJ8Z61LNf6PxxUu+8a8JUAk5yxy7j+T/qQ+Z O/CCNOQXo5rWUe/dYjCFYLz+p7OvsPsfU2CjHg1902bl7YWTkk3SW/89R7ThggHnunXc WIdJJXSZGd/2lFfKmmNMwxBCHvYaGKAXL0/JUrM2B0YbblsCcMKi5su3HxwMPjfefE6X 0prEKNQ8U8liZ4HUAluaQfhUKCXiQmCxILZ2bnmnuxHwcrYFFFvHxm+Q4NNaPikazzP4 mdrg== X-Gm-Message-State: ALKqPwci4bg9cJxTmKy6/h982N4noHsq1zQGGe+Bo5RvpmDMnGyFzELg 7yFmh50sNyx5pBrEVgc2tWZpVo7J X-Google-Smtp-Source: AB8JxZpdKnqoAWTu+BP+iszsxtDqrRYbPFEHVsqKwfrR620KrIjmigbhfpmoIg+HE8fwIvl1uRExAg== X-Received: by 2002:a2e:9d95:: with SMTP id c21-v6mr10799697ljj.89.1527588282866; Tue, 29 May 2018 03:04:42 -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 e21-v6sm2561718lfg.74.2018.05.29.03.04.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 03:04:42 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Ulf Hansson , Greg Kroah-Hartman , Jon Hunter , Geert Uytterhoeven , Todor Tomov , Rajendra Nayak , Viresh Kumar , Vincent Guittot , Kevin Hilman , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org Subject: [PATCH v2 9/9] PM / Domains: Add dev_pm_domain_attach_by_id() to manage multi PM domains Date: Tue, 29 May 2018 12:04:21 +0200 Message-Id: <20180529100421.31022-10-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180529100421.31022-1-ulf.hansson@linaro.org> References: <20180529100421.31022-1-ulf.hansson@linaro.org> The existing dev_pm_domain_attach() function, allows a single PM domain to be attached per device. To be able to support devices that are partitioned across multiple PM domains, let's introduce a new interface, dev_pm_domain_attach_by_id(). The dev_pm_domain_attach_by_id() returns a new allocated struct device with the corresponding attached PM domain. This enables for example a driver to operate on the new device from a power management point of view. The driver may then also benefit from using the received device, to set up so called device-links towards its original device. Depending on the situation, these links may then be dynamically changed. The new interface is typically called by drivers during their probe phase, in case they manages devices which uses multiple PM domains. If that is the case, the driver also becomes responsible of managing the detaching of the PM domains, which typically should be done at the remove phase. Detaching is done by calling the existing dev_pm_domain_detach() function and for each of the received devices from dev_pm_domain_attach_by_id(). Note, currently its only genpd that supports multiple PM domains per device, but dev_pm_domain_attach_by_id() can easily by extended to cover other PM domain types, if/when needed. Signed-off-by: Ulf Hansson --- Changes in v2: - Fixed comments from Jon. Clarified function descriptions/changelog and return ERR_PTR(-EEXIST) in case a PM domain is already assigned. - Fix build error when CONFIG_PM is unset. --- drivers/base/power/common.c | 43 ++++++++++++++++++++++++++++++++++--- include/linux/pm_domain.h | 7 ++++++ 2 files changed, 47 insertions(+), 3 deletions(-) -- 2.17.0 diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c index 7ae62b6355b8..5e5ea0c239de 100644 --- a/drivers/base/power/common.c +++ b/drivers/base/power/common.c @@ -116,14 +116,51 @@ int dev_pm_domain_attach(struct device *dev, bool power_on) } EXPORT_SYMBOL_GPL(dev_pm_domain_attach); +/** + * dev_pm_domain_attach_by_id - Attach a device to one of its PM domains. + * @dev: Device to attach. + * @index: The index of the PM domain. + * + * As @dev may only be attached to a single PM domain, the backend PM domain + * provider creates a virtual device to attach instead. If attachment succeeds, + * the ->detach() callback in the struct dev_pm_domain are assigned by the + * corresponding backend attach function, as to deal with detaching of the + * created virtual device. + * + * This function should typically be invoked by a driver during the probe phase, + * in case its device requires power management through multiple PM domains. The + * driver may benefit from using the received device, to configure device-links + * towards its original device. Depending on the use-case and if needed, the + * links may be dynamically changed by the driver, which allows it to control + * the power to the PM domains independently from each other. + * + * Callers must ensure proper synchronization of this function with power + * management callbacks. + * + * Returns the virtual created device when successfully attached to its PM + * domain, NULL in case @dev don't need a PM domain, else an ERR_PTR(). + * Note that, to detach the returned virtual device, the driver shall call + * dev_pm_domain_detach() on it, typically during the remove phase. + */ +struct device *dev_pm_domain_attach_by_id(struct device *dev, + unsigned int index) +{ + if (dev->pm_domain) + return ERR_PTR(-EEXIST); + + return genpd_dev_pm_attach_by_id(dev, index); +} +EXPORT_SYMBOL_GPL(dev_pm_domain_attach_by_id); + /** * dev_pm_domain_detach - Detach a device from its PM domain. * @dev: Device to detach. * @power_off: Used to indicate whether we should power off the device. * - * This functions will reverse the actions from dev_pm_domain_attach() and thus - * try to detach the @dev from its PM domain. Typically it should be invoked - * from subsystem level code during the remove phase. + * This functions will reverse the actions from dev_pm_domain_attach() and + * dev_pm_domain_attach_by_id(), thus it detaches @dev from its PM domain. + * Typically it should be invoked during the remove phase, either from + * subsystem level code or from drivers. * * Callers must ensure proper synchronization of this function with power * management callbacks. diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 82458e8e2e01..9206a4fef9ac 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -299,6 +299,8 @@ struct generic_pm_domain *of_genpd_remove_last(struct device_node *np) #ifdef CONFIG_PM int dev_pm_domain_attach(struct device *dev, bool power_on); +struct device *dev_pm_domain_attach_by_id(struct device *dev, + unsigned int index); void dev_pm_domain_detach(struct device *dev, bool power_off); void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd); #else @@ -306,6 +308,11 @@ static inline int dev_pm_domain_attach(struct device *dev, bool power_on) { return 0; } +static inline struct device *dev_pm_domain_attach_by_id(struct device *dev, + unsigned int index) +{ + return NULL; +} static inline void dev_pm_domain_detach(struct device *dev, bool power_off) {} static inline void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd) {}