Re: [PATCH] ppc64: Thermal control for SMU based machines

From: Andrew Morton
Date: Tue Oct 11 2005 - 19:11:25 EST


Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> 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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/