diff options
author | Bart Van Assche <bvanassche@acm.org> | 2019-12-18 16:47:06 -0800 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2020-01-02 21:53:30 -0500 |
commit | a27747a207887420106aca284c0e98ba5e547d78 (patch) | |
tree | 7fe93e9ca26eebc770b3d1eba2817efa1c8480c3 /drivers/scsi/qla2xxx/qla_sup.c | |
parent | b3e3d4c618c5b97ca8aa12779df770782be83fb2 (diff) | |
download | linux-a27747a207887420106aca284c0e98ba5e547d78.tar.bz2 |
scsi: qla2xxx: Improve readability of the code that handles qla_flt_header
Declare qla_hw_data.flt as a qla_flt_header pointer instead of as a void
pointer. Add a zero-length array at the end of struct qla_flt_header to
make it clear that qla_flt_header and qla_flt_region are contiguous. This
patch removes several casts but does not change any functionality.
Cc: Himanshu Madhani <hmadhani@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Daniel Wagner <dwagner@suse.de>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Link: https://lore.kernel.org/r/20191219004706.39039-1-bvanassche@acm.org
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_sup.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_sup.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c index bbe90354f49b..76a38bf86cbc 100644 --- a/drivers/scsi/qla2xxx/qla_sup.c +++ b/drivers/scsi/qla2xxx/qla_sup.c @@ -669,8 +669,8 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr) struct qla_hw_data *ha = vha->hw; uint32_t def = IS_QLA81XX(ha) ? 2 : IS_QLA25XX(ha) ? 1 : 0; - struct qla_flt_header *flt = (void *)ha->flt; - struct qla_flt_region *region = (void *)&flt[1]; + struct qla_flt_header *flt = ha->flt; + struct qla_flt_region *region = &flt->region[0]; uint16_t *wptr, cnt, chksum; uint32_t start; @@ -2652,18 +2652,15 @@ qla28xx_get_flash_region(struct scsi_qla_host *vha, uint32_t start, struct qla_flt_region *region) { struct qla_hw_data *ha = vha->hw; - struct qla_flt_header *flt; - struct qla_flt_region *flt_reg; + struct qla_flt_header *flt = ha->flt; + struct qla_flt_region *flt_reg = &flt->region[0]; uint16_t cnt; int rval = QLA_FUNCTION_FAILED; if (!ha->flt) return QLA_FUNCTION_FAILED; - flt = (struct qla_flt_header *)ha->flt; - flt_reg = (struct qla_flt_region *)&flt[1]; cnt = le16_to_cpu(flt->length) / sizeof(struct qla_flt_region); - for (; cnt; cnt--, flt_reg++) { if (flt_reg->start == start) { memcpy((uint8_t *)region, flt_reg, |