linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: "Rafael J . Wysocki" <rjw@rjwysocki.net>, linux-pm@vger.kernel.org
Cc: "Ulf Hansson" <ulf.hansson@linaro.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jon Hunter" <jonathanh@nvidia.com>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Todor Tomov" <todor.tomov@linaro.org>,
	"Rajendra Nayak" <rnayak@codeaurora.org>,
	"Viresh Kumar" <viresh.kumar@linaro.org>,
	"Vincent Guittot" <vincent.guittot@linaro.org>,
	"Kevin Hilman" <khilman@kernel.org>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-tegra@vger.kernel.org,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"David Zhou" <David1.Zhou@amd.com>
Subject: [PATCH 3/9] PM / Domains: Drop genpd as in-param for pm_genpd_remove_device()
Date: Fri, 18 May 2018 12:31:24 +0200	[thread overview]
Message-ID: <1526639490-12167-4-git-send-email-ulf.hansson@linaro.org> (raw)
In-Reply-To: <1526639490-12167-1-git-send-email-ulf.hansson@linaro.org>

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 <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: David (ChunMing) Zhou <David1.Zhou@amd.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 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(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index d58aee3..f08fa15 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 a29362f..1255804 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 79888fb..42e0d64 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;
 }
-- 
2.7.4

  parent reply	other threads:[~2018-05-18 10:33 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18 10:31 [PATCH 0/9] PM / Domains: Add support for multi PM domains per device Ulf Hansson
2018-05-18 10:31 ` [PATCH 1/9] PM / Domains: Drop extern declarations of functions in pm_domain.h Ulf Hansson
2018-05-18 10:31 ` [PATCH 2/9] PM / Domains: Drop __pm_genpd_add_device() Ulf Hansson
2018-05-18 10:31 ` Ulf Hansson [this message]
2018-05-18 10:31 ` [PATCH 4/9] PM / Domains: Drop unused parameter in genpd_allocate_dev_data() Ulf Hansson
2018-05-18 10:31 ` [PATCH 5/9] PM / Domains: dt: Allow power-domain property to be a list of phandles Ulf Hansson
2018-05-18 10:46   ` Geert Uytterhoeven
2018-05-18 10:31 ` [PATCH 6/9] PM / Domains: Don't attach devices in genpd with multi PM domains Ulf Hansson
2018-05-18 10:31 ` [PATCH 7/9] PM / Domains: Split genpd_dev_pm_attach() Ulf Hansson
2018-05-18 10:31 ` [PATCH 8/9] PM / Domains: Add support for multi PM domains per device to genpd Ulf Hansson
2018-05-22 14:31   ` Jon Hunter
2018-05-22 14:47     ` Ulf Hansson
2018-05-22 20:55       ` Jon Hunter
2018-05-23  4:51         ` Rajendra Nayak
2018-05-23  6:12           ` Ulf Hansson
2018-05-23  9:07             ` Jon Hunter
2018-05-23  9:27               ` Rajendra Nayak
2018-05-23  9:33                 ` Ulf Hansson
2018-05-23  9:45                   ` Jon Hunter
2018-05-23  9:47                     ` Ulf Hansson
2018-05-23 10:22                       ` Jon Hunter
2018-05-24  7:04               ` Ulf Hansson
2018-05-24  9:36                 ` Jon Hunter
2018-05-24 12:17                   ` Ulf Hansson
2018-05-24 14:34                     ` Jon Hunter
2018-05-24 21:21                       ` Ulf Hansson
2018-05-25  8:22                         ` Jon Hunter
2018-05-18 10:31 ` [PATCH 9/9] PM / Domains: Add dev_pm_domain_attach_by_id() to manage multi PM domains Ulf Hansson
2018-05-24 15:48   ` Jon Hunter
2018-05-24 21:11     ` Ulf Hansson
2018-05-25  8:31       ` Jon Hunter
2018-05-25 10:45         ` Ulf Hansson
2018-05-25 11:07           ` Jon Hunter
2018-05-25 12:34             ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1526639490-12167-4-git-send-email-ulf.hansson@linaro.org \
    --to=ulf.hansson@linaro.org \
    --cc=David1.Zhou@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=jonathanh@nvidia.com \
    --cc=khilman@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=rnayak@codeaurora.org \
    --cc=todor.tomov@linaro.org \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).