Skip to content

Commit 49f618e

Browse files
Ulf Hanssonrafaeljw
authored andcommitted
PM: domains: Rename power state enums for genpd
To clarify the code a bit, let's rename GPD_STATE_ACTIVE into GENPD_STATE_ON and GPD_STATE_POWER_OFF to GENPD_STATE_OFF. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> [ rjw: Subject edit ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent a1b8638 commit 49f618e

2 files changed

Lines changed: 18 additions & 19 deletions

File tree

drivers/base/power/domain.c

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static const struct genpd_lock_ops genpd_spin_ops = {
123123
#define genpd_lock_interruptible(p) p->lock_ops->lock_interruptible(p)
124124
#define genpd_unlock(p) p->lock_ops->unlock(p)
125125

126-
#define genpd_status_on(genpd) (genpd->status == GPD_STATE_ACTIVE)
126+
#define genpd_status_on(genpd) (genpd->status == GENPD_STATE_ON)
127127
#define genpd_is_irq_safe(genpd) (genpd->flags & GENPD_FLAG_IRQ_SAFE)
128128
#define genpd_is_always_on(genpd) (genpd->flags & GENPD_FLAG_ALWAYS_ON)
129129
#define genpd_is_active_wakeup(genpd) (genpd->flags & GENPD_FLAG_ACTIVE_WAKEUP)
@@ -222,7 +222,7 @@ static void genpd_update_accounting(struct generic_pm_domain *genpd)
222222
* out of off and so update the idle time and vice
223223
* versa.
224224
*/
225-
if (genpd->status == GPD_STATE_ACTIVE) {
225+
if (genpd->status == GENPD_STATE_ON) {
226226
int state_idx = genpd->state_idx;
227227

228228
genpd->states[state_idx].idle_time =
@@ -563,7 +563,7 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
563563
return ret;
564564
}
565565

566-
genpd->status = GPD_STATE_POWER_OFF;
566+
genpd->status = GENPD_STATE_OFF;
567567
genpd_update_accounting(genpd);
568568

569569
list_for_each_entry(link, &genpd->child_links, child_node) {
@@ -616,7 +616,7 @@ static int genpd_power_on(struct generic_pm_domain *genpd, unsigned int depth)
616616
if (ret)
617617
goto err;
618618

619-
genpd->status = GPD_STATE_ACTIVE;
619+
genpd->status = GENPD_STATE_ON;
620620
genpd_update_accounting(genpd);
621621

622622
return 0;
@@ -961,7 +961,7 @@ static void genpd_sync_power_off(struct generic_pm_domain *genpd, bool use_lock,
961961
if (_genpd_power_off(genpd, false))
962962
return;
963963

964-
genpd->status = GPD_STATE_POWER_OFF;
964+
genpd->status = GENPD_STATE_OFF;
965965

966966
list_for_each_entry(link, &genpd->child_links, child_node) {
967967
genpd_sd_counter_dec(link->parent);
@@ -1007,8 +1007,7 @@ static void genpd_sync_power_on(struct generic_pm_domain *genpd, bool use_lock,
10071007
}
10081008

10091009
_genpd_power_on(genpd, false);
1010-
1011-
genpd->status = GPD_STATE_ACTIVE;
1010+
genpd->status = GENPD_STATE_ON;
10121011
}
10131012

10141013
/**
@@ -1287,7 +1286,7 @@ static int genpd_restore_noirq(struct device *dev)
12871286
* so make it appear as powered off to genpd_sync_power_on(),
12881287
* so that it tries to power it on in case it was really off.
12891288
*/
1290-
genpd->status = GPD_STATE_POWER_OFF;
1289+
genpd->status = GENPD_STATE_OFF;
12911290

12921291
genpd_sync_power_on(genpd, true, 0);
12931292
genpd_unlock(genpd);
@@ -1777,7 +1776,7 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
17771776
genpd->gov = gov;
17781777
INIT_WORK(&genpd->power_off_work, genpd_power_off_work_fn);
17791778
atomic_set(&genpd->sd_count, 0);
1780-
genpd->status = is_off ? GPD_STATE_POWER_OFF : GPD_STATE_ACTIVE;
1779+
genpd->status = is_off ? GENPD_STATE_OFF : GENPD_STATE_ON;
17811780
genpd->device_count = 0;
17821781
genpd->max_off_time_ns = -1;
17831782
genpd->max_off_time_changed = true;
@@ -2802,8 +2801,8 @@ static int genpd_summary_one(struct seq_file *s,
28022801
struct generic_pm_domain *genpd)
28032802
{
28042803
static const char * const status_lookup[] = {
2805-
[GPD_STATE_ACTIVE] = "on",
2806-
[GPD_STATE_POWER_OFF] = "off"
2804+
[GENPD_STATE_ON] = "on",
2805+
[GENPD_STATE_OFF] = "off"
28072806
};
28082807
struct pm_domain_data *pm_data;
28092808
const char *kobj_path;
@@ -2881,8 +2880,8 @@ static int summary_show(struct seq_file *s, void *data)
28812880
static int status_show(struct seq_file *s, void *data)
28822881
{
28832882
static const char * const status_lookup[] = {
2884-
[GPD_STATE_ACTIVE] = "on",
2885-
[GPD_STATE_POWER_OFF] = "off"
2883+
[GENPD_STATE_ON] = "on",
2884+
[GENPD_STATE_OFF] = "off"
28862885
};
28872886

28882887
struct generic_pm_domain *genpd = s->private;
@@ -2895,7 +2894,7 @@ static int status_show(struct seq_file *s, void *data)
28952894
if (WARN_ON_ONCE(genpd->status >= ARRAY_SIZE(status_lookup)))
28962895
goto exit;
28972896

2898-
if (genpd->status == GPD_STATE_POWER_OFF)
2897+
if (genpd->status == GENPD_STATE_OFF)
28992898
seq_printf(s, "%s-%u\n", status_lookup[genpd->status],
29002899
genpd->state_idx);
29012900
else
@@ -2938,7 +2937,7 @@ static int idle_states_show(struct seq_file *s, void *data)
29382937
ktime_t delta = 0;
29392938
s64 msecs;
29402939

2941-
if ((genpd->status == GPD_STATE_POWER_OFF) &&
2940+
if ((genpd->status == GENPD_STATE_OFF) &&
29422941
(genpd->state_idx == i))
29432942
delta = ktime_sub(ktime_get(), genpd->accounting_time);
29442943

@@ -2961,7 +2960,7 @@ static int active_time_show(struct seq_file *s, void *data)
29612960
if (ret)
29622961
return -ERESTARTSYS;
29632962

2964-
if (genpd->status == GPD_STATE_ACTIVE)
2963+
if (genpd->status == GENPD_STATE_ON)
29652964
delta = ktime_sub(ktime_get(), genpd->accounting_time);
29662965

29672966
seq_printf(s, "%lld ms\n", ktime_to_ms(
@@ -2984,7 +2983,7 @@ static int total_idle_time_show(struct seq_file *s, void *data)
29842983

29852984
for (i = 0; i < genpd->state_count; i++) {
29862985

2987-
if ((genpd->status == GPD_STATE_POWER_OFF) &&
2986+
if ((genpd->status == GENPD_STATE_OFF) &&
29882987
(genpd->state_idx == i))
29892988
delta = ktime_sub(ktime_get(), genpd->accounting_time);
29902989

include/linux/pm_domain.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
#define GENPD_FLAG_RPM_ALWAYS_ON (1U << 5)
6565

6666
enum gpd_status {
67-
GPD_STATE_ACTIVE = 0, /* PM domain is active */
68-
GPD_STATE_POWER_OFF, /* PM domain is off */
67+
GENPD_STATE_ON = 0, /* PM domain is on */
68+
GENPD_STATE_OFF, /* PM domain is off */
6969
};
7070

7171
struct dev_power_governor {

0 commit comments

Comments
 (0)