Skip to contentSkip to conversation

pm8001: fix endian issue with code optimization.

PATCH In review santosh nayak 3 participants 3 messages Mar 19, 2012 – Mar 20, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 pm8001: fix endian issue with code optimization.

From: Santosh Nayak <[email protected]>

Data type of the 'tag' field of 'fw_flash_Update_resp' should be __le32.

Data type of 'pHeader' should be __le32.
Remove 2nd cast to 'piomb'.

---
 drivers/scsi/pm8001/pm8001_hwi.c |    6 +++---
 drivers/scsi/pm8001/pm8001_hwi.h |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +3 -3
index 3619f6e..6d83236 100644
@@ -3355,7 +3355,7 @@ mpi_fw_flash_update_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
 	struct fw_control_ex	fw_control_context;
 	struct fw_flash_Update_resp *ppayload =
 		(struct fw_flash_Update_resp *)(piomb + 4);
-	u32 tag = ppayload->tag;
+	u32 tag = le32_to_cpu(ppayload->tag);
 	struct pm8001_ccb_info *ccb = &pm8001_ha->ccb_info[tag];
 	status = le32_to_cpu(ppayload->status);
 	memcpy(&fw_control_context,
@@ -3701,8 +3701,8 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
  */
 static void process_one_iomb(struct pm8001_hba_info *pm8001_ha, void *piomb)
 {
-	u32 pHeader = (u32)*(u32 *)piomb;
-	u8 opc = (u8)(pHeader & 0xFFF);
+	__le32 pHeader = *(__le32 *)piomb;
+	u8 opc = (u8)((le32_to_cpu(pHeader)) & 0xFFF);
 
 	PM8001_MSG_DBG(pm8001_ha, pm8001_printk("process_one_iomb:"));
 
drivers/scsi/pm8001/pm8001_hwi.h +1 -1
index 1a4611e..d437309 100644
@@ -599,7 +599,7 @@ struct fw_flash_Update_req {
  *
  */
 struct fw_flash_Update_resp {
-	dma_addr_t	tag;
+	__le32	tag;
 	__le32	status;
 	u32	reserved[13];
 } __attribute__((packed, aligned(4)));
Signature · 1 line
1.7.4.4
#1 lore raw

ACK

Sincerely -- Mark Salyzyn

Quoted 53 lines · santosh nayak

From: Santosh Nayak <[email protected]>

Data type of the 'tag' field of 'fw_flash_Update_resp' should be __le32.

Data type of 'pHeader' should be __le32.
Remove 2nd cast to 'piomb'.

---

drivers/scsi/pm8001/pm8001_hwi.c |    6 +++---
drivers/scsi/pm8001/pm8001_hwi.h |    2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +3 -3
index 3619f6e..6d83236 100644
@@ -3355,7 +3355,7 @@ mpi_fw_flash_update_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
 	struct fw_control_ex	fw_control_context;
 	struct fw_flash_Update_resp *ppayload > 		(struct fw_flash_Update_resp *)(piomb + 4);
-	u32 tag = ppayload->tag;
+	u32 tag = le32_to_cpu(ppayload->tag);
 	struct pm8001_ccb_info *ccb = &pm8001_ha->ccb_info[tag];
 	status = le32_to_cpu(ppayload->status);
 	memcpy(&fw_control_context,
@@ -3701,8 +3701,8 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)
 */
 static void process_one_iomb(struct pm8001_hba_info *pm8001_ha, void *piomb)
 {
-	u32 pHeader = (u32)*(u32 *)piomb;
-	u8 opc = (u8)(pHeader & 0xFFF);
+	__le32 pHeader = *(__le32 *)piomb;
+	u8 opc = (u8)((le32_to_cpu(pHeader)) & 0xFFF);
 
 	PM8001_MSG_DBG(pm8001_ha, pm8001_printk("process_one_iomb:"));
 
drivers/scsi/pm8001/pm8001_hwi.h +1 -1
index 1a4611e..d437309 100644
@@ -599,7 +599,7 @@ struct fw_flash_Update_req {
 *
 */
 struct fw_flash_Update_resp {
-	dma_addr_t	tag;
+	__le32	tag;
 	__le32	status;
 	u32	reserved[13];
 } __attribute__((packed, aligned(4)));
Signature · 1 line
1.7.4.4
Acked-by on v3 1/1
#2 lore raw

Re [PATCH v3] [SCSI] pm8001: fix endian issue with code optimization.

In reply to santosh nayak
Quoted 29 lines

From: Santosh Nayak <[email protected]>

Data type of the 'tag' field of 'fw_flash_Update_resp' should be __le32.

Data type of 'pHeader' should be __le32.
Remove 2nd cast to 'piomb'.

---
 drivers/scsi/pm8001/pm8001_hwi.c |    6 +++---
 drivers/scsi/pm8001/pm8001_hwi.h |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +1 -1
index 3619f6e..6d83236 100644
@@ -3355,7 +3355,7 @@ mpi_fw_flash_update_resp(struct pm8001_hba_info
 *pm8001_ha, void *piomb)
 	struct fw_control_ex	fw_control_context;
 	struct fw_flash_Update_resp *ppayload >  		(struct fw_flash_Update_resp *)(piomb + 4);
-	u32 tag = ppayload->tag;
+	u32 tag = le32_to_cpu(ppayload->tag);
 	struct pm8001_ccb_info *ccb = &pm8001_ha->ccb_info[tag];
 	status = le32_to_cpu(ppayload->status);
 	memcpy(&fw_control_context,

drivers/scsi/pm8001/pm8001_hwi.c static int mpi_hw_event(struct pm8001_hba_info · line 3703

Quoted 3 lines
drivers/scsi/pm8001/pm8001_hwi.c +0 -0
@@ -3701,8 +3701,8 @@ static int mpi_hw_event(struct pm8001_hba_info
 *pm8001_ha, void* piomb)
  */
 static void process_one_iomb(struct pm8001_hba_info *pm8001_ha, void

*piomb)

Quoted 29 lines
drivers/scsi/pm8001/pm8001_hwi.c +2 -2
 {
-	u32 pHeader = (u32)*(u32 *)piomb;
-	u8 opc = (u8)(pHeader & 0xFFF);
+	__le32 pHeader = *(__le32 *)piomb;
+	u8 opc = (u8)((le32_to_cpu(pHeader)) & 0xFFF);
 
 	PM8001_MSG_DBG(pm8001_ha, pm8001_printk("process_one_iomb:"));
drivers/scsi/pm8001/pm8001_hwi.h +1 -2
index 1a4611e..d437309 100644
@@ -599,7 +599,7 @@ struct fw_flash_Update_req {
  *
  */
 struct fw_flash_Update_resp {
-	dma_addr_t	tag;
+	__le32	tag;
 	__le32	status;
 	u32	reserved[13];
 } __attribute__((packed, aligned(4)));
--

1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html