Commit 9000c17d authored by Anton Blanchard's avatar Anton Blanchard Committed by Benjamin Herrenschmidt

powerpc/powernv: Fix endian issues with sensor code

One OPAL call and one device tree property needed byte swapping.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent bb4398e1
...@@ -874,8 +874,7 @@ int64_t opal_get_param(uint64_t token, uint32_t param_id, uint64_t buffer, ...@@ -874,8 +874,7 @@ int64_t opal_get_param(uint64_t token, uint32_t param_id, uint64_t buffer,
size_t length); size_t length);
int64_t opal_set_param(uint64_t token, uint32_t param_id, uint64_t buffer, int64_t opal_set_param(uint64_t token, uint32_t param_id, uint64_t buffer,
size_t length); size_t length);
int64_t opal_sensor_read(uint32_t sensor_hndl, int token, int64_t opal_sensor_read(uint32_t sensor_hndl, int token, __be32 *sensor_data);
uint32_t *sensor_data);
/* Internal functions */ /* Internal functions */
extern int early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data); extern int early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data);
......
...@@ -33,6 +33,7 @@ int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data) ...@@ -33,6 +33,7 @@ int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data)
{ {
int ret, token; int ret, token;
struct opal_msg msg; struct opal_msg msg;
__be32 data;
token = opal_async_get_token_interruptible(); token = opal_async_get_token_interruptible();
if (token < 0) { if (token < 0) {
...@@ -42,7 +43,7 @@ int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data) ...@@ -42,7 +43,7 @@ int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data)
} }
mutex_lock(&opal_sensor_mutex); mutex_lock(&opal_sensor_mutex);
ret = opal_sensor_read(sensor_hndl, token, sensor_data); ret = opal_sensor_read(sensor_hndl, token, &data);
if (ret != OPAL_ASYNC_COMPLETION) if (ret != OPAL_ASYNC_COMPLETION)
goto out_token; goto out_token;
...@@ -53,6 +54,7 @@ int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data) ...@@ -53,6 +54,7 @@ int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data)
goto out_token; goto out_token;
} }
*sensor_data = be32_to_cpu(data);
ret = be64_to_cpu(msg.params[1]); ret = be64_to_cpu(msg.params[1]);
out_token: out_token:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment