[PATCH] windfarm: add PowerMac 12,1 support

Étienne Bersac bersace at gmail.com
Fri Dec 7 02:30:51 EST 2007


Hi,

> +	/* First, locate the params for this model */
> +	for (i = 0; i < PM121_NUM_CONFIGS; i++) {
> +		param = &(pm121_sys_all_params[loop_id][i]);
> +		if (param->model_id == pm121_mach_model)
> +			break;
> +	}
> +
> +	/* No params found, put fans to max */
> +	if (param == NULL) {
> +		printk(KERN_WARNING "pm121: %s fan config not found "
> +		       " for this machine model\n",
> +		       loop_names[loop_id]);
> +		goto fail;
> +	}

This part might be buggy. param NULL only when PM121_NUM_CONFIGS is 0.
The original code was :


+	for (i = 0; i < PM121_NUM_CONFIGS; i++) {
+		if (pm121_sys_all_params[loop_id][i].model_id == pm121_mach_model) {
+			param = &(pm121_sys_all_params[loop_id][i]);
+			break;
+		}
+	}

But the line is wider than 80 chars. An alternative would be  :


+	for (i = 0; i < PM121_NUM_CONFIGS; i++) {
+		param = &(pm121_sys_all_params[loop_id][i]);
+		if (param->model_id == pm121_mach_model)
+			break;
+		else
+			param = NULL;
+	}

I wonder if that's more readable.


Regards,
Étienne.
-- 
E Ultreïa !
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Ceci est une partie de message num?riquement sign?e
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20071206/63c058dd/attachment.pgp>


More information about the Linuxppc-dev mailing list