"scsi: mpt3sas: Bug fix for big endian systems"

Above patch with commit id "cf6bf9710cabba1fe94a4349f4eb8db623c77ebc" was
posted to fix sparse warnings. While posting this patch it was assumed that
readl() & writel() APIs internally calls le32_to_cpu() & cpu_to_le32() APIs
respectively. Looks like it is not true for all architecture and hence
this patch is reverting back only those hunks which removed le32_to_cpu()
API call while using readl() API & cpu_to_le32() API call while using
writel() API.

Signed-off-by: Chaitra P B <[email protected]>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index dc41bd3..17b6b0a 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -3321,7 +3321,7 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
                                        spinlock_t *writeq_lock)
 {
        unsigned long flags;
-       __u64 data_out = b;
+       __u64 data_out = cpu_to_le64(b);
 
        spin_lock_irqsave(writeq_lock, flags);
        writel((u32)(data_out), addr);
@@ -3344,7 +3344,7 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
 static inline void
 _base_writeq(__u64 b, volatile void __iomem *addr, spinlock_t *writeq_lock)
 {
-       writeq(b, addr);
+       writeq(cpu_to_le64(b), addr);
 }
 #else
 static inline void
@@ -5215,7 +5215,7 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
 
        /* send message 32-bits at a time */
        for (i = 0, failed = 0; i < request_bytes/4 && !failed; i++) {
-               writel((u32)(request[i]), &ioc->chip->Doorbell);
+               writel(cpu_to_le32(request[i]), &ioc->chip->Doorbell);
                if ((_base_wait_for_doorbell_ack(ioc, 5)))
                        failed = 1;
        }
@@ -5236,7 +5236,7 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
        }
 
        /* read the first two 16-bits, it gives the total length of the reply */
-       reply[0] = (u16)(readl(&ioc->chip->Doorbell)
+       reply[0] = le16_to_cpu(readl(&ioc->chip->Doorbell)
            & MPI2_DOORBELL_DATA_MASK);
        writel(0, &ioc->chip->HostInterruptStatus);
        if ((_base_wait_for_doorbell_int(ioc, 5))) {
@@ -5245,7 +5245,7 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
                        ioc->name, __LINE__);
                return -EFAULT;
        }
-       reply[1] = (u16)(readl(&ioc->chip->Doorbell)
+       reply[1] = le16_to_cpu(readl(&ioc->chip->Doorbell)
            & MPI2_DOORBELL_DATA_MASK);
        writel(0, &ioc->chip->HostInterruptStatus);
 
@@ -5259,7 +5259,7 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
                if (i >=  reply_bytes/2) /* overflow case */
                        readl(&ioc->chip->Doorbell);
                else
-                       reply[i] = (u16)(readl(&ioc->chip->Doorbell)
+                       reply[i] = le16_to_cpu(readl(&ioc->chip->Doorbell)
                            & MPI2_DOORBELL_DATA_MASK);
                writel(0, &ioc->chip->HostInterruptStatus);
        }
-- 
1.8.3.1

Reply via email to