Re: [PATCH v3 1/2] PM / devfreq: Add governor feature flag
From: Chanwoo Choi
Date: Sun Oct 18 2020 - 23:40:29 EST
On 10/19/20 9:57 AM, Dmitry Osipenko wrote:
> 07.10.2020 08:07, Chanwoo Choi пишет:
>> The devfreq governor is able to have the specific flag as follows
>> in order to implement the specific feature. For example, devfreq allows
>> user to change the governors on runtime via sysfs interface.
>> But, if devfreq device uses 'passive' governor, don't allow user to change
>> the governor. For this case, define the DEVFREQ_GOV_FLAT_IMMUTABLE
>
> s/DEVFREQ_GOV_FLAT/DEVFREQ_GOV_FLAG/
>
> ...
>> /**
>> * 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 governor is never changeable to other governor.
>> - * @interrupt_driven: Devfreq core won't schedule polling work for this
>> - * governor if value is set to 1.
>> + * @flag: Governor's feature flag
>> * @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
>> @@ -50,8 +57,7 @@ struct devfreq_governor {
>> struct list_head node;
>>
>> const char name[DEVFREQ_NAME_LEN];
>> - const unsigned int immutable;
>> - const unsigned int interrupt_driven;
>> + const u64 flag;
> A plural form of flag(s) is more common, IMO.
When need to add more feature flag, I prefer to add
the definition instead of changing the structure.
I think it is better.
>
> It's also possible to use a single bit:1 for the struct members. Thus,
> could you please explain what are the benefits of the "flag"?
I think that anyone might add the some optional
feature. So, I used 'flag' for the extensibility.
--
Best Regards,
Chanwoo Choi
Samsung Electronics