Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpufreq: unify show() and store() naming and use __ATTR_XX

Usually, sysfs attributes have .show and .store and their naming
convention is filename_show() and filename_store().

But in cpufreq the naming convention of these functions is
show_filename() and store_filename() which prevents __ATTR_RW() and
__ATTR_RO() from being used in there to simplify code.

Accordingly, change the naming convention of the sysfs .show and
.store methods in cpufreq to follow the one expected by __ATTR_RW()
and __ATTR_RO() and use these macros in that code.

Signed-off-by: Lianjie Zhang <zhanglianjie@uniontech.com>
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Lianjie Zhang and committed by
Rafael J. Wysocki
85750bcd 075c3c48

+18 -20
+5 -5
drivers/cpufreq/cpufreq_conservative.c
··· 146 146 147 147 /************************** sysfs interface ************************/ 148 148 149 - static ssize_t store_sampling_down_factor(struct gov_attr_set *attr_set, 149 + static ssize_t sampling_down_factor_store(struct gov_attr_set *attr_set, 150 150 const char *buf, size_t count) 151 151 { 152 152 struct dbs_data *dbs_data = to_dbs_data(attr_set); ··· 161 161 return count; 162 162 } 163 163 164 - static ssize_t store_up_threshold(struct gov_attr_set *attr_set, 164 + static ssize_t up_threshold_store(struct gov_attr_set *attr_set, 165 165 const char *buf, size_t count) 166 166 { 167 167 struct dbs_data *dbs_data = to_dbs_data(attr_set); ··· 177 177 return count; 178 178 } 179 179 180 - static ssize_t store_down_threshold(struct gov_attr_set *attr_set, 180 + static ssize_t down_threshold_store(struct gov_attr_set *attr_set, 181 181 const char *buf, size_t count) 182 182 { 183 183 struct dbs_data *dbs_data = to_dbs_data(attr_set); ··· 195 195 return count; 196 196 } 197 197 198 - static ssize_t store_ignore_nice_load(struct gov_attr_set *attr_set, 198 + static ssize_t ignore_nice_load_store(struct gov_attr_set *attr_set, 199 199 const char *buf, size_t count) 200 200 { 201 201 struct dbs_data *dbs_data = to_dbs_data(attr_set); ··· 220 220 return count; 221 221 } 222 222 223 - static ssize_t store_freq_step(struct gov_attr_set *attr_set, const char *buf, 223 + static ssize_t freq_step_store(struct gov_attr_set *attr_set, const char *buf, 224 224 size_t count) 225 225 { 226 226 struct dbs_data *dbs_data = to_dbs_data(attr_set);
+3 -3
drivers/cpufreq/cpufreq_governor.c
··· 27 27 28 28 /* Common sysfs tunables */ 29 29 /* 30 - * store_sampling_rate - update sampling rate effective immediately if needed. 30 + * sampling_rate_store - update sampling rate effective immediately if needed. 31 31 * 32 32 * If new rate is smaller than the old, simply updating 33 33 * dbs.sampling_rate might not be appropriate. For example, if the ··· 41 41 * This must be called with dbs_data->mutex held, otherwise traversing 42 42 * policy_dbs_list isn't safe. 43 43 */ 44 - ssize_t store_sampling_rate(struct gov_attr_set *attr_set, const char *buf, 44 + ssize_t sampling_rate_store(struct gov_attr_set *attr_set, const char *buf, 45 45 size_t count) 46 46 { 47 47 struct dbs_data *dbs_data = to_dbs_data(attr_set); ··· 80 80 81 81 return count; 82 82 } 83 - EXPORT_SYMBOL_GPL(store_sampling_rate); 83 + EXPORT_SYMBOL_GPL(sampling_rate_store); 84 84 85 85 /** 86 86 * gov_update_cpu_data - Update CPU load data.
+5 -7
drivers/cpufreq/cpufreq_governor.h
··· 51 51 } 52 52 53 53 #define gov_show_one(_gov, file_name) \ 54 - static ssize_t show_##file_name \ 54 + static ssize_t file_name##_show \ 55 55 (struct gov_attr_set *attr_set, char *buf) \ 56 56 { \ 57 57 struct dbs_data *dbs_data = to_dbs_data(attr_set); \ ··· 60 60 } 61 61 62 62 #define gov_show_one_common(file_name) \ 63 - static ssize_t show_##file_name \ 63 + static ssize_t file_name##_show \ 64 64 (struct gov_attr_set *attr_set, char *buf) \ 65 65 { \ 66 66 struct dbs_data *dbs_data = to_dbs_data(attr_set); \ ··· 68 68 } 69 69 70 70 #define gov_attr_ro(_name) \ 71 - static struct governor_attr _name = \ 72 - __ATTR(_name, 0444, show_##_name, NULL) 71 + static struct governor_attr _name = __ATTR_RO(_name) 73 72 74 73 #define gov_attr_rw(_name) \ 75 - static struct governor_attr _name = \ 76 - __ATTR(_name, 0644, show_##_name, store_##_name) 74 + static struct governor_attr _name = __ATTR_RW(_name) 77 75 78 76 /* Common to all CPUs of a policy */ 79 77 struct policy_dbs_info { ··· 174 176 (struct cpufreq_policy *, unsigned int, unsigned int), 175 177 unsigned int powersave_bias); 176 178 void od_unregister_powersave_bias_handler(void); 177 - ssize_t store_sampling_rate(struct gov_attr_set *attr_set, const char *buf, 179 + ssize_t sampling_rate_store(struct gov_attr_set *attr_set, const char *buf, 178 180 size_t count); 179 181 void gov_update_cpu_data(struct dbs_data *dbs_data); 180 182 #endif /* _CPUFREQ_GOVERNOR_H */
+5 -5
drivers/cpufreq/cpufreq_ondemand.c
··· 202 202 /************************** sysfs interface ************************/ 203 203 static struct dbs_governor od_dbs_gov; 204 204 205 - static ssize_t store_io_is_busy(struct gov_attr_set *attr_set, const char *buf, 205 + static ssize_t io_is_busy_store(struct gov_attr_set *attr_set, const char *buf, 206 206 size_t count) 207 207 { 208 208 struct dbs_data *dbs_data = to_dbs_data(attr_set); ··· 220 220 return count; 221 221 } 222 222 223 - static ssize_t store_up_threshold(struct gov_attr_set *attr_set, 223 + static ssize_t up_threshold_store(struct gov_attr_set *attr_set, 224 224 const char *buf, size_t count) 225 225 { 226 226 struct dbs_data *dbs_data = to_dbs_data(attr_set); ··· 237 237 return count; 238 238 } 239 239 240 - static ssize_t store_sampling_down_factor(struct gov_attr_set *attr_set, 240 + static ssize_t sampling_down_factor_store(struct gov_attr_set *attr_set, 241 241 const char *buf, size_t count) 242 242 { 243 243 struct dbs_data *dbs_data = to_dbs_data(attr_set); ··· 265 265 return count; 266 266 } 267 267 268 - static ssize_t store_ignore_nice_load(struct gov_attr_set *attr_set, 268 + static ssize_t ignore_nice_load_store(struct gov_attr_set *attr_set, 269 269 const char *buf, size_t count) 270 270 { 271 271 struct dbs_data *dbs_data = to_dbs_data(attr_set); ··· 290 290 return count; 291 291 } 292 292 293 - static ssize_t store_powersave_bias(struct gov_attr_set *attr_set, 293 + static ssize_t powersave_bias_store(struct gov_attr_set *attr_set, 294 294 const char *buf, size_t count) 295 295 { 296 296 struct dbs_data *dbs_data = to_dbs_data(attr_set);