Stop laptop fans from working full speed on Linux after suspend!

  After restoring most laptops that I work on fans start goind full speed after suspend and resume instead reularing speed as they usually do. If you are afflicted with this bug then you are probably also very annoyed by this kernel bug...  

There is a simple process to stop this behaviour. First let's see how many thermal/coolingdevices your system reports, so just do:
  su -
ls -al /sys/class/thermal/cooling
device*
lrwxrwxrwx. 1 root root 0 Jul 1 11:14 /sys/class/thermal/coolingdevice0
lrwxrwxrwx. 1 root root 0 Jul 1 11:14 /sys/class/thermal/cooling
device1
lrwxrwxrwx. 1 root root 0 Jul 1 11:14 /sys/class/thermal/coolingdevice2
lrwxrwxrwx. 1 root root 0 Jul 1 11:14 /sys/class/thermal/cooling
device3

  Some systems have 0-3, some 0-7 and others 0-15, so you need to use correct values in your final script.
  Here is what you can do to for a quick fix, just issue this command:
  for i in {0..7}; do echo 0 > /sys/class/thermal/coolingdevice$i/curstate; done
  and to make things permanent you need to add a script for this:
  cat > / etc/pm/sleep.d/fan_fix.sh < < EOF

!/bin/sh

case “$1″ in
thaw|resume) for i in {0..7}; do echo 0 > /sys/class/thermal/coolingdevice$i/curstate; done ;; *) ;; esac
EOF
chmod +x / etc/pm/sleep.d/fan_fix.sh

  Please notice leading space before "etc", and remove it.