]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
powerpc/powernv: Handle OPAL_WRONG_STATE in opal_get_sensor_data()
authorVipin K Parashar <vipin@linux.vnet.ibm.com>
Fri, 10 Mar 2017 11:57:32 +0000 (17:27 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 31 Mar 2017 04:22:56 +0000 (15:22 +1100)
OPAL returns OPAL_WRONG_STATE upon failing to provide sensor data due to
core sleeping/offline. Add a check in opal_get_sensor_data() for sensor
read failure with OPAL_WRONG_STATE return code and return -EIO.

Signed-off-by: Vipin K Parashar <vipin@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/platforms/powernv/opal-sensor.c

index 308efd170c271182a940e649007fc1218a71bb79..aa267f1200335726418eac09161f9a77c2294c64 100644 (file)
@@ -64,6 +64,10 @@ int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data)
                *sensor_data = be32_to_cpu(data);
                break;
 
+       case OPAL_WRONG_STATE:
+               ret = -EIO;
+               break;
+
        default:
                ret = opal_error_code(ret);
                break;