Devfreq provides the multiple governors and sysfs interface for user. But, some sysfs attributes are useful or not useful. Prior to that the user can access all sysfs attributes regardless of availability.
So, clarify the access permission of sysfs attributes according to governor. Provide the governor flag to specify what is necessary or not. When adding the devfreq governor, governor can specify the available attributes with DEVFREQ_GOV_ATTR_ATTR_* defintion as following. [Definition for sysfs attributes] - DEVFREQ_GOV_ATTR_GOVERNOR - DEVFREQ_GOV_ATTR_AVAIL_GOVERNORS - DEVFREQ_GOV_ATTR_AVAIL_FREQUENCIES - DEVFREQ_GOV_ATTR_CUR_FREQ - DEVFREQ_GOV_ATTR_TARGET_FREQ - DEVFREQ_GOV_ATTR_MIN_FREQ - DEVFREQ_GOV_ATTR_MAX_FREQ - DEVFREQ_GOV_ATTR_TRANS_STAT - DEVFREQ_GOV_ATTR_POLLING_INTERVAL - DEVFREQ_GOV_ATTR_TIMER Also, the devfreq governor is able to have the specific flag as follows in order to implement the specific feature with DEVFREQ_GOV_FLA_*. For exmaple, the devfreq deivce using passive governor cannot change their own governor because passive governor requires the 'immutable' feature with DEVFREQ_GOV_FLAG_IMMUTABLE. [Definition for governor flag] - DEVFREQ_GOV_FLAG_IMMUTABLE : If immutable flag is set, governor is never changeable to other governors. - DEVFREQ_GOV_FLAG_IRQ_DRIVEN : Devfreq core won't schedule polling work for this governor if value is set. Based on: - This series is based on v5.8-rc3 and patchset[1]. - [1] https://patchwork.kernel.org/cover/11640919/ ("[RFC,0/2] PM / devfreq: Add delayed timer for polling") Chanwoo Choi (2): PM / devfreq: Clean up the devfreq instance name in sysfs attr PM / devfreq: Add governor flags to clarify the features drivers/devfreq/devfreq.c | 188 +++++++++++++++++----- drivers/devfreq/governor.h | 45 +++++- drivers/devfreq/governor_passive.c | 3 +- drivers/devfreq/governor_performance.c | 1 + drivers/devfreq/governor_powersave.c | 1 + drivers/devfreq/governor_simpleondemand.c | 3 + drivers/devfreq/governor_userspace.c | 1 + drivers/devfreq/tegra30-devfreq.c | 6 +- 8 files changed, 195 insertions(+), 53 deletions(-) -- 2.17.1

