@@ -2276,13 +2276,9 @@ static void mpi3mr_dev_rmhs_send_tm(struct mpi3mr_ioc *mrioc, u16 handle,
if (drv_cmd)
goto issue_cmd;
do {
- cmd_idx = find_first_zero_bit(mrioc->devrem_bitmap,
- MPI3MR_NUM_DEVRMCMD);
- if (cmd_idx < MPI3MR_NUM_DEVRMCMD) {
- if (!test_and_set_bit(cmd_idx, mrioc->devrem_bitmap))
- break;
- cmd_idx = MPI3MR_NUM_DEVRMCMD;
- }
+ cmd_idx = find_and_set_bit(mrioc->devrem_bitmap, MPI3MR_NUM_DEVRMCMD);
+ if (cmd_idx < MPI3MR_NUM_DEVRMCMD)
+ break;
} while (retrycount--);
if (cmd_idx >= MPI3MR_NUM_DEVRMCMD) {
@@ -2417,14 +2413,9 @@ static void mpi3mr_send_event_ack(struct mpi3mr_ioc *mrioc, u8 event,
"sending event ack in the top half for event(0x%02x), event_ctx(0x%08x)\n",
event, event_ctx);
do {
- cmd_idx = find_first_zero_bit(mrioc->evtack_cmds_bitmap,
- MPI3MR_NUM_EVTACKCMD);
- if (cmd_idx < MPI3MR_NUM_EVTACKCMD) {
- if (!test_and_set_bit(cmd_idx,
- mrioc->evtack_cmds_bitmap))
- break;
- cmd_idx = MPI3MR_NUM_EVTACKCMD;
- }
+ cmd_idx = find_and_set_bit(mrioc->evtack_cmds_bitmap, MPI3MR_NUM_EVTACKCMD);
+ if (cmd_idx < MPI3MR_NUM_EVTACKCMD)
+ break;
} while (retrycount--);
if (cmd_idx >= MPI3MR_NUM_EVTACKCMD) {
mpi3mr_dev_rmhs_send_tm() and mpi3mr_send_event_ack() opencode find_and_set_bit(). Switch them to using dedicated functions. CC: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Yury Norov <yury.norov@gmail.com> --- drivers/scsi/mpi3mr/mpi3mr_os.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-)