Commit bf7588a0 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Michael Ellerman

powerpc/powernv: Fix endian bug in LPC bus debugfs accessors

When reading from the LPC, the OPAL FW calls return the value via pointer
to a uint32_t which is always returned big endian. Our internal inb/outb
implementation byteswaps that fine but our debugfs code is still broken.
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
CC: <stable@vger.kernel.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 75d43b2d
...@@ -191,6 +191,7 @@ static ssize_t lpc_debug_read(struct file *filp, char __user *ubuf, ...@@ -191,6 +191,7 @@ static ssize_t lpc_debug_read(struct file *filp, char __user *ubuf,
{ {
struct lpc_debugfs_entry *lpc = filp->private_data; struct lpc_debugfs_entry *lpc = filp->private_data;
u32 data, pos, len, todo; u32 data, pos, len, todo;
__be32 bedata;
int rc; int rc;
if (!access_ok(VERIFY_WRITE, ubuf, count)) if (!access_ok(VERIFY_WRITE, ubuf, count))
...@@ -213,9 +214,10 @@ static ssize_t lpc_debug_read(struct file *filp, char __user *ubuf, ...@@ -213,9 +214,10 @@ static ssize_t lpc_debug_read(struct file *filp, char __user *ubuf,
len = 2; len = 2;
} }
rc = opal_lpc_read(opal_lpc_chip_id, lpc->lpc_type, pos, rc = opal_lpc_read(opal_lpc_chip_id, lpc->lpc_type, pos,
&data, len); &bedata, len);
if (rc) if (rc)
return -ENXIO; return -ENXIO;
data = be32_to_cpu(bedata);
switch(len) { switch(len) {
case 4: case 4:
rc = __put_user((u32)data, (u32 __user *)ubuf); rc = __put_user((u32)data, (u32 __user *)ubuf);
......
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