[PATCH] ppc64: Thermal control for SMU based machines
Andrew Morton
akpm at osdl.org
Wed Oct 12 10:10:52 EST 2005
Benjamin Herrenschmidt <benh at kernel.crashing.org> wrote:
>
> + /* First, locate the params for this model */
> + for (i = 0; i < WF_SMU_SYS_FANS_NUM_CONFIGS; i++)
> + if (wf_smu_sys_all_params[i].model_id == mach_model) {
The loop control is a bit scary here. If you were to do
#define WF_SMU_SYS_FANS_NUM_CONFIGS ARRAY_SIZE(wf_smu_sys_all_params)
then we wouldn't need duplicated into in two places.
> + param = &wf_smu_sys_all_params[i];
> + break;
> + }
> + /* No params found, put fans to max */
> + if (param == NULL) {
> + printk(KERN_WARNING "windfarm: System fan config not found "
> + "for this machine model, max fan speed\n");
> + goto fail;
> + }
> +
> + /* Alloc & initialize state */
> + wf_smu_sys_fans = kmalloc(sizeof(struct wf_smu_sys_fans_state),
> + GFP_KERNEL);
> + if (wf_smu_sys_fans == NULL) {
> + printk(KERN_WARNING "windfarm: Memory allocation error"
> + " max fan speed\n");
> + goto fail;
> + }
> + wf_smu_sys_fans->ticks = 1;
whitespace broke.
More information about the Linuxppc64-dev
mailing list