diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-10-03 03:12:25 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2014-10-07 01:01:18 -0400 |
commit | bf7588a0859580a45c63cb082825d77c13eca357 (patch) | |
tree | 135be483b54c55629ed035347a05d788d87f4e3a | |
parent | 75d43b2d0a323ba894d85060888f039e41b441ca (diff) |
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: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: <stable@vger.kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r-- | arch/powerpc/platforms/powernv/opal-lpc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c index ad4b31df779a..dd2c285ad170 100644 --- a/arch/powerpc/platforms/powernv/opal-lpc.c +++ b/arch/powerpc/platforms/powernv/opal-lpc.c | |||
@@ -191,6 +191,7 @@ static ssize_t lpc_debug_read(struct file *filp, char __user *ubuf, | |||
191 | { | 191 | { |
192 | struct lpc_debugfs_entry *lpc = filp->private_data; | 192 | struct lpc_debugfs_entry *lpc = filp->private_data; |
193 | u32 data, pos, len, todo; | 193 | u32 data, pos, len, todo; |
194 | __be32 bedata; | ||
194 | int rc; | 195 | int rc; |
195 | 196 | ||
196 | if (!access_ok(VERIFY_WRITE, ubuf, count)) | 197 | if (!access_ok(VERIFY_WRITE, ubuf, count)) |
@@ -213,9 +214,10 @@ static ssize_t lpc_debug_read(struct file *filp, char __user *ubuf, | |||
213 | len = 2; | 214 | len = 2; |
214 | } | 215 | } |
215 | rc = opal_lpc_read(opal_lpc_chip_id, lpc->lpc_type, pos, | 216 | rc = opal_lpc_read(opal_lpc_chip_id, lpc->lpc_type, pos, |
216 | &data, len); | 217 | &bedata, len); |
217 | if (rc) | 218 | if (rc) |
218 | return -ENXIO; | 219 | return -ENXIO; |
220 | data = be32_to_cpu(bedata); | ||
219 | switch(len) { | 221 | switch(len) { |
220 | case 4: | 222 | case 4: |
221 | rc = __put_user((u32)data, (u32 __user *)ubuf); | 223 | rc = __put_user((u32)data, (u32 __user *)ubuf); |