From patchwork Tue Feb 7 08:49:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 651651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C2EDC636CC for ; Tue, 7 Feb 2023 08:50:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231262AbjBGIuq (ORCPT ); Tue, 7 Feb 2023 03:50:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230345AbjBGIup (ORCPT ); Tue, 7 Feb 2023 03:50:45 -0500 Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BDD82118; Tue, 7 Feb 2023 00:50:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1675759824; bh=B7+XU58Vdy+7zysi7rf3Yltj56drELfwj3YGbEd4EzQ=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=ByCcUdcB0g86LJV5uQjJbWOUPk8xfhyvcegs2S+Zd6/MNP2InuD3LmfV4SnIfa7jc y2XX9rtYI/Rl1IlzExNVr1a8QdAHQrr/mEfhHliXAFrVMSz2iZg21ystOs4vbOW2n5 DL247+MbGEqVVvEgjxGuprOw/c3dpl81Cs0vfxwU= Received: by b-2.in.mailobj.net [192.168.90.12] with ESMTP via ip-206.mailobj.net [213.182.55.206] Tue, 7 Feb 2023 09:50:24 +0100 (CET) X-EA-Auth: 4FHT8v+T0Ze566ABFYclIUMLeLA86AQNEXPEEoDAVwbtmxvtBYvcm6cfyNLQcFu6cet4LfUTqZZYead07NF/FRrtCMIS4R6p Date: Tue, 7 Feb 2023 14:19:36 +0530 From: Deepak R Varma To: Oliver Neukum , Ali Akcaagac , Jamie Lenehan , "James E.J. Bottomley" , "Martin K. Petersen" , dc395x@twibble.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar , Deepak R Varma Subject: [PATCH] scsi: dc395x: Replace arithmetic addition by bitwise OR Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org When adding two bit-field mask values, an OR operation offers higher performance over an arithmetic operation. Also, while at it, resolve the checkpatch incorrectly split line warning. Issue identified using orplus.cocci semantic patch script. Signed-off-by: Deepak R Varma --- drivers/scsi/dc395x.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c index 670a836a6ba1..e2adf8e84277 100644 --- a/drivers/scsi/dc395x.c +++ b/drivers/scsi/dc395x.c @@ -760,8 +760,7 @@ static void waiting_process_next(struct AdapterCtlBlk *acb) struct ScsiReqBlk *srb; struct list_head *dcb_list_head = &acb->dcb_list; - if (acb->active_dcb - || (acb->acb_flag & (RESET_DETECT + RESET_DONE + RESET_DEV))) + if (acb->active_dcb || (acb->acb_flag & (RESET_DETECT | RESET_DONE | RESET_DEV))) return; if (timer_pending(&acb->waiting_timer)) @@ -844,7 +843,7 @@ static void send_srb(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb) if (dcb->max_command <= list_size(&dcb->srb_going_list) || acb->active_dcb || - (acb->acb_flag & (RESET_DETECT + RESET_DONE + RESET_DEV))) { + (acb->acb_flag & (RESET_DETECT | RESET_DONE | RESET_DEV))) { list_add_tail(&srb->list, &dcb->srb_waiting_list); waiting_process_next(acb); return; @@ -1125,7 +1124,7 @@ static void reset_dev_param(struct AdapterCtlBlk *acb) list_for_each_entry(dcb, &acb->dcb_list, list) { u8 period_index; - dcb->sync_mode &= ~(SYNC_NEGO_DONE + WIDE_NEGO_DONE); + dcb->sync_mode &= ~(SYNC_NEGO_DONE | WIDE_NEGO_DONE); dcb->sync_period = 0; dcb->sync_offset = 0; @@ -1683,7 +1682,7 @@ static void msgout_phase0(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb, u16 *pscsi_status) { dprintkdbg(DBG_0, "msgout_phase0: (0x%p)\n", srb->cmd); - if (srb->state & (SRB_UNEXPECT_RESEL + SRB_ABORT_SENT)) + if (srb->state & (SRB_UNEXPECT_RESEL | SRB_ABORT_SENT)) *pscsi_status = PH_BUS_FREE; /*.. initial phase */ DC395x_write16(acb, TRM_S1040_SCSI_CONTROL, DO_DATALATCH); /* it's important for atn stop */ @@ -2899,7 +2898,7 @@ static void disconnect(struct AdapterCtlBlk *acb) doing_srb_done(acb, DID_ABORT, srb->cmd, 1); waiting_process_next(acb); } else { - if ((srb->state & (SRB_START_ + SRB_MSGOUT)) + if ((srb->state & (SRB_START_ | SRB_MSGOUT)) || !(srb-> state & (SRB_DISCONNECT | SRB_COMPLETED))) { /*