mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-15 14:26:40 +07:00
scsi: qla2xxx: Reduce the number of casts in GID list code
This patch makes the code that parses the GID list easier to read without changing the behavior of the code. Cc: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Tested-by: Himanshu Madhani <hmadhani@marvell.com> Reviewed-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
57bf595a6f
commit
9c17c3b1e0
@ -57,10 +57,9 @@ qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused)
|
||||
{
|
||||
scsi_qla_host_t *vha = s->private;
|
||||
struct qla_hw_data *ha = vha->hw;
|
||||
struct gid_list_info *gid_list;
|
||||
struct gid_list_info *gid_list, *gid;
|
||||
dma_addr_t gid_list_dma;
|
||||
fc_port_t fc_port;
|
||||
char *id_iter;
|
||||
int rc, i;
|
||||
uint16_t entries, loop_id;
|
||||
struct qla_tgt *tgt = vha->vha_tgt.qla_tgt;
|
||||
@ -82,13 +81,11 @@ qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused)
|
||||
if (rc != QLA_SUCCESS)
|
||||
goto out_free_id_list;
|
||||
|
||||
id_iter = (char *)gid_list;
|
||||
gid = gid_list;
|
||||
|
||||
seq_puts(s, "Port Name Port ID Loop ID\n");
|
||||
|
||||
for (i = 0; i < entries; i++) {
|
||||
struct gid_list_info *gid =
|
||||
(struct gid_list_info *)id_iter;
|
||||
loop_id = le16_to_cpu(gid->loop_id);
|
||||
memset(&fc_port, 0, sizeof(fc_port_t));
|
||||
|
||||
@ -99,7 +96,7 @@ qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused)
|
||||
fc_port.port_name, fc_port.d_id.b.domain,
|
||||
fc_port.d_id.b.area, fc_port.d_id.b.al_pa,
|
||||
fc_port.loop_id);
|
||||
id_iter += ha->gid_list_info_size;
|
||||
gid = (void *)gid + ha->gid_list_info_size;
|
||||
}
|
||||
out_free_id_list:
|
||||
dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha),
|
||||
|
@ -5086,7 +5086,7 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
|
||||
|
||||
uint16_t index;
|
||||
uint16_t entries;
|
||||
char *id_iter;
|
||||
struct gid_list_info *gid;
|
||||
uint16_t loop_id;
|
||||
uint8_t domain, area, al_pa;
|
||||
struct qla_hw_data *ha = vha->hw;
|
||||
@ -5161,18 +5161,16 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
|
||||
new_fcport->flags &= ~FCF_FABRIC_DEVICE;
|
||||
|
||||
/* Add devices to port list. */
|
||||
id_iter = (char *)ha->gid_list;
|
||||
gid = ha->gid_list;
|
||||
for (index = 0; index < entries; index++) {
|
||||
domain = ((struct gid_list_info *)id_iter)->domain;
|
||||
area = ((struct gid_list_info *)id_iter)->area;
|
||||
al_pa = ((struct gid_list_info *)id_iter)->al_pa;
|
||||
domain = gid->domain;
|
||||
area = gid->area;
|
||||
al_pa = gid->al_pa;
|
||||
if (IS_QLA2100(ha) || IS_QLA2200(ha))
|
||||
loop_id = (uint16_t)
|
||||
((struct gid_list_info *)id_iter)->loop_id_2100;
|
||||
loop_id = gid->loop_id_2100;
|
||||
else
|
||||
loop_id = le16_to_cpu(
|
||||
((struct gid_list_info *)id_iter)->loop_id);
|
||||
id_iter += ha->gid_list_info_size;
|
||||
loop_id = le16_to_cpu(gid->loop_id);
|
||||
gid = (void *)gid + ha->gid_list_info_size;
|
||||
|
||||
/* Bypass reserved domain fields. */
|
||||
if ((domain & 0xf0) == 0xf0)
|
||||
|
@ -1290,8 +1290,7 @@ static int qla24xx_get_loop_id(struct scsi_qla_host *vha, const uint8_t *s_id,
|
||||
{
|
||||
struct qla_hw_data *ha = vha->hw;
|
||||
dma_addr_t gid_list_dma;
|
||||
struct gid_list_info *gid_list;
|
||||
char *id_iter;
|
||||
struct gid_list_info *gid_list, *gid;
|
||||
int res, rc, i;
|
||||
uint16_t entries;
|
||||
|
||||
@ -1314,11 +1313,9 @@ static int qla24xx_get_loop_id(struct scsi_qla_host *vha, const uint8_t *s_id,
|
||||
goto out_free_id_list;
|
||||
}
|
||||
|
||||
id_iter = (char *)gid_list;
|
||||
gid = gid_list;
|
||||
res = -ENOENT;
|
||||
for (i = 0; i < entries; i++) {
|
||||
struct gid_list_info *gid = (struct gid_list_info *)id_iter;
|
||||
|
||||
if ((gid->al_pa == s_id[2]) &&
|
||||
(gid->area == s_id[1]) &&
|
||||
(gid->domain == s_id[0])) {
|
||||
@ -1326,7 +1323,7 @@ static int qla24xx_get_loop_id(struct scsi_qla_host *vha, const uint8_t *s_id,
|
||||
res = 0;
|
||||
break;
|
||||
}
|
||||
id_iter += ha->gid_list_info_size;
|
||||
gid = (void *)gid + ha->gid_list_info_size;
|
||||
}
|
||||
|
||||
out_free_id_list:
|
||||
|
Loading…
Reference in New Issue
Block a user