libsensors: fix poll event that would use 100% CPU

The new MPLSensor.cpp's readEvents() does not really read events :(
it just ignores the data field and always return 0 no matter what.
But it does mess around with some MPLSensor internal data and reads
iio buffers.

The MPLSensor's executeOnData() reads events and returns data.
Based on the comments of that function it should be called after reading
an event.
It was placed in the code such that it would always return an available
event even of the poll didn't return anything.
This would cause poll(,,0) and nothing ever waited.

Switch the sensor logging back to verbose to avoid polluting logcat.

Bug: 6686148
Change-Id: Ibcd525c6a678c4acff51755eb057dd0553c523c2
diff --git a/libsensors/sensors.cpp b/libsensors/sensors.cpp
index 19fcd6a..33bc9fc 100644
--- a/libsensors/sensors.cpp
+++ b/libsensors/sensors.cpp
@@ -239,20 +239,21 @@
     int nbEvents = 0;
     int n = 0;
     int polltime = -1;
-
     do {
-        // see if we have some leftover from the last poll()
         for (int i=0 ; count && i<numSensorDrivers ; i++) {
             SensorBase* const sensor(mSensors[i]);
+            // See if we have some pending events from the last poll()
             if ((mPollFds[i].revents & POLLIN) || (sensor->hasPendingEvents())) {
                 int nb;
                 if (i == compass) {
-                    nb = ((MPLSensor*) sensor)->readCompassEvents(data, count);
-                    continue;
+                    /* result is hardcoded to 0 */
+                    ((MPLSensor*) sensor)->readCompassEvents(NULL, count);
+                    nb = ((MPLSensor*) mSensors[mpl])->executeOnData(data, count);
                 }
                 else if (i == mpl) {
-                    nb = sensor->readEvents(data, count);
-                    continue;
+                    /* result is hardcoded to 0 */
+                    sensor->readEvents(NULL, count);
+                    nb = ((MPLSensor*) mSensors[mpl])->executeOnData(data, count);
                 }
                 else {
                     nb = sensor->readEvents(data, count);
@@ -266,25 +267,11 @@
                 data += nb;
             }
         }
-        int nb = ((MPLSensor*) mSensors[mpl])->executeOnData(data, count);
-        if (nb > 0) {
-            count -= nb;
-            nbEvents += nb;
-            data += nb;
-            mPollFds[mpl].revents = 0;
-            mPollFds[compass].revents = 0;
-        }
-
         if (count) {
-            // we still have some room, so try to see if we can get
-            // some events immediately or just wait if we don't have
-            // anything to return
-            int i;
-
             do {
                 n = poll(mPollFds, numFds, nbEvents ? 0 : polltime);
             } while (n < 0 && errno == EINTR);
-            if (n<0) {
+            if (n < 0) {
                 ALOGE("poll() failed (%s)", strerror(errno));
                 return -errno;
             }