scsi: qla2xxx: Change two hardcoded constants into offsetof() / sizeof() expressions
authorBart Van Assche <bvanassche@acm.org>
Mon, 18 May 2020 21:17:05 +0000 (14:17 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 20 May 2020 01:43:07 +0000 (21:43 -0400)
This patch does not change any functionality.

Link: https://lore.kernel.org/r/20200518211712.11395-9-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_fw.h
drivers/scsi/qla2xxx/qla_sup.c

index 4fa3437..f18d2d0 100644 (file)
@@ -2216,9 +2216,8 @@ struct qla_fcp_prio_cfg {
 #define FCP_PRIO_ATTR_ENABLE    0x1
 #define FCP_PRIO_ATTR_PERSIST   0x2
        uint8_t  reserved;      /* Reserved for future use          */
-#define FCP_PRIO_CFG_HDR_SIZE   0x10
+#define FCP_PRIO_CFG_HDR_SIZE   offsetof(struct qla_fcp_prio_cfg, entry)
        struct qla_fcp_prio_entry entry[1023]; /* fcp priority entries  */
-#define FCP_PRIO_CFG_ENTRY_SIZE 0x20
        uint8_t  reserved2[16];
 };
 
index 3da79ee..57ffbf9 100644 (file)
@@ -3617,7 +3617,7 @@ qla24xx_read_fcp_prio_cfg(scsi_qla_host_t *vha)
 
        /* read remaining FCP CMD config data from flash */
        fcp_prio_addr += (FCP_PRIO_CFG_HDR_SIZE >> 2);
-       len = ha->fcp_prio_cfg->num_entries * FCP_PRIO_CFG_ENTRY_SIZE;
+       len = ha->fcp_prio_cfg->num_entries * sizeof(struct qla_fcp_prio_entry);
        max_len = FCP_PRIO_CFG_SIZE - FCP_PRIO_CFG_HDR_SIZE;
 
        ha->isp_ops->read_optrom(vha, &ha->fcp_prio_cfg->entry[0],