PM / devfreq: Use freq_table for available_frequencies
함명주
NAKQuoted 5 lines
MyungJoo/Kyungmin,
Bump. Can we accept this patch please?
-Saravana
Nack.
Please note that freq_table is also an optional value, which may be null.
Besides, please be aware that your code is under rcu_read_lock().
Cheers,
MyungJoo.
ps. I'll send a related patch (avoid accessing null but not-an-error pointer at other sysfs nodes). Thank you for letting me catch such bugs anyway.
Quoted 60 lines · Saravana Kannan
Quoted 45 lines
Some devices use
freq_tableinstead of OPP. For those devices, theavailable_frequenciesfile shows up empty. Fix that by usingfreq_tableto generate theavailable_frequenciesdata when OPP is not present.Signed-off-by Saravana Kannan <[email protected]>--- drivers/devfreq/devfreq.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)drivers/devfreq/devfreq.c +11
-4@@ -912,19 +912,26 @@ static ssize_t available_frequencies_show(struct device *d,struct devfreq *df =to_devfreq (d);struct device *dev = df->dev.parent;struct dev_pm_opp *opp; +unsigned int i =0 , max_state = df->profile->max_state; +bool use_opp;ssize_t count =0 ;unsigned long freq =0 ;rcu_read_lock (); + use_opp =dev_pm_opp_get_opp_count (dev) >0 ;do { - opp =dev_pm_opp_find_freq_ceil (dev, &freq); -if (IS_ERR (opp)) -break ; +if (use_opp) { + opp =dev_pm_opp_find_freq_ceil (dev, &freq); +if (IS_ERR (opp)) +break ; + }else { + freq = df->profile->freq_table[i++]; + } count +=scnprintf (&buf[count], (PAGE_SIZE - count -2 ),"%lu " , freq); freq++; - }while (1 ); + }while (use_opp || (!use_opp && i < max_state));rcu_read_unlock ();/* Truncate the trailing space */ Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Quoted 10 lines · ???
Quoted 5 lines
MyungJoo/Kyungmin,
Bump. Can we accept this patch please?
-Saravana
Nack.
Please note that
freq_tableis also an optional value, which may be null.
Ah, I saw that the max_freq would be zero if freq_table was NULL and I assumed that it can't be NULL. But I see that the max_freq limit is not applied if it's zero. Thanks for catching it.
Quoted 1 line
Besides, please be aware that your code is under
rcu_read_lock().
Valid point. I was just trying to keep the diff simple. No one's really going to be catting this file often when performance matters.
Quoted 7 lines
Cheers,
MyungJoo.ps. I'll send a related patch (avoid accessing null but not-an-error pointer at other sysfs nodes). Thank you for letting me catch such bugs anyway.
I can go ahead and do this myself if you don't mind.
-Saravana
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation