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 <a...@ozlabs.ru>
Fixes: 802a345183c0 ("powerpc/powernv/ioda: Fix endianness when reading TCEs")
Signed-off-by: Gavin Shan <gws...@linux.vnet.ibm.com>
---
 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

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to