diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-04-18 18:16:51 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-04-30 01:37:20 -0400 |
commit | 33e6820b767a5bfa4a0d579da6ee4568a2b1e730 (patch) | |
tree | 341a29222e9fb18fe4ce6f9c9346bbc4190584e3 /drivers/macintosh/windfarm_pm81.c | |
parent | ea5c64b06743b505e0eb4e6caa1810fe685c9559 (diff) |
powerpc/windfarm: Add useful accessors
Makes the code more readable
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/macintosh/windfarm_pm81.c')
-rw-r--r-- | drivers/macintosh/windfarm_pm81.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/macintosh/windfarm_pm81.c b/drivers/macintosh/windfarm_pm81.c index fc13d0f2663b..990c87606be9 100644 --- a/drivers/macintosh/windfarm_pm81.c +++ b/drivers/macintosh/windfarm_pm81.c | |||
@@ -302,13 +302,13 @@ static void wf_smu_create_sys_fans(void) | |||
302 | pid_param.interval = WF_SMU_SYS_FANS_INTERVAL; | 302 | pid_param.interval = WF_SMU_SYS_FANS_INTERVAL; |
303 | pid_param.history_len = WF_SMU_SYS_FANS_HISTORY_SIZE; | 303 | pid_param.history_len = WF_SMU_SYS_FANS_HISTORY_SIZE; |
304 | pid_param.itarget = param->itarget; | 304 | pid_param.itarget = param->itarget; |
305 | pid_param.min = fan_system->ops->get_min(fan_system); | 305 | pid_param.min = wf_control_get_min(fan_system); |
306 | pid_param.max = fan_system->ops->get_max(fan_system); | 306 | pid_param.max = wf_control_get_max(fan_system); |
307 | if (fan_hd) { | 307 | if (fan_hd) { |
308 | pid_param.min = | 308 | pid_param.min = |
309 | max(pid_param.min,fan_hd->ops->get_min(fan_hd)); | 309 | max(pid_param.min, wf_control_get_min(fan_hd)); |
310 | pid_param.max = | 310 | pid_param.max = |
311 | min(pid_param.max,fan_hd->ops->get_max(fan_hd)); | 311 | min(pid_param.max, wf_control_get_max(fan_hd)); |
312 | } | 312 | } |
313 | wf_pid_init(&wf_smu_sys_fans->pid, &pid_param); | 313 | wf_pid_init(&wf_smu_sys_fans->pid, &pid_param); |
314 | 314 | ||
@@ -337,7 +337,7 @@ static void wf_smu_sys_fans_tick(struct wf_smu_sys_fans_state *st) | |||
337 | } | 337 | } |
338 | st->ticks = WF_SMU_SYS_FANS_INTERVAL; | 338 | st->ticks = WF_SMU_SYS_FANS_INTERVAL; |
339 | 339 | ||
340 | rc = sensor_hd_temp->ops->get_value(sensor_hd_temp, &temp); | 340 | rc = wf_sensor_get(sensor_hd_temp, &temp); |
341 | if (rc) { | 341 | if (rc) { |
342 | printk(KERN_WARNING "windfarm: HD temp sensor error %d\n", | 342 | printk(KERN_WARNING "windfarm: HD temp sensor error %d\n", |
343 | rc); | 343 | rc); |
@@ -373,7 +373,7 @@ static void wf_smu_sys_fans_tick(struct wf_smu_sys_fans_state *st) | |||
373 | st->hd_setpoint = new_setpoint; | 373 | st->hd_setpoint = new_setpoint; |
374 | readjust: | 374 | readjust: |
375 | if (fan_system && wf_smu_failure_state == 0) { | 375 | if (fan_system && wf_smu_failure_state == 0) { |
376 | rc = fan_system->ops->set_value(fan_system, st->sys_setpoint); | 376 | rc = wf_control_set(fan_system, st->sys_setpoint); |
377 | if (rc) { | 377 | if (rc) { |
378 | printk(KERN_WARNING "windfarm: Sys fan error %d\n", | 378 | printk(KERN_WARNING "windfarm: Sys fan error %d\n", |
379 | rc); | 379 | rc); |
@@ -381,7 +381,7 @@ static void wf_smu_sys_fans_tick(struct wf_smu_sys_fans_state *st) | |||
381 | } | 381 | } |
382 | } | 382 | } |
383 | if (fan_hd && wf_smu_failure_state == 0) { | 383 | if (fan_hd && wf_smu_failure_state == 0) { |
384 | rc = fan_hd->ops->set_value(fan_hd, st->hd_setpoint); | 384 | rc = wf_control_set(fan_hd, st->hd_setpoint); |
385 | if (rc) { | 385 | if (rc) { |
386 | printk(KERN_WARNING "windfarm: HD fan error %d\n", | 386 | printk(KERN_WARNING "windfarm: HD fan error %d\n", |
387 | rc); | 387 | rc); |
@@ -447,8 +447,8 @@ static void wf_smu_create_cpu_fans(void) | |||
447 | pid_param.ttarget = tmax - tdelta; | 447 | pid_param.ttarget = tmax - tdelta; |
448 | pid_param.pmaxadj = maxpow - powadj; | 448 | pid_param.pmaxadj = maxpow - powadj; |
449 | 449 | ||
450 | pid_param.min = fan_cpu_main->ops->get_min(fan_cpu_main); | 450 | pid_param.min = wf_control_get_min(fan_cpu_main); |
451 | pid_param.max = fan_cpu_main->ops->get_max(fan_cpu_main); | 451 | pid_param.max = wf_control_get_max(fan_cpu_main); |
452 | 452 | ||
453 | wf_cpu_pid_init(&wf_smu_cpu_fans->pid, &pid_param); | 453 | wf_cpu_pid_init(&wf_smu_cpu_fans->pid, &pid_param); |
454 | 454 | ||
@@ -481,7 +481,7 @@ static void wf_smu_cpu_fans_tick(struct wf_smu_cpu_fans_state *st) | |||
481 | } | 481 | } |
482 | st->ticks = WF_SMU_CPU_FANS_INTERVAL; | 482 | st->ticks = WF_SMU_CPU_FANS_INTERVAL; |
483 | 483 | ||
484 | rc = sensor_cpu_temp->ops->get_value(sensor_cpu_temp, &temp); | 484 | rc = wf_sensor_get(sensor_cpu_temp, &temp); |
485 | if (rc) { | 485 | if (rc) { |
486 | printk(KERN_WARNING "windfarm: CPU temp sensor error %d\n", | 486 | printk(KERN_WARNING "windfarm: CPU temp sensor error %d\n", |
487 | rc); | 487 | rc); |
@@ -489,7 +489,7 @@ static void wf_smu_cpu_fans_tick(struct wf_smu_cpu_fans_state *st) | |||
489 | return; | 489 | return; |
490 | } | 490 | } |
491 | 491 | ||
492 | rc = sensor_cpu_power->ops->get_value(sensor_cpu_power, &power); | 492 | rc = wf_sensor_get(sensor_cpu_power, &power); |
493 | if (rc) { | 493 | if (rc) { |
494 | printk(KERN_WARNING "windfarm: CPU power sensor error %d\n", | 494 | printk(KERN_WARNING "windfarm: CPU power sensor error %d\n", |
495 | rc); | 495 | rc); |
@@ -525,8 +525,7 @@ static void wf_smu_cpu_fans_tick(struct wf_smu_cpu_fans_state *st) | |||
525 | st->cpu_setpoint = new_setpoint; | 525 | st->cpu_setpoint = new_setpoint; |
526 | readjust: | 526 | readjust: |
527 | if (fan_cpu_main && wf_smu_failure_state == 0) { | 527 | if (fan_cpu_main && wf_smu_failure_state == 0) { |
528 | rc = fan_cpu_main->ops->set_value(fan_cpu_main, | 528 | rc = wf_control_set(fan_cpu_main, st->cpu_setpoint); |
529 | st->cpu_setpoint); | ||
530 | if (rc) { | 529 | if (rc) { |
531 | printk(KERN_WARNING "windfarm: CPU main fan" | 530 | printk(KERN_WARNING "windfarm: CPU main fan" |
532 | " error %d\n", rc); | 531 | " error %d\n", rc); |