All of lore.kernel.org
 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 v2 3/9] PM / Domains: Drop genpd as in-param for pm_genpd_remove_device()
Date: Tue, 29 May 2018 12:04:15 +0200	[thread overview]
Message-ID: <20180529100421.31022-4-ulf.hansson@linaro.org> (raw)
In-Reply-To: <20180529100421.31022-1-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 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;
 }
-- 
2.17.0

WARNING: multiple messages have this Message-ID (diff)
From: ulf.hansson@linaro.org (Ulf Hansson)
To: linux-arm-kernel@lists.infradead.org
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	[thread overview]
Message-ID: <20180529100421.31022-4-ulf.hansson@linaro.org> (raw)
In-Reply-To: <20180529100421.31022-1-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 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;
 }
-- 
2.17.0

  parent reply	other threads:[~2018-05-29 10:04 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-29 10:04 [PATCH v2 0/9] PM / Domains: Add support for multi PM domains per device Ulf Hansson
2018-05-29 10:04 ` Ulf Hansson
2018-05-29 10:04 ` [PATCH v2 1/9] PM / Domains: Drop extern declarations of functions in pm_domain.h Ulf Hansson
2018-05-29 10:04   ` Ulf Hansson
2018-05-29 10:04   ` Ulf Hansson
2018-05-31  6:12   ` Viresh Kumar
2018-05-31  6:12     ` Viresh Kumar
2018-05-29 10:04 ` [PATCH v2 2/9] PM / Domains: Drop __pm_genpd_add_device() Ulf Hansson
2018-05-29 10:04   ` Ulf Hansson
2018-05-31  6:13   ` Viresh Kumar
2018-05-31  6:13     ` Viresh Kumar
2018-05-29 10:04 ` Ulf Hansson [this message]
2018-05-29 10:04   ` [PATCH v2 3/9] PM / Domains: Drop genpd as in-param for pm_genpd_remove_device() Ulf Hansson
2018-05-31  6:15   ` Viresh Kumar
2018-05-31  6:15     ` Viresh Kumar
2018-05-29 10:04 ` [PATCH v2 4/9] PM / Domains: Drop unused parameter in genpd_allocate_dev_data() Ulf Hansson
2018-05-29 10:04   ` Ulf Hansson
2018-05-31  6:16   ` Viresh Kumar
2018-05-31  6:16     ` Viresh Kumar
2018-05-29 10:04 ` [PATCH v2 5/9] PM / Domains: dt: Allow power-domain property to be a list of specifiers Ulf Hansson
2018-05-29 10:04   ` Ulf Hansson
2018-05-31  3:53   ` Rob Herring
2018-05-31  3:53     ` Rob Herring
2018-05-31  6:18   ` Viresh Kumar
2018-05-31  6:18     ` Viresh Kumar
2018-05-29 10:04 ` [PATCH v2 6/9] PM / Domains: Don't attach devices in genpd with multi PM domains Ulf Hansson
2018-05-29 10:04   ` Ulf Hansson
2018-05-30 16:06   ` Jon Hunter
2018-05-30 16:06     ` Jon Hunter
2018-05-30 16:06     ` Jon Hunter
2018-05-29 10:04 ` [PATCH v2 7/9] PM / Domains: Split genpd_dev_pm_attach() Ulf Hansson
2018-05-29 10:04   ` Ulf Hansson
2018-05-30 16:08   ` Jon Hunter
2018-05-30 16:08     ` Jon Hunter
2018-05-30 16:08     ` Jon Hunter
2018-05-31  7:04   ` Viresh Kumar
2018-05-31  7:04     ` Viresh Kumar
2018-05-29 10:04 ` [PATCH v2 8/9] PM / Domains: Add support for multi PM domains per device to genpd Ulf Hansson
2018-05-29 10:04   ` Ulf Hansson
2018-05-30 16:04   ` Jon Hunter
2018-05-30 16:04     ` Jon Hunter
2018-05-30 16:04     ` Jon Hunter
2018-05-31  6:17     ` Ulf Hansson
2018-05-31  6:17       ` Ulf Hansson
2018-05-31  8:03       ` Jon Hunter
2018-05-31  8:03         ` Jon Hunter
2018-05-31  8:03         ` Jon Hunter
2018-05-31 10:44         ` Ulf Hansson
2018-05-31 10:44           ` Ulf Hansson
2018-05-31 10:48           ` Jon Hunter
2018-05-31 10:48             ` Jon Hunter
2018-05-31 10:48             ` Jon Hunter
2018-05-29 10:04 ` [PATCH v2 9/9] PM / Domains: Add dev_pm_domain_attach_by_id() to manage multi PM domains Ulf Hansson
2018-05-29 10:04   ` Ulf Hansson
2018-05-30  9:19   ` Jon Hunter
2018-05-30  9:19     ` Jon Hunter
2018-05-30  9:19     ` Jon Hunter
2018-05-30 11:31     ` Ulf Hansson
2018-05-30 11:31       ` Ulf Hansson
2018-05-30 14:30       ` Jon Hunter
2018-05-30 14:30         ` Jon Hunter
2018-05-30 14:30         ` Jon Hunter
2018-06-27  8:55         ` Rajendra Nayak
2018-06-27  8:55           ` Rajendra Nayak
2018-06-27  9:05           ` Ulf Hansson
2018-06-27  9:05             ` Ulf Hansson
2018-06-27  9:29             ` Rajendra Nayak
2018-06-27  9:29               ` Rajendra Nayak
2018-05-30  9:30 ` [PATCH v2 0/9] PM / Domains: Add support for multi PM domains per device Rafael J. Wysocki
2018-05-30  9:30   ` Rafael J. Wysocki
2018-05-30 11:34   ` Ulf Hansson
2018-05-30 11:34     ` Ulf Hansson
2018-05-31  9:14 ` Viresh Kumar
2018-05-31  9:14   ` Viresh Kumar
2018-05-31 10:47   ` Ulf Hansson
2018-05-31 10:47     ` 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=20180529100421.31022-4-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.