Don't assume that the number of fans is equal to the number of CPUs.
This patch brings no new functionality but it greatly simplifies the code by using unique functions for performing the same tasks no matter the CPU or fan being processed. The code is now smaller, making it easier to maintain.
The MacBook 5,2 has to be booted with maxcpus=1 or acpi=off. In both cases Linux will see a single CPU. This patch allows the daemon to run in such systems. Without this patch the daemon will die because it doesn't detect two CPUs.