diff options
| -rw-r--r-- | drivers/cpufreq/cpufreq.c | 40 | ||||
| -rw-r--r-- | drivers/cpufreq/cpufreq_conservative.c | 48 | ||||
| -rw-r--r-- | drivers/cpufreq/cpufreq_ondemand.c | 40 | ||||
| -rw-r--r-- | include/linux/cpufreq.h | 30 |
4 files changed, 72 insertions, 86 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 2d5d575e889d..e02e4174c2c8 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
| @@ -662,32 +662,20 @@ static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf) | |||
| 662 | return sprintf(buf, "%u\n", policy->cpuinfo.max_freq); | 662 | return sprintf(buf, "%u\n", policy->cpuinfo.max_freq); |
| 663 | } | 663 | } |
| 664 | 664 | ||
| 665 | #define define_one_ro(_name) \ | 665 | cpufreq_freq_attr_ro_perm(cpuinfo_cur_freq, 0400); |
| 666 | static struct freq_attr _name = \ | 666 | cpufreq_freq_attr_ro(cpuinfo_min_freq); |
| 667 | __ATTR(_name, 0444, show_##_name, NULL) | 667 | cpufreq_freq_attr_ro(cpuinfo_max_freq); |
| 668 | 668 | cpufreq_freq_attr_ro(cpuinfo_transition_latency); | |
| 669 | #define define_one_ro0400(_name) \ | 669 | cpufreq_freq_attr_ro(scaling_available_governors); |
| 670 | static struct freq_attr _name = \ | 670 | cpufreq_freq_attr_ro(scaling_driver); |
| 671 | __ATTR(_name, 0400, show_##_name, NULL) | 671 | cpufreq_freq_attr_ro(scaling_cur_freq); |
| 672 | 672 | cpufreq_freq_attr_ro(bios_limit); | |
| 673 | #define define_one_rw(_name) \ | 673 | cpufreq_freq_attr_ro(related_cpus); |
| 674 | static struct freq_attr _name = \ | 674 | cpufreq_freq_attr_ro(affected_cpus); |
| 675 | __ATTR(_name, 0644, show_##_name, store_##_name) | 675 | cpufreq_freq_attr_rw(scaling_min_freq); |
| 676 | 676 | cpufreq_freq_attr_rw(scaling_max_freq); | |
| 677 | define_one_ro0400(cpuinfo_cur_freq); | 677 | cpufreq_freq_attr_rw(scaling_governor); |
| 678 | define_one_ro(cpuinfo_min_freq); | 678 | cpufreq_freq_attr_rw(scaling_setspeed); |
| 679 | define_one_ro(cpuinfo_max_freq); | ||
| 680 | define_one_ro(cpuinfo_transition_latency); | ||
| 681 | define_one_ro(scaling_available_governors); | ||
| 682 | define_one_ro(scaling_driver); | ||
| 683 | define_one_ro(scaling_cur_freq); | ||
| 684 | define_one_ro(bios_limit); | ||
| 685 | define_one_ro(related_cpus); | ||
| 686 | define_one_ro(affected_cpus); | ||
| 687 | define_one_rw(scaling_min_freq); | ||
| 688 | define_one_rw(scaling_max_freq); | ||
| 689 | define_one_rw(scaling_governor); | ||
| 690 | define_one_rw(scaling_setspeed); | ||
| 691 | 679 | ||
| 692 | static struct attribute *default_attrs[] = { | 680 | static struct attribute *default_attrs[] = { |
| 693 | &cpuinfo_min_freq.attr, | 681 | &cpuinfo_min_freq.attr, |
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 599a40b25cb0..ce5248e04218 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
| @@ -178,12 +178,8 @@ static ssize_t show_sampling_rate_min(struct kobject *kobj, | |||
| 178 | return sprintf(buf, "%u\n", min_sampling_rate); | 178 | return sprintf(buf, "%u\n", min_sampling_rate); |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | #define define_one_ro(_name) \ | 181 | define_one_global_ro(sampling_rate_max); |
| 182 | static struct global_attr _name = \ | 182 | define_one_global_ro(sampling_rate_min); |
| 183 | __ATTR(_name, 0444, show_##_name, NULL) | ||
| 184 | |||
| 185 | define_one_ro(sampling_rate_max); | ||
| 186 | define_one_ro(sampling_rate_min); | ||
| 187 | 183 | ||
| 188 | /* cpufreq_conservative Governor Tunables */ | 184 | /* cpufreq_conservative Governor Tunables */ |
| 189 | #define show_one(file_name, object) \ | 185 | #define show_one(file_name, object) \ |
| @@ -221,12 +217,8 @@ show_one_old(freq_step); | |||
| 221 | show_one_old(sampling_rate_min); | 217 | show_one_old(sampling_rate_min); |
| 222 | show_one_old(sampling_rate_max); | 218 | show_one_old(sampling_rate_max); |
| 223 | 219 | ||
| 224 | #define define_one_ro_old(object, _name) \ | 220 | cpufreq_freq_attr_ro_old(sampling_rate_min); |
| 225 | static struct freq_attr object = \ | 221 | cpufreq_freq_attr_ro_old(sampling_rate_max); |
| 226 | __ATTR(_name, 0444, show_##_name##_old, NULL) | ||
| 227 | |||
| 228 | define_one_ro_old(sampling_rate_min_old, sampling_rate_min); | ||
| 229 | define_one_ro_old(sampling_rate_max_old, sampling_rate_max); | ||
| 230 | 222 | ||
| 231 | /*** delete after deprecation time ***/ | 223 | /*** delete after deprecation time ***/ |
| 232 | 224 | ||
| @@ -364,16 +356,12 @@ static ssize_t store_freq_step(struct kobject *a, struct attribute *b, | |||
| 364 | return count; | 356 | return count; |
| 365 | } | 357 | } |
| 366 | 358 | ||
| 367 | #define define_one_rw(_name) \ | 359 | define_one_global_rw(sampling_rate); |
| 368 | static struct global_attr _name = \ | 360 | define_one_global_rw(sampling_down_factor); |
| 369 | __ATTR(_name, 0644, show_##_name, store_##_name) | 361 | define_one_global_rw(up_threshold); |
| 370 | 362 | define_one_global_rw(down_threshold); | |
| 371 | define_one_rw(sampling_rate); | 363 | define_one_global_rw(ignore_nice_load); |
| 372 | define_one_rw(sampling_down_factor); | 364 | define_one_global_rw(freq_step); |
| 373 | define_one_rw(up_threshold); | ||
| 374 | define_one_rw(down_threshold); | ||
| 375 | define_one_rw(ignore_nice_load); | ||
| 376 | define_one_rw(freq_step); | ||
| 377 | 365 | ||
| 378 | static struct attribute *dbs_attributes[] = { | 366 | static struct attribute *dbs_attributes[] = { |
| 379 | &sampling_rate_max.attr, | 367 | &sampling_rate_max.attr, |
| @@ -409,16 +397,12 @@ write_one_old(down_threshold); | |||
| 409 | write_one_old(ignore_nice_load); | 397 | write_one_old(ignore_nice_load); |
| 410 | write_one_old(freq_step); | 398 | write_one_old(freq_step); |
| 411 | 399 | ||
| 412 | #define define_one_rw_old(object, _name) \ | 400 | cpufreq_freq_attr_rw_old(sampling_rate); |
| 413 | static struct freq_attr object = \ | 401 | cpufreq_freq_attr_rw_old(sampling_down_factor); |
| 414 | __ATTR(_name, 0644, show_##_name##_old, store_##_name##_old) | 402 | cpufreq_freq_attr_rw_old(up_threshold); |
| 415 | 403 | cpufreq_freq_attr_rw_old(down_threshold); | |
| 416 | define_one_rw_old(sampling_rate_old, sampling_rate); | 404 | cpufreq_freq_attr_rw_old(ignore_nice_load); |
| 417 | define_one_rw_old(sampling_down_factor_old, sampling_down_factor); | 405 | cpufreq_freq_attr_rw_old(freq_step); |
| 418 | define_one_rw_old(up_threshold_old, up_threshold); | ||
| 419 | define_one_rw_old(down_threshold_old, down_threshold); | ||
| 420 | define_one_rw_old(ignore_nice_load_old, ignore_nice_load); | ||
| 421 | define_one_rw_old(freq_step_old, freq_step); | ||
| 422 | 406 | ||
| 423 | static struct attribute *dbs_attributes_old[] = { | 407 | static struct attribute *dbs_attributes_old[] = { |
| 424 | &sampling_rate_max_old.attr, | 408 | &sampling_rate_max_old.attr, |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index bd444dc93cf2..c00b25f4d243 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
| @@ -234,12 +234,8 @@ static ssize_t show_sampling_rate_min(struct kobject *kobj, | |||
| 234 | return sprintf(buf, "%u\n", min_sampling_rate); | 234 | return sprintf(buf, "%u\n", min_sampling_rate); |
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | #define define_one_ro(_name) \ | 237 | define_one_global_ro(sampling_rate_max); |
| 238 | static struct global_attr _name = \ | 238 | define_one_global_ro(sampling_rate_min); |
| 239 | __ATTR(_name, 0444, show_##_name, NULL) | ||
| 240 | |||
| 241 | define_one_ro(sampling_rate_max); | ||
| 242 | define_one_ro(sampling_rate_min); | ||
| 243 | 239 | ||
| 244 | /* cpufreq_ondemand Governor Tunables */ | 240 | /* cpufreq_ondemand Governor Tunables */ |
| 245 | #define show_one(file_name, object) \ | 241 | #define show_one(file_name, object) \ |
| @@ -274,12 +270,8 @@ show_one_old(powersave_bias); | |||
| 274 | show_one_old(sampling_rate_min); | 270 | show_one_old(sampling_rate_min); |
| 275 | show_one_old(sampling_rate_max); | 271 | show_one_old(sampling_rate_max); |
| 276 | 272 | ||
| 277 | #define define_one_ro_old(object, _name) \ | 273 | cpufreq_freq_attr_ro_old(sampling_rate_min); |
| 278 | static struct freq_attr object = \ | 274 | cpufreq_freq_attr_ro_old(sampling_rate_max); |
| 279 | __ATTR(_name, 0444, show_##_name##_old, NULL) | ||
| 280 | |||
| 281 | define_one_ro_old(sampling_rate_min_old, sampling_rate_min); | ||
| 282 | define_one_ro_old(sampling_rate_max_old, sampling_rate_max); | ||
| 283 | 275 | ||
| 284 | /*** delete after deprecation time ***/ | 276 | /*** delete after deprecation time ***/ |
| 285 | 277 | ||
| @@ -376,14 +368,10 @@ static ssize_t store_powersave_bias(struct kobject *a, struct attribute *b, | |||
| 376 | return count; | 368 | return count; |
| 377 | } | 369 | } |
| 378 | 370 | ||
| 379 | #define define_one_rw(_name) \ | 371 | define_one_global_rw(sampling_rate); |
| 380 | static struct global_attr _name = \ | 372 | define_one_global_rw(up_threshold); |
| 381 | __ATTR(_name, 0644, show_##_name, store_##_name) | 373 | define_one_global_rw(ignore_nice_load); |
| 382 | 374 | define_one_global_rw(powersave_bias); | |
| 383 | define_one_rw(sampling_rate); | ||
| 384 | define_one_rw(up_threshold); | ||
| 385 | define_one_rw(ignore_nice_load); | ||
| 386 | define_one_rw(powersave_bias); | ||
| 387 | 375 | ||
| 388 | static struct attribute *dbs_attributes[] = { | 376 | static struct attribute *dbs_attributes[] = { |
| 389 | &sampling_rate_max.attr, | 377 | &sampling_rate_max.attr, |
| @@ -415,14 +403,10 @@ write_one_old(up_threshold); | |||
| 415 | write_one_old(ignore_nice_load); | 403 | write_one_old(ignore_nice_load); |
| 416 | write_one_old(powersave_bias); | 404 | write_one_old(powersave_bias); |
| 417 | 405 | ||
| 418 | #define define_one_rw_old(object, _name) \ | 406 | cpufreq_freq_attr_rw_old(sampling_rate); |
| 419 | static struct freq_attr object = \ | 407 | cpufreq_freq_attr_rw_old(up_threshold); |
| 420 | __ATTR(_name, 0644, show_##_name##_old, store_##_name##_old) | 408 | cpufreq_freq_attr_rw_old(ignore_nice_load); |
| 421 | 409 | cpufreq_freq_attr_rw_old(powersave_bias); | |
| 422 | define_one_rw_old(sampling_rate_old, sampling_rate); | ||
| 423 | define_one_rw_old(up_threshold_old, up_threshold); | ||
| 424 | define_one_rw_old(ignore_nice_load_old, ignore_nice_load); | ||
| 425 | define_one_rw_old(powersave_bias_old, powersave_bias); | ||
| 426 | 410 | ||
| 427 | static struct attribute *dbs_attributes_old[] = { | 411 | static struct attribute *dbs_attributes_old[] = { |
| 428 | &sampling_rate_max_old.attr, | 412 | &sampling_rate_max_old.attr, |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 4de02b10007f..9f15150ce8d6 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
| @@ -278,6 +278,27 @@ struct freq_attr { | |||
| 278 | ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count); | 278 | ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count); |
| 279 | }; | 279 | }; |
| 280 | 280 | ||
| 281 | #define cpufreq_freq_attr_ro(_name) \ | ||
| 282 | static struct freq_attr _name = \ | ||
| 283 | __ATTR(_name, 0444, show_##_name, NULL) | ||
| 284 | |||
| 285 | #define cpufreq_freq_attr_ro_perm(_name, _perm) \ | ||
| 286 | static struct freq_attr _name = \ | ||
| 287 | __ATTR(_name, _perm, show_##_name, NULL) | ||
| 288 | |||
| 289 | #define cpufreq_freq_attr_ro_old(_name) \ | ||
| 290 | static struct freq_attr _name##_old = \ | ||
| 291 | __ATTR(_name, 0444, show_##_name##_old, NULL) | ||
| 292 | |||
| 293 | #define cpufreq_freq_attr_rw(_name) \ | ||
| 294 | static struct freq_attr _name = \ | ||
| 295 | __ATTR(_name, 0644, show_##_name, store_##_name) | ||
| 296 | |||
| 297 | #define cpufreq_freq_attr_rw_old(_name) \ | ||
| 298 | static struct freq_attr _name##_old = \ | ||
| 299 | __ATTR(_name, 0644, show_##_name##_old, store_##_name##_old) | ||
| 300 | |||
| 301 | |||
| 281 | struct global_attr { | 302 | struct global_attr { |
| 282 | struct attribute attr; | 303 | struct attribute attr; |
| 283 | ssize_t (*show)(struct kobject *kobj, | 304 | ssize_t (*show)(struct kobject *kobj, |
| @@ -286,6 +307,15 @@ struct global_attr { | |||
| 286 | const char *c, size_t count); | 307 | const char *c, size_t count); |
| 287 | }; | 308 | }; |
| 288 | 309 | ||
| 310 | #define define_one_global_ro(_name) \ | ||
| 311 | static struct global_attr _name = \ | ||
| 312 | __ATTR(_name, 0444, show_##_name, NULL) | ||
| 313 | |||
| 314 | #define define_one_global_rw(_name) \ | ||
| 315 | static struct global_attr _name = \ | ||
| 316 | __ATTR(_name, 0644, show_##_name, store_##_name) | ||
| 317 | |||
| 318 | |||
| 289 | /********************************************************************* | 319 | /********************************************************************* |
| 290 | * CPUFREQ 2.6. INTERFACE * | 320 | * CPUFREQ 2.6. INTERFACE * |
| 291 | *********************************************************************/ | 321 | *********************************************************************/ |
