Thread (17 messages) flat view 17 messages, 3 authors, 2016-10-05
STALE3601d

[PATCH 6/9] powerpc/powernv: Pass CPU-endian argument to xchg() in pnv_tce_xchg()

From: Gavin Shan <hidden>
Date: 2016-08-02 04:11:06
Subsystem: linux for powerpc (32-bit and 64-bit), the rest · Maintainers: Madhavan Srinivasan, Linus Torvalds

This fixes warning reported from sparse:

  gwshan@gwshan:~/sandbox/l$ make C=2 CF=-D__CHECK_ENDIAN__ \
                             arch/powerpc/platforms/powernv/pci.o
  arch/powerpc/platforms/powernv/pci.c:740:18: \
  warning: cast from restricted __be64
  arch/powerpc/platforms/powernv/pci.c:740:18: \
  warning: cast to restricted __be64
  arch/powerpc/platforms/powernv/pci.c:740:18: \
  warning: cast from restricted __be64
  arch/powerpc/platforms/powernv/pci.c:740:18: \
  warning: cast to restricted __be64

Cc: Alexey Kardashevskiy <redacted>
Fixes: 802a345183c0 ("powerpc/powernv/ioda: Fix endianness when reading TCEs")
Signed-off-by: Gavin Shan <redacted>
---
 arch/powerpc/platforms/powernv/pci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index 9a26a57..4e385f9 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -737,7 +737,9 @@ int pnv_tce_xchg(struct iommu_table *tbl, long index,
 	if (newtce & TCE_PCI_WRITE)
 		newtce |= TCE_PCI_READ;
 
-	oldtce = be64_to_cpu(xchg(pnv_tce(tbl, idx), cpu_to_be64(newtce)));
+	oldtce = be64_to_cpu((__force __be64)xchg(
+			(unsigned long *)pnv_tce(tbl, idx),
+			(__force unsigned long)cpu_to_be64(newtce)));
 	*hpa = oldtce & ~(TCE_PCI_READ | TCE_PCI_WRITE);
 	*direction = iommu_tce_direction(oldtce);
 
-- 
2.1.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help