Fix magnetometer
libsensors: cleanup

Also incorporates jcsullins's patch from gerrit:
http://review.cyanogenmod.org/#/c/27936/