diff mbox series

qla2xxx: Address a set of sparse warnings.

Message ID 20200708162515.29805-1-njavali@marvell.com (mailing list archive)
State Superseded
Headers show
Series qla2xxx: Address a set of sparse warnings. | expand

Commit Message

Nilesh Javali July 8, 2020, 4:25 p.m. UTC
From: Shyam Sundar <ssundar@marvell.com>

Fix sparse warnings,
drivers/scsi/qla2xxx/qla_isr.c:881:23: warning: restricted __le16 degrades
to integer
drivers/scsi/qla2xxx/qla_isr.c:881:23: warning: cast to restricted __le16

Signed-off-by: Shyam Sundar <ssundar@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
---
 drivers/scsi/qla2xxx/qla_def.h | 36 +++++++++++++++++-----------------
 drivers/scsi/qla2xxx/qla_fw.h  | 28 +++++++++++++-------------
 drivers/scsi/qla2xxx/qla_isr.c |  4 ++--
 3 files changed, 34 insertions(+), 34 deletions(-)

Comments

Himanshu Madhani July 13, 2020, 5:04 p.m. UTC | #1
On 7/8/20 11:25 AM, Nilesh Javali wrote:
> From: Shyam Sundar <ssundar@marvell.com>
> 
> Fix sparse warnings,
> drivers/scsi/qla2xxx/qla_isr.c:881:23: warning: restricted __le16 degrades
> to integer
> drivers/scsi/qla2xxx/qla_isr.c:881:23: warning: cast to restricted __le16
> 
> Signed-off-by: Shyam Sundar <ssundar@marvell.com>
> Signed-off-by: Nilesh Javali <njavali@marvell.com>
> ---
>   drivers/scsi/qla2xxx/qla_def.h | 36 +++++++++++++++++-----------------
>   drivers/scsi/qla2xxx/qla_fw.h  | 28 +++++++++++++-------------
>   drivers/scsi/qla2xxx/qla_isr.c |  4 ++--
>   3 files changed, 34 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
> index f6b8502a35ab..297291624ffb 100644
> --- a/drivers/scsi/qla2xxx/qla_def.h
> +++ b/drivers/scsi/qla2xxx/qla_def.h
> @@ -1997,13 +1997,13 @@ typedef struct {
>   	uint8_t sys_define;		/* System defined. */
>   	uint8_t entry_status;		/* Entry Status. */
>   	uint32_t handle;		/* System handle. */
> -	uint16_t scsi_status;		/* SCSI status. */
> -	uint16_t comp_status;		/* Completion status. */
> -	uint16_t state_flags;		/* State flags. */
> -	uint16_t status_flags;		/* Status flags. */
> -	uint16_t rsp_info_len;		/* Response Info Length. */
> -	uint16_t req_sense_length;	/* Request sense data length. */
> -	uint32_t residual_length;	/* Residual transfer length. */
> +	__le16 scsi_status;		/* SCSI status. */
> +	__le16 comp_status;		/* Completion status. */
> +	__le16 state_flags;		/* State flags. */
> +	__le16 status_flags;		/* Status flags. */
> +	__le16 rsp_info_len;		/* Response Info Length. */
> +	__le16 req_sense_length;	/* Request sense data length. */
> +	__le32 residual_length;		/* Residual transfer length. */
>   	uint8_t rsp_info[8];		/* FCP response information. */
>   	uint8_t req_sense_data[32];	/* Request sense data. */
>   } sts_entry_t;
> @@ -2193,20 +2193,20 @@ struct mbx_entry {
>   	uint32_t handle;
>   	target_id_t loop_id;
>   
> -	uint16_t status;
> -	uint16_t state_flags;
> -	uint16_t status_flags;
> +	__le16 status;
> +	__le16 state_flags;
> +	__le16 status_flags;
>   
>   	uint32_t sys_define2[2];
>   
> -	uint16_t mb0;
> -	uint16_t mb1;
> -	uint16_t mb2;
> -	uint16_t mb3;
> -	uint16_t mb6;
> -	uint16_t mb7;
> -	uint16_t mb9;
> -	uint16_t mb10;
> +	__le16 mb0;
> +	__le16 mb1;
> +	__le16 mb2;
> +	__le16 mb3;
> +	__le16 mb6;
> +	__le16 mb7;
> +	__le16 mb9;
> +	__le16 mb10;
>   	uint32_t reserved_2[2];
>   	uint8_t node_name[WWN_SIZE];
>   	uint8_t port_name[WWN_SIZE];
> diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h
> index a0d83c67dc23..bc37539a77b5 100644
> --- a/drivers/scsi/qla2xxx/qla_fw.h
> +++ b/drivers/scsi/qla2xxx/qla_fw.h
> @@ -604,32 +604,32 @@ struct sts_entry_24xx {
>   
>   	uint32_t handle;		/* System handle. */
>   
> -	uint16_t comp_status;		/* Completion status. */
> -	uint16_t ox_id;			/* OX_ID used by the firmware. */
> +	__le16 comp_status;		/* Completion status. */
> +	__le16 ox_id;			/* OX_ID used by the firmware. */
>   
> -	uint32_t residual_len;		/* FW calc residual transfer length. */
> +	__le32 residual_len;		/* FW calc residual transfer length. */
>   
>   	union {
> -		uint16_t reserved_1;
> -		uint16_t nvme_rsp_pyld_len;
> +		__le16 reserved_1;
> +		__le16 nvme_rsp_pyld_len;
>   	};
>   
> -	uint16_t state_flags;		/* State flags. */
> +	__le16 state_flags;		/* State flags. */
>   #define SF_TRANSFERRED_DATA	BIT_11
>   #define SF_NVME_ERSP            BIT_6
>   #define SF_FCP_RSP_DMA		BIT_0
>   
> -	uint16_t retry_delay;
> -	uint16_t scsi_status;		/* SCSI status. */
> +	__le16 retry_delay;
> +	__le16 scsi_status;		/* SCSI status. */
>   #define SS_CONFIRMATION_REQ		BIT_12
>   
> -	uint32_t rsp_residual_count;	/* FCP RSP residual count. */
> +	__le32 rsp_residual_count;	/* FCP RSP residual count. */
>   
> -	uint32_t sense_len;		/* FCP SENSE length. */
> +	__le32 sense_len;		/* FCP SENSE length. */
>   
>   	union {
>   		struct {
> -			uint32_t rsp_data_len;	/* FCP response data length  */
> +			__le32 rsp_data_len;	/* FCP response data length  */
>   			uint8_t data[28];	/* FCP rsp/sense information */
>   		};
>   		struct nvme_fc_ersp_iu nvme_ersp;
> @@ -742,10 +742,10 @@ struct purex_entry_24xx {
>   	uint16_t status_flags;
>   	uint16_t nport_handle;
>   
> -	uint16_t frame_size;
> -	uint16_t trunc_frame_size;
> +	__le16 frame_size;
> +	__le16 trunc_frame_size;
>   
> -	uint32_t rx_xchg_addr;
> +	__le32 rx_xchg_addr;
>   
>   	uint8_t d_id[3];
>   	uint8_t r_ctl;
> diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
> index 039099ddc472..1c923ee75441 100644
> --- a/drivers/scsi/qla2xxx/qla_isr.c
> +++ b/drivers/scsi/qla2xxx/qla_isr.c
> @@ -791,7 +791,7 @@ qla27xx_handle_8200_aen(scsi_qla_host_t *vha, uint16_t *mb)
>   	}
>   }
>   
> -struct purex_item *
> +static struct purex_item *
>   qla24xx_alloc_purex_item(scsi_qla_host_t *vha, uint16_t size)
>   {
>   	struct purex_item *item = NULL;
> @@ -879,7 +879,7 @@ qla27xx_copy_fpin_pkt(struct scsi_qla_host *vha, void **pkt,
>   	struct purex_item *item;
>   	void *fpin_pkt = NULL;
>   
> -	total_bytes = le16_to_cpu(purex->frame_size & 0x0FFF)
> +	total_bytes = (le16_to_cpu(purex->frame_size) & 0x0FFF)
>   	    - PURX_ELS_HEADER_SIZE;
>   	pending_bytes = total_bytes;
>   	entry_count = entry_count_remaining = purex->entry_count;
> 

Looks Good.

Reviewed-by: Himanshu Madhani  <himanshu.madhani@oracle.com>
Martin K. Petersen July 14, 2020, 3:09 a.m. UTC | #2
Nilesh,

> Fix sparse warnings,
> drivers/scsi/qla2xxx/qla_isr.c:881:23: warning: restricted __le16 degrades
> to integer
> drivers/scsi/qla2xxx/qla_isr.c:881:23: warning: cast to restricted __le16

Does not apply to 5.9/scsi-queue. Please rebase.

Thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index f6b8502a35ab..297291624ffb 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -1997,13 +1997,13 @@  typedef struct {
 	uint8_t sys_define;		/* System defined. */
 	uint8_t entry_status;		/* Entry Status. */
 	uint32_t handle;		/* System handle. */
-	uint16_t scsi_status;		/* SCSI status. */
-	uint16_t comp_status;		/* Completion status. */
-	uint16_t state_flags;		/* State flags. */
-	uint16_t status_flags;		/* Status flags. */
-	uint16_t rsp_info_len;		/* Response Info Length. */
-	uint16_t req_sense_length;	/* Request sense data length. */
-	uint32_t residual_length;	/* Residual transfer length. */
+	__le16 scsi_status;		/* SCSI status. */
+	__le16 comp_status;		/* Completion status. */
+	__le16 state_flags;		/* State flags. */
+	__le16 status_flags;		/* Status flags. */
+	__le16 rsp_info_len;		/* Response Info Length. */
+	__le16 req_sense_length;	/* Request sense data length. */
+	__le32 residual_length;		/* Residual transfer length. */
 	uint8_t rsp_info[8];		/* FCP response information. */
 	uint8_t req_sense_data[32];	/* Request sense data. */
 } sts_entry_t;
@@ -2193,20 +2193,20 @@  struct mbx_entry {
 	uint32_t handle;
 	target_id_t loop_id;
 
-	uint16_t status;
-	uint16_t state_flags;
-	uint16_t status_flags;
+	__le16 status;
+	__le16 state_flags;
+	__le16 status_flags;
 
 	uint32_t sys_define2[2];
 
-	uint16_t mb0;
-	uint16_t mb1;
-	uint16_t mb2;
-	uint16_t mb3;
-	uint16_t mb6;
-	uint16_t mb7;
-	uint16_t mb9;
-	uint16_t mb10;
+	__le16 mb0;
+	__le16 mb1;
+	__le16 mb2;
+	__le16 mb3;
+	__le16 mb6;
+	__le16 mb7;
+	__le16 mb9;
+	__le16 mb10;
 	uint32_t reserved_2[2];
 	uint8_t node_name[WWN_SIZE];
 	uint8_t port_name[WWN_SIZE];
diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h
index a0d83c67dc23..bc37539a77b5 100644
--- a/drivers/scsi/qla2xxx/qla_fw.h
+++ b/drivers/scsi/qla2xxx/qla_fw.h
@@ -604,32 +604,32 @@  struct sts_entry_24xx {
 
 	uint32_t handle;		/* System handle. */
 
-	uint16_t comp_status;		/* Completion status. */
-	uint16_t ox_id;			/* OX_ID used by the firmware. */
+	__le16 comp_status;		/* Completion status. */
+	__le16 ox_id;			/* OX_ID used by the firmware. */
 
-	uint32_t residual_len;		/* FW calc residual transfer length. */
+	__le32 residual_len;		/* FW calc residual transfer length. */
 
 	union {
-		uint16_t reserved_1;
-		uint16_t nvme_rsp_pyld_len;
+		__le16 reserved_1;
+		__le16 nvme_rsp_pyld_len;
 	};
 
-	uint16_t state_flags;		/* State flags. */
+	__le16 state_flags;		/* State flags. */
 #define SF_TRANSFERRED_DATA	BIT_11
 #define SF_NVME_ERSP            BIT_6
 #define SF_FCP_RSP_DMA		BIT_0
 
-	uint16_t retry_delay;
-	uint16_t scsi_status;		/* SCSI status. */
+	__le16 retry_delay;
+	__le16 scsi_status;		/* SCSI status. */
 #define SS_CONFIRMATION_REQ		BIT_12
 
-	uint32_t rsp_residual_count;	/* FCP RSP residual count. */
+	__le32 rsp_residual_count;	/* FCP RSP residual count. */
 
-	uint32_t sense_len;		/* FCP SENSE length. */
+	__le32 sense_len;		/* FCP SENSE length. */
 
 	union {
 		struct {
-			uint32_t rsp_data_len;	/* FCP response data length  */
+			__le32 rsp_data_len;	/* FCP response data length  */
 			uint8_t data[28];	/* FCP rsp/sense information */
 		};
 		struct nvme_fc_ersp_iu nvme_ersp;
@@ -742,10 +742,10 @@  struct purex_entry_24xx {
 	uint16_t status_flags;
 	uint16_t nport_handle;
 
-	uint16_t frame_size;
-	uint16_t trunc_frame_size;
+	__le16 frame_size;
+	__le16 trunc_frame_size;
 
-	uint32_t rx_xchg_addr;
+	__le32 rx_xchg_addr;
 
 	uint8_t d_id[3];
 	uint8_t r_ctl;
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 039099ddc472..1c923ee75441 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -791,7 +791,7 @@  qla27xx_handle_8200_aen(scsi_qla_host_t *vha, uint16_t *mb)
 	}
 }
 
-struct purex_item *
+static struct purex_item *
 qla24xx_alloc_purex_item(scsi_qla_host_t *vha, uint16_t size)
 {
 	struct purex_item *item = NULL;
@@ -879,7 +879,7 @@  qla27xx_copy_fpin_pkt(struct scsi_qla_host *vha, void **pkt,
 	struct purex_item *item;
 	void *fpin_pkt = NULL;
 
-	total_bytes = le16_to_cpu(purex->frame_size & 0x0FFF)
+	total_bytes = (le16_to_cpu(purex->frame_size) & 0x0FFF)
 	    - PURX_ELS_HEADER_SIZE;
 	pending_bytes = total_bytes;
 	entry_count = entry_count_remaining = purex->entry_count;