Skip to content

Commit 0e3b667

Browse files
committed
pmdomain: core: Convert genpd_power_off() to void
At some point it made sense to have genpd_power_off() to return an error code. That hasn't been the case for quite some time, so let's convert it into a static void function and simplify some of the corresponding code. Reviewed-by: Abel Vesa <abel.vesa@linaro.org> Tested-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20250417142513.312939-2-ulf.hansson@linaro.org
1 parent 4133b1c commit 0e3b667

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

drivers/pmdomain/core.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -908,21 +908,20 @@ static void genpd_queue_power_off_work(struct generic_pm_domain *genpd)
908908
* If all of the @genpd's devices have been suspended and all of its subdomains
909909
* have been powered down, remove power from @genpd.
910910
*/
911-
static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
912-
unsigned int depth)
911+
static void genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
912+
unsigned int depth)
913913
{
914914
struct pm_domain_data *pdd;
915915
struct gpd_link *link;
916916
unsigned int not_suspended = 0;
917-
int ret;
918917

919918
/*
920919
* Do not try to power off the domain in the following situations:
921920
* (1) The domain is already in the "power off" state.
922921
* (2) System suspend is in progress.
923922
*/
924923
if (!genpd_status_on(genpd) || genpd->prepared_count > 0)
925-
return 0;
924+
return;
926925

927926
/*
928927
* Abort power off for the PM domain in the following situations:
@@ -932,7 +931,7 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
932931
if (genpd_is_always_on(genpd) ||
933932
genpd_is_rpm_always_on(genpd) ||
934933
atomic_read(&genpd->sd_count) > 0)
935-
return -EBUSY;
934+
return;
936935

937936
/*
938937
* The children must be in their deepest (powered-off) states to allow
@@ -943,7 +942,7 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
943942
list_for_each_entry(link, &genpd->parent_links, parent_node) {
944943
struct generic_pm_domain *child = link->child;
945944
if (child->state_idx < child->state_count - 1)
946-
return -EBUSY;
945+
return;
947946
}
948947

949948
list_for_each_entry(pdd, &genpd->dev_list, list_node) {
@@ -957,15 +956,15 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
957956

958957
/* The device may need its PM domain to stay powered on. */
959958
if (to_gpd_data(pdd)->rpm_always_on)
960-
return -EBUSY;
959+
return;
961960
}
962961

963962
if (not_suspended > 1 || (not_suspended == 1 && !one_dev_on))
964-
return -EBUSY;
963+
return;
965964

966965
if (genpd->gov && genpd->gov->power_down_ok) {
967966
if (!genpd->gov->power_down_ok(&genpd->domain))
968-
return -EAGAIN;
967+
return;
969968
}
970969

971970
/* Default to shallowest state. */
@@ -974,12 +973,11 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
974973

975974
/* Don't power off, if a child domain is waiting to power on. */
976975
if (atomic_read(&genpd->sd_count) > 0)
977-
return -EBUSY;
976+
return;
978977

979-
ret = _genpd_power_off(genpd, true);
980-
if (ret) {
978+
if (_genpd_power_off(genpd, true)) {
981979
genpd->states[genpd->state_idx].rejected++;
982-
return ret;
980+
return;
983981
}
984982

985983
genpd->status = GENPD_STATE_OFF;
@@ -992,8 +990,6 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
992990
genpd_power_off(link->parent, false, depth + 1);
993991
genpd_unlock(link->parent);
994992
}
995-
996-
return 0;
997993
}
998994

999995
/**

0 commit comments

Comments
 (0)