[<prev] [next>] [day] [month] [year] [list]
Message-ID: <Y9VVMh8epgxQYyji@ubun2204.myguest.virtualbox.org>
Date: Sat, 28 Jan 2023 22:32:42 +0530
From: Deepak R Varma <drv@...lo.com>
To: Anil Gurumurthy <anil.gurumurthy@...gic.com>,
Sudarsana Kalluru <sudarsana.kalluru@...gic.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Saurabh Singh Sengar <ssengar@...rosoft.com>,
Praveen Kumar <kumarpraveen@...ux.microsoft.com>,
Deepak R Varma <drv@...lo.com>
Subject: [PATCH] scsi: bfa: Use min helpers for comparison and assignment
Simplify code by using min helper macros for logical evaluation
and value assignment. Use the _t variant when the variable types
are not same. The change also facilitates code realignment for improved
readability.
Proposed change is identified using minmax.cocci Coccinelle script.
Signed-off-by: Deepak R Varma <drv@...lo.com>
---
drivers/scsi/bfa/bfa_fcbuild.c | 3 +--
drivers/scsi/bfa/bfa_fcs_rport.c | 5 +----
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/bfa/bfa_fcbuild.c b/drivers/scsi/bfa/bfa_fcbuild.c
index df18d9d2af53..a58a73e596c0 100644
--- a/drivers/scsi/bfa/bfa_fcbuild.c
+++ b/drivers/scsi/bfa/bfa_fcbuild.c
@@ -1092,8 +1092,7 @@ fc_rftid_build_sol(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
memset(rftid, 0, sizeof(struct fcgs_rftid_req_s));
rftid->dap = s_id;
- memcpy((void *)rftid->fc4_type, (void *)fc4_bitmap,
- (bitmap_size < 32 ? bitmap_size : 32));
+ memcpy((void *)rftid->fc4_type, (void *)fc4_bitmap, min_t(u32, bitmap_size, 32));
return sizeof(struct fcgs_rftid_req_s) + sizeof(struct ct_hdr_s);
}
diff --git a/drivers/scsi/bfa/bfa_fcs_rport.c b/drivers/scsi/bfa/bfa_fcs_rport.c
index c21aa37b8adb..d501314be8d8 100644
--- a/drivers/scsi/bfa/bfa_fcs_rport.c
+++ b/drivers/scsi/bfa/bfa_fcs_rport.c
@@ -2539,10 +2539,7 @@ bfa_fcs_rport_update(struct bfa_fcs_rport_s *rport, struct fc_logi_s *plogi)
* - MAX receive frame size
*/
rport->cisc = plogi->csp.cisc;
- if (be16_to_cpu(plogi->class3.rxsz) < be16_to_cpu(plogi->csp.rxsz))
- rport->maxfrsize = be16_to_cpu(plogi->class3.rxsz);
- else
- rport->maxfrsize = be16_to_cpu(plogi->csp.rxsz);
+ rport->maxfrsize = min(be16_to_cpu(plogi->class3.rxsz), be16_to_cpu(plogi->csp.rxsz));
bfa_trc(port->fcs, be16_to_cpu(plogi->csp.bbcred));
bfa_trc(port->fcs, port->fabric->bb_credit);
--
2.34.1
Powered by blists - more mailing lists