aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/powernv/opal-sensor.c
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2014-03-28 01:34:10 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-04-08 22:52:49 -0400
commit9000c17dc0f9c910267d2661225c9d33a227b27e (patch)
tree66b0baf3e320446da2c335c53f6dc9be75d52e15 /arch/powerpc/platforms/powernv/opal-sensor.c
parentbb4398e1de739a13e06589fc04cbb2267ba59800 (diff)
powerpc/powernv: Fix endian issues with sensor code
One OPAL call and one device tree property needed byte swapping. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/powernv/opal-sensor.c')
-rw-r--r--arch/powerpc/platforms/powernv/opal-sensor.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/powernv/opal-sensor.c b/arch/powerpc/platforms/powernv/opal-sensor.c
index 7503e298c4c3..10271ad1fac4 100644
--- a/arch/powerpc/platforms/powernv/opal-sensor.c
+++ b/arch/powerpc/platforms/powernv/opal-sensor.c
@@ -33,6 +33,7 @@ int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data)
33{ 33{
34 int ret, token; 34 int ret, token;
35 struct opal_msg msg; 35 struct opal_msg msg;
36 __be32 data;
36 37
37 token = opal_async_get_token_interruptible(); 38 token = opal_async_get_token_interruptible();
38 if (token < 0) { 39 if (token < 0) {
@@ -42,7 +43,7 @@ int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data)
42 } 43 }
43 44
44 mutex_lock(&opal_sensor_mutex); 45 mutex_lock(&opal_sensor_mutex);
45 ret = opal_sensor_read(sensor_hndl, token, sensor_data); 46 ret = opal_sensor_read(sensor_hndl, token, &data);
46 if (ret != OPAL_ASYNC_COMPLETION) 47 if (ret != OPAL_ASYNC_COMPLETION)
47 goto out_token; 48 goto out_token;
48 49
@@ -53,6 +54,7 @@ int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data)
53 goto out_token; 54 goto out_token;
54 } 55 }
55 56
57 *sensor_data = be32_to_cpu(data);
56 ret = be64_to_cpu(msg.params[1]); 58 ret = be64_to_cpu(msg.params[1]);
57 59
58out_token: 60out_token: