From: Vipin K Parashar Date: Fri, 10 Mar 2017 11:57:32 +0000 (+0530) Subject: powerpc/powernv: Handle OPAL_WRONG_STATE in opal_get_sensor_data() X-Git-Tag: v4.12-rc1~93^2~160 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=17bb69515c6dfbe282e8a9df08ffb719ff4dbc73;p=karo-tx-linux.git powerpc/powernv: Handle OPAL_WRONG_STATE in opal_get_sensor_data() 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 Signed-off-by: Michael Ellerman --- diff --git a/arch/powerpc/platforms/powernv/opal-sensor.c b/arch/powerpc/platforms/powernv/opal-sensor.c index 308efd170c27..aa267f120033 100644 --- a/arch/powerpc/platforms/powernv/opal-sensor.c +++ b/arch/powerpc/platforms/powernv/opal-sensor.c @@ -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;