mirror of
https://github.com/torvalds/linux.git
synced 2025-11-05 03:00:13 +02:00
PM: EM: Add em_perf_state_from_pd() to get performance states table
Introduce a wrapper to get the performance states table of the performance domain. The function should be called within the RCU read critical section. Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com> Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
977230d5d5
commit
ee1a19873c
1 changed files with 22 additions and 0 deletions
|
|
@ -338,6 +338,23 @@ static inline int em_pd_nr_perf_states(struct em_perf_domain *pd)
|
||||||
return pd->nr_perf_states;
|
return pd->nr_perf_states;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* em_perf_state_from_pd() - Get the performance states table of perf.
|
||||||
|
* domain
|
||||||
|
* @pd : performance domain for which this must be done
|
||||||
|
*
|
||||||
|
* To use this function the rcu_read_lock() should be hold. After the usage
|
||||||
|
* of the performance states table is finished, the rcu_read_unlock() should
|
||||||
|
* be called.
|
||||||
|
*
|
||||||
|
* Return: the pointer to performance states table of the performance domain
|
||||||
|
*/
|
||||||
|
static inline
|
||||||
|
struct em_perf_state *em_perf_state_from_pd(struct em_perf_domain *pd)
|
||||||
|
{
|
||||||
|
return rcu_dereference(pd->em_table)->state;
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
struct em_data_callback {};
|
struct em_data_callback {};
|
||||||
#define EM_ADV_DATA_CB(_active_power_cb, _cost_cb) { }
|
#define EM_ADV_DATA_CB(_active_power_cb, _cost_cb) { }
|
||||||
|
|
@ -384,6 +401,11 @@ int em_dev_update_perf_domain(struct device *dev,
|
||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
static inline
|
||||||
|
struct em_perf_state *em_perf_state_from_pd(struct em_perf_domain *pd)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue