iw_cxgb4: Use proper enumerated type in c4iw_bar2_addrs
Subsystems (2)
PATCH 1/1 iw_cxgb4: Use proper enumerated type in c4iw_bar2_addrs
Clang warns when one enumerated type is implicitly converted to another.
drivers/infiniband/hw/cxgb4/qp.c:287:8: warning: implicit conversion from enumeration type 'enum t4_bar2_qtype' to different enumeration type 'enum cxgb4_bar2_qtype' [-Wenum-conversion]
T4_BAR2_QTYPE_EGRESS,
^~~~~~~~~~~~~~~~~~~~c4iw_bar2_addrs expects a value from enum cxgb4_bar2_qtype so use the corresponding values from that type so Clang is satisfied without changing the meaning of the code.
T4_BAR2_QTYPE_EGRESS = CXGB4_BAR2_QTYPE_EGRESS = 0 T4_BAR2_QTYPE_INGRESS = CXGB4_BAR2_QTYPE_INGRESS = 1
--- drivers/infiniband/hw/cxgb4/cq.c | 2 +- drivers/infiniband/hw/cxgb4/qp.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/infiniband/hw/cxgb4/cq.c +1 -1
@@ -161,7 +161,7 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq, cq->gts = rdev->lldi.gts_reg; cq->rdev = rdev; - cq->bar2_va =c4iw_bar2_addrs (rdev, cq->cqid,T4_BAR2_QTYPE_INGRESS , + cq->bar2_va =c4iw_bar2_addrs (rdev, cq->cqid,CXGB4_BAR2_QTYPE_INGRESS , &cq->bar2_qid, user ? &cq->bar2_pa :NULL );if (user && !cq->bar2_pa) {
drivers/infiniband/hw/cxgb4/qp.c +4 -3
@@ -279,12 +279,13 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, wq->db = rdev->lldi.db_reg; - wq->sq.bar2_va =c4iw_bar2_addrs (rdev, wq->sq.qid,T4_BAR2_QTYPE_EGRESS , + wq->sq.bar2_va =c4iw_bar2_addrs (rdev, wq->sq.qid, +CXGB4_BAR2_QTYPE_EGRESS , &wq->sq.bar2_qid, user ? &wq->sq.bar2_pa :NULL );if (need_rq) wq->rq.bar2_va =c4iw_bar2_addrs (rdev, wq->rq.qid, -T4_BAR2_QTYPE_EGRESS , +CXGB4_BAR2_QTYPE_EGRESS , &wq->rq.bar2_qid, user ? &wq->rq.bar2_pa :NULL );
@@ -2572,7 +2573,7 @@ static int alloc_srq_queue(struct c4iw_srq *srq, struct c4iw_dev_ucontext *uctx,memset (wq->queue,0 , wq->memsize);pci_unmap_addr_set (wq, mapping, wq->dma_addr); - wq->bar2_va =c4iw_bar2_addrs (rdev, wq->qid,T4_BAR2_QTYPE_EGRESS , + wq->bar2_va =c4iw_bar2_addrs (rdev, wq->qid,CXGB4_BAR2_QTYPE_EGRESS , &wq->bar2_qid, user ? &wq->bar2_pa :NULL );
Signature · 1 line
2.19.0
Quoted 12 lines · Nathan Chancellor
Clang warns when one enumerated type is implicitly converted to another.
drivers/infiniband/hw/cxgb4/qp.c:287:8: warning: implicit conversion from enumeration type 'enumt4_bar2_qtype' to different enumeration type 'enumcxgb4_bar2_qtype' [-Wenum-conversion]T4_BAR2_QTYPE_EGRESS, ^~~~~~~~~~~~~~~~~~~~
c4iw_bar2_addrsexpects a value from enumcxgb4_bar2_qtypeso use the corresponding values from that type so Clang is satisfied without changing the meaning of the code.
Quoted 5 lines
T4_BAR2_QTYPE_EGRESS=CXGB4_BAR2_QTYPE_EGRESS= 0T4_BAR2_QTYPE_INGRESS=CXGB4_BAR2_QTYPE_INGRESS= 1Reported-by Nick Desaulniers <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>
Looks correct, Thanks.
Jason Gunthorpe
AppliedQuoted 15 lines · Nathan Chancellor
Clang warns when one enumerated type is implicitly converted to another.
drivers/infiniband/hw/cxgb4/qp.c:287:8: warning: implicit conversion from enumeration type 'enumt4_bar2_qtype' to different enumeration type 'enumcxgb4_bar2_qtype' [-Wenum-conversion]T4_BAR2_QTYPE_EGRESS, ^~~~~~~~~~~~~~~~~~~~
c4iw_bar2_addrsexpects a value from enumcxgb4_bar2_qtypeso use the corresponding values from that type so Clang is satisfied without changing the meaning of the code.
T4_BAR2_QTYPE_EGRESS=CXGB4_BAR2_QTYPE_EGRESS= 0T4_BAR2_QTYPE_INGRESS=CXGB4_BAR2_QTYPE_INGRESS= 1
Quoted 7 lines
Reported-by Nick Desaulniers <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>Acked-by Steve Wise <[email protected]>--- drivers/infiniband/hw/cxgb4/cq.c | 2 +- drivers/infiniband/hw/cxgb4/qp.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-)
Applied to for-next
Thanks,
Jason