Skip to content

SCSI: Replace ternary operations with min()/max() macros

Prabhakar Pujeri linux-scsi llvm oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest14 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14scsi: advansys: Simplified memcpy length calculation in adv_build_reqdrivers/scsi/advansys.c+1 -10 replies
2/14scsi: bfa: Used min() in fc_rftid_build_sol for bitmap sizedrivers/scsi/bfa/bfa_fcbuild.c+1 -10 replies
3/14scsi: bfa:Simplified logic in bfa_fcs_rport_update and bfa_sgpg_mfreedrivers/scsi/bfa/bfa_fcs_rport.c drivers/scsi/bfa/bfa_svc.c+3 -80 replies
4/14scsi: cxlflash: Replaced ternary operation in write_same16 with min()drivers/scsi/cxlflash/vlun.c+1 -10 replies
5/14scsi: hpsa: Used min() for sense data size and buffer size in complete_scsi_command and hpsa_vpd_page_supporteddrivers/scsi/hpsa.c+3 -80 replies
6/14scsi: megaraid_sas: Simplified transfer length calculation using max() in mega_m_to_ndrivers/scsi/megaraid.c+1 -20 replies
7/14scsi: megaraid_sas: Replaced ternary operation with max() in megasas_alloc_irq_vectorsdrivers/scsi/megaraid/megaraid_sas_base.c+1 -40 replies
8/14scsi: mpi3mr: Used min() in mpi3mr_map_data_buffer_dma for buffer sizedrivers/scsi/mpi3mr/mpi3mr_app.c+2 -50 replies
9/14scsi: ncr53c8xx: Simplified tag number calculation with max() in ncr_sir_to_redodrivers/scsi/ncr53c8xx.c+1 -10 replies
10/14scsi: qla2xxx: Used max() for queue count in qla25xx_copy_mqdrivers/scsi/qla2xxx/qla_dbg.c+1 -20 replies
11/14scsi: qla2xxx: Simplified outstanding commands calculation in qla2x00_alloc_outstanding_cmds and qla24xx_read_fcp_prio_cfgdrivers/scsi/qla2xxx/qla_init.c drivers/scsi/qla2xxx/qla_sup.c+3 -50 replies
12/14scsi: scsi_debug: Replaced ternary operation with min() in resp_get_lba_statusdrivers/scsi/scsi_debug.c+1 -40 replies
13/14scsi: scsi_transport_spi: Simplified period calculation with max() in spi_dv_retraindrivers/scsi/scsi_transport_spi.c+1 -10 replies
14/14scsi: st: Used max() for buffer size in setup_buffering and Simplified transfer calculations in st_read, append_to_buffer, and from_bufferdrivers/scsi/st.c+4 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/14] [PATCH] SCSI: Replace ternary operations with min()/max() macros

Hi All,

This patch series, generated using Coccinelle, aims to improve code readability and maintainability by replacing ternary operations with the min() and max() macros where applicable in the SCSI subsystem.

I acknowledge that some of these drivers are old and may not require modifications unless addressing critical issues. However, I intend to include these patches for those older drivers alongside any future critical fixes.

The patches have been compiled and tested on an x86_64 system. Physical device testing was conducted for the megaraid_sas and mpi3mr drivers.

Prabhakar Pujeri (14):
scsi: advansys: Simplified memcpy length calculation in adv_build_req
scsi: bfa: Used min() in fc_rftid_build_sol for bitmap size
scsi: bfa:Simplified logic in bfa_fcs_rport_update and bfa_sgpg_mfree
scsi: cxlflash: Replaced ternary operation in write_same16 with min()
scsi: hpsa: Used min() for sense data size and buffer size in
complete_scsi_command and hpsa_vpd_page_supported
scsi: megaraid_sas: Simplified transfer length calculation using max()
in mega_m_to_n
scsi: megaraid_sas: Replaced ternary operation with max() in
megasas_alloc_irq_vectors
scsi: mpi3mr: Used min() in mpi3mr_map_data_buffer_dma for buffer size
scsi: ncr53c8xx: Simplified tag number calculation with max() in
ncr_sir_to_redo
scsi: qla2xxx: Used max() for queue count in qla25xx_copy_mq
scsi: qla2xxx: Simplified outstanding commands calculation in
qla2x00_alloc_outstanding_cmds and qla24xx_read_fcp_prio_cfg
scsi: scsi_debug: Replaced ternary operation with min() in
resp_get_lba_status
scsi: scsi_transport_spi: Simplified period calculation with max() in
spi_dv_retrain
scsi: st: Used max() for buffer size in setup_buffering and Simplified
transfer calculations in st_read, append_to_buffer, and from_buffer

 drivers/scsi/advansys.c                   |  2 +-
 drivers/scsi/bfa/bfa_fcbuild.c            |  2 +-
 drivers/scsi/bfa/bfa_fcs_rport.c          |  6 ++----
 drivers/scsi/bfa/bfa_svc.c                |  5 +----
 drivers/scsi/cxlflash/vlun.c              |  2 +-
 drivers/scsi/hpsa.c                       | 11 +++--------
 drivers/scsi/megaraid.c                   |  3 +--
 drivers/scsi/megaraid/megaraid_sas_base.c |  5 +----
 drivers/scsi/mpi3mr/mpi3mr_app.c          |  7 ++-----
 drivers/scsi/ncr53c8xx.c                  |  2 +-
 drivers/scsi/qla2xxx/qla_dbg.c            |  3 +--
 drivers/scsi/qla2xxx/qla_init.c           |  6 ++----
 drivers/scsi/qla2xxx/qla_sup.c            |  2 +-
 drivers/scsi/scsi_debug.c                 |  5 +----
 drivers/scsi/scsi_transport_spi.c         |  2 +-
 drivers/scsi/st.c                         | 10 ++++------
 16 files changed, 24 insertions(+), 49 deletions(-)

--
2.45.1