Skip to content

Commit 9c74f2a

Browse files
Ulf Hanssonrafaeljw
authored andcommitted
PM: domains: Move the next_wakeup variable into the struct gpd_timing_data
If the corresponding genpd for the device doesn't use a governor, the variable next_wakeup within the struct generic_pm_domain_data becomes superfluous. To avoid wasting memory, let's move it into the struct gpd_timing_data, which is already being allocated based upon if there is governor assigned. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 66d29d8 commit 9c74f2a

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

drivers/base/power/domain.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,15 +478,16 @@ EXPORT_SYMBOL_GPL(dev_pm_genpd_set_performance_state);
478478
*/
479479
void dev_pm_genpd_set_next_wakeup(struct device *dev, ktime_t next)
480480
{
481-
struct generic_pm_domain_data *gpd_data;
482481
struct generic_pm_domain *genpd;
482+
struct gpd_timing_data *td;
483483

484484
genpd = dev_to_genpd_safe(dev);
485485
if (!genpd)
486486
return;
487487

488-
gpd_data = to_gpd_data(dev->power.subsys_data->domain_data);
489-
gpd_data->next_wakeup = next;
488+
td = to_gpd_data(dev->power.subsys_data->domain_data)->td;
489+
if (td)
490+
td->next_wakeup = next;
490491
}
491492
EXPORT_SYMBOL_GPL(dev_pm_genpd_set_next_wakeup);
492493

@@ -1518,7 +1519,6 @@ static struct generic_pm_domain_data *genpd_alloc_dev_data(struct device *dev,
15181519

15191520
gpd_data->base.dev = dev;
15201521
gpd_data->nb.notifier_call = genpd_dev_pm_qos_notifier;
1521-
gpd_data->next_wakeup = KTIME_MAX;
15221522

15231523
/* Allocate data used by a governor. */
15241524
if (has_governor) {
@@ -1530,6 +1530,7 @@ static struct generic_pm_domain_data *genpd_alloc_dev_data(struct device *dev,
15301530

15311531
td->constraint_changed = true;
15321532
td->effective_constraint_ns = PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS;
1533+
td->next_wakeup = KTIME_MAX;
15331534
gpd_data->td = td;
15341535
}
15351536

drivers/base/power/domain_governor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static void update_domain_next_wakeup(struct generic_pm_domain *genpd, ktime_t n
139139
* is able to enter its optimal idle state.
140140
*/
141141
list_for_each_entry(pdd, &genpd->dev_list, list_node) {
142-
next_wakeup = to_gpd_data(pdd)->next_wakeup;
142+
next_wakeup = to_gpd_data(pdd)->td->next_wakeup;
143143
if (next_wakeup != KTIME_MAX && !ktime_before(next_wakeup, now))
144144
if (ktime_before(next_wakeup, domain_wakeup))
145145
domain_wakeup = next_wakeup;

include/linux/pm_domain.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ struct gpd_timing_data {
182182
s64 suspend_latency_ns;
183183
s64 resume_latency_ns;
184184
s64 effective_constraint_ns;
185+
ktime_t next_wakeup;
185186
bool constraint_changed;
186187
bool cached_suspend_ok;
187188
};
@@ -200,7 +201,6 @@ struct generic_pm_domain_data {
200201
unsigned int performance_state;
201202
unsigned int default_pstate;
202203
unsigned int rpm_pstate;
203-
ktime_t next_wakeup;
204204
void *data;
205205
};
206206

0 commit comments

Comments
 (0)