[PATCH 8/9] powerpc/powernv: Fix data type of argument to __raw_{rm_, }writeq()

Gavin Shan gwshan at linux.vnet.ibm.com
Tue Aug 2 14:10:36 AEST 2016


The value passed to __raw_rm_writeq() and __raw_writeq() should be "u64"
and "unsigned long". This fixes warning reported from sparse:

  gwshan at gwshan:~/sandbox/l$ make C=2 CF=-D__CHECK_ENDIAN__ \
                             arch/powerpc/platforms/powernv/pci-ioda.o
  arch/powerpc/platforms/powernv/pci-ioda.c:1794:41: \
  warning: incorrect type in argument 1 (different base types)
  arch/powerpc/platforms/powernv/pci-ioda.c:1794:41: \
  expected unsigned long long [unsigned] [usertype] val
  arch/powerpc/platforms/powernv/pci-ioda.c:1794:41: \
  got restricted __be64 [usertype] <noident>
  arch/powerpc/platforms/powernv/pci-ioda.c:1796:38: \
  warning: incorrect type in argument 1 (different base types)
  arch/powerpc/platforms/powernv/pci-ioda.c:1796:38: \
  expected unsigned long [unsigned] v
  arch/powerpc/platforms/powernv/pci-ioda.c:1796:38: \
  got restricted __be64 [usertype] <noident>

Signed-off-by: Gavin Shan <gwshan at linux.vnet.ibm.com>
---
 arch/powerpc/platforms/powernv/pci-ioda.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index ac60190..3d367ba 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1791,9 +1791,11 @@ static void pnv_pci_p7ioc_tce_invalidate(struct iommu_table *tbl,
         mb(); /* Ensure above stores are visible */
         while (start <= end) {
 		if (rm)
-			__raw_rm_writeq(cpu_to_be64(start), invalidate);
+			__raw_rm_writeq((__force u64)cpu_to_be64(start),
+					invalidate);
 		else
-			__raw_writeq(cpu_to_be64(start), invalidate);
+			__raw_writeq((__force unsigned long)cpu_to_be64(start),
+				     invalidate);
                 start += inc;
         }
 
@@ -1858,9 +1860,11 @@ void pnv_pci_phb3_tce_invalidate_entire(struct pnv_phb *phb, bool rm)
 
 	mb(); /* Ensure previous TCE table stores are visible */
 	if (rm)
-		__raw_rm_writeq(cpu_to_be64(val), invalidate);
+		__raw_rm_writeq((__force u64)cpu_to_be64(val),
+				invalidate);
 	else
-		__raw_writeq(cpu_to_be64(val), invalidate);
+		__raw_writeq((__force unsigned long)cpu_to_be64(val),
+			     invalidate);
 }
 
 static inline void pnv_pci_phb3_tce_invalidate_pe(struct pnv_ioda_pe *pe)
@@ -1870,7 +1874,7 @@ static inline void pnv_pci_phb3_tce_invalidate_pe(struct pnv_ioda_pe *pe)
 	unsigned long val = PHB3_TCE_KILL_INVAL_PE | (pe->pe_number & 0xFF);
 
 	mb(); /* Ensure above stores are visible */
-	__raw_writeq(cpu_to_be64(val), invalidate);
+	__raw_writeq((__force unsigned long)cpu_to_be64(val), invalidate);
 }
 
 static void pnv_pci_phb3_tce_invalidate(struct pnv_ioda_pe *pe, bool rm,
@@ -1893,9 +1897,11 @@ static void pnv_pci_phb3_tce_invalidate(struct pnv_ioda_pe *pe, bool rm,
 
 	while (start <= end) {
 		if (rm)
-			__raw_rm_writeq(cpu_to_be64(start), invalidate);
+			__raw_rm_writeq((__force u64)cpu_to_be64(start),
+					invalidate);
 		else
-			__raw_writeq(cpu_to_be64(start), invalidate);
+			__raw_writeq((__force unsigned long)cpu_to_be64(start),
+				     invalidate);
 		start += inc;
 	}
 }
-- 
2.1.0



More information about the Linuxppc-dev mailing list