Patch "PM / devfreq: Fix available_governor sysfs" has been added to the 4.10-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
PM / devfreq: Fix available_governor sysfs
to the 4.10-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
pm-devfreq-fix-available_governor-sysfs.patch
and it can be found in the queue-4.10 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
bcf23c79c4e46130701370af4383b61a3cba755cMon Sep 17 00:00:00 2001
From: Chanwoo Choi <[email protected]>
Date: Tue, 31 Jan 2017 15:38:16 +0900
Subject: PM / devfreq: Fix available_governor sysfs
From: Chanwoo Choi <[email protected]>
commit bcf23c79c4e46130701370af4383b61a3cba755c upstream.
The devfreq using passive governor is not able to change the governor. So, the user can not change the governor through 'available_governor' sysfs entry. Also, the devfreq which don't use the passive governor is not able to change to 'passive' governor on the fly.
--- drivers/devfreq/devfreq.c | 31 +++++++++++++++++++++++++++---- drivers/devfreq/governor_passive.c | 1 + include/linux/devfreq.h | 3 +++ 3 files changed, 31 insertions(+), 4 deletions(-)
drivers/devfreq/devfreq.c +27 -4
@@ -939,6 +939,9 @@ static ssize_t governor_store(struct devif (df->governor == governor) { ret =0 ; goto out; + }else if (df->governor->immutable || governor->immutable) { + ret = -EINVAL ; + goto out; }if (df->governor) {
@@ -968,13 +971,33 @@ static ssize_t available_governors_show(struct device_attribute *attr, char *buf) { - struct devfreq_governor *tmp_governor; + struct devfreq *df = to_devfreq(d);ssize_t count =0 ;mutex_lock (&devfreq_list_lock); -list_for_each_entry (tmp_governor, &devfreq_governor_list, node) - count +=scnprintf (&buf[count], (PAGE_SIZE - count -2 ), -"%s " , tmp_governor->name); + +/* +* The devfreq with immutable governor (e.g., passive) shows +* only own governor. +*/ +if (df->governor->immutable) { + count =scnprintf (&buf[count],DEVFREQ_NAME_LEN , +"%s " , df->governor_name); +/* +* The devfreq device shows the registered governor except for +* immutable governors such as passive governor . +*/ + }else { +struct devfreq_governor *governor; + +list_for_each_entry (governor, &devfreq_governor_list, node) { +if (governor->immutable) +continue ; + count +=scnprintf (&buf[count], (PAGE_SIZE - count -2 ), +"%s " , governor->name); + } + } +mutex_unlock (&devfreq_list_lock);/* Truncate the trailing space */
drivers/devfreq/governor_passive.c +1 -0
@@ -179,6 +179,7 @@ static int devfreq_passive_event_handlerstatic struct devfreq_governor devfreq_passive = { .name ="passive" , + .immutable =1 , .get_target_freq = devfreq_passive_get_target_freq, .event_handler = devfreq_passive_event_handler, };
include/linux/devfreq.h +3 -0
@@ -104,6 +104,8 @@ struct devfreq_dev_profile {* struct devfreq_governor - Devfreq policy governor * @node: list node - contains registered devfreq governors * @name: Governor's name +* @immutable: Immutable flag for governor. If the value is 1, +* this govenror is never changeable to other governor. * @get_target_freq: Returns desired operating frequency for the device. * Basically, get_target_freq will run * devfreq_dev_profile.get_dev_status() to get the
@@ -121,6 +123,7 @@ struct devfreq_governor {struct list_head node;const char name[DEVFREQ_NAME_LEN ]; +const unsigned int immutable;int (*get_target_freq)(struct devfreq *this,unsigned long *freq);int (*event_handler)(struct devfreq *devfreq,unsigned int event,void *data);
Patches currently in stable-queue which might be from [email protected] are
queue-4.10/pm-devfreq-fix-wrong-trans_stat-of-passive-devfreq-device.patch queue-4.10/pm-devfreq-fix-available_governor-sysfs.patch