From patchwork Sat Jan 28 10:39:11 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: 49841 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1283074wrn; Sat, 28 Jan 2023 02:42:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXv24eOHAcwXUjXZrNf/PNC4AY3Md50gq3qPps5Bdbkcs5UFOo8SiXqew2gXdITslP0RHztA X-Received: by 2002:a17:90a:ba11:b0:229:ab5e:e123 with SMTP id s17-20020a17090aba1100b00229ab5ee123mr42998484pjr.40.1674902553190; Sat, 28 Jan 2023 02:42:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674902553; cv=none; d=google.com; s=arc-20160816; b=btQXB3MQNJELVFHlRPObyuebrop2zQ25iMUggMbU03GrfC+Vi3XZPVjGeL8lKRvnxW V2bUWnPwKnpQ54N7DQzUK3tBI/gvJTj6qsbRBL5WSKWpsMB8xBvf5B51YusaSaXBEQLi cFzDHFgFVdopiBGlU9r8WFY3F2mVn69DQX6PJJjMJXYA32j3XpwyH8H8rpLBxfg5jeof X5ck/KR1Z9DOlhT6kt1bGGldKgbvsiBeeYAUh7xbJqLEAgyTq9lOW+wPPTwSUw2/fDbA hBGR3S9UmteTrlzAZngwmjveubImSYdcknCXgNKfsCliUWLGoDoMEPTkRA4axhyMuf6b x83g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dbTALqihWfVDpbxG9iAs371OZDuVG+s/GnKY1VON8g4=; b=yS+orDNFNovyP1OuxLKGzZ3860XtzuGExkKoRUwJx44u1UvpgFBdlSXA9PxHGyAN9v OFLhC0T5zEKHRAv8XLlnkz1/kts7AqXGYT+e7UHpU9tmCmCp/O4Mg0PstBtm+fS5O5xb 7qsN86k4tylXqFuXJgCM/OxtnC0RriftGSpDEbPaSH0nbzDYgRdaVtA/nA+utWk7CJ5b vWqGcrMn0k0Xzewofa30BnUcpjNlFOIGQtLfpoT2pp34/EmsiPkcTSqx9VluB3n5VVbD O7PHVl7h0ahklrNvl0SS/W6BGoaExbxhFF3REAvP9A0vexnW1wUu8OpB7aYFVhtHnLRt Yfxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=k6QEnyHn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w11-20020a17090a380b00b0022bb7ca5bc0si6973653pjb.151.2023.01.28.02.42.21; Sat, 28 Jan 2023 02:42:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=k6QEnyHn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234122AbjA1Kj2 (ORCPT + 99 others); Sat, 28 Jan 2023 05:39:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233571AbjA1Kj0 (ORCPT ); Sat, 28 Jan 2023 05:39:26 -0500 Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F7E3757A6; Sat, 28 Jan 2023 02:39:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1674902355; bh=i3OVujB4KLVLDGE0Fr7EASyJveRKF8eT3d88+y3e42w=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=k6QEnyHntZuXRepVb90tckWffNAsE19Pnp9R3YxkmC58SuOj/CaifC1L0UBO+Woqw HCuS6EcEAiikiZ7Ztux4YzDcfPBRrsoglnFCys0t/V+TD+IYzrjGbqQyFXrnfi1KkS 8UuOnApWBBKjMqVRAEQPwKiX2E8waTyRLx2UkAnM= Received: by b-5.in.mailobj.net [192.168.90.15] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 28 Jan 2023 11:39:15 +0100 (CET) X-EA-Auth: Fkf8d9ReBXPysJCalcJ1P5bj+NmJgnDSYDgXM1qvVwLxgjBD7WlxvtIXncnpveDpm/aoiai542S/zZt3qW3gUtfrDgSjIbFZ Date: Sat, 28 Jan 2023 16:09:11 +0530 From: Deepak R Varma To: Kashyap Desai , Sumit Saxena , Shivasharan S , "James E.J. Bottomley" , "Martin K. Petersen" , megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar , Deepak R Varma Subject: [PATCH 1/2] scsi: megaraid: Use max helper for comparison and assignment Message-ID: <9db7d3932ac03616f181dabaa53d0b37efb30914.1674900575.git.drv@mailo.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756262619592362935?= X-GMAIL-MSGID: =?utf-8?q?1756262619592362935?= Simplify code using max() helper macro for logical evaluation and value assignment. Proposed change is identified using minmax.cocci semantic patch script. Signed-off-by: Deepak R Varma --- drivers/scsi/megaraid.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index bf491af9f0d6..c9600e395c34 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c @@ -3473,8 +3473,7 @@ mega_m_to_n(void __user *arg, nitioctl_t *uioc) /* * Choose the xferlen bigger of input and output data */ - uioc->xferlen = uioc_mimd.outlen > uioc_mimd.inlen ? - uioc_mimd.outlen : uioc_mimd.inlen; + uioc->xferlen = max(uioc_mimd.outlen, uioc_mimd.inlen); if( uioc_mimd.outlen ) uioc->flags = UIOC_RD; if( uioc_mimd.inlen ) uioc->flags |= UIOC_WR; From patchwork Sat Jan 28 10:39:51 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: 49842 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1283204wrn; Sat, 28 Jan 2023 02:43:12 -0800 (PST) X-Google-Smtp-Source: AK7set9ShcArO7MErGxt7GRQwlOZOa90hDSg/6cgSvYqk6S92Z87wOjmlJ3GfmIcCDiZR3NCY0gi X-Received: by 2002:a17:90b:1e11:b0:22c:5283:3141 with SMTP id pg17-20020a17090b1e1100b0022c52833141mr4775896pjb.28.1674902591831; Sat, 28 Jan 2023 02:43:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674902591; cv=none; d=google.com; s=arc-20160816; b=jtznNmdFGuEGg+lXFmteqKt0MpD314fGkeUltwoHc+h780PNJATbSmCqYA7AyawGLP wLQ78I79BDg1I1jSX2H+E8uKdxJhi6j8SHGfpI1A+l+S5R68Tgf2/p/od1H9hI0WValf OHUp9hXpJvmjaDF1V0aVVzDE7y4RAoQiCkwMwMNuEPfePk4rQskZou8CXy2B89WNY9fL SPZ4bDw96IatPfqO4QCH1R4HvJg4hg/ftB3/dU62b+XAJ8Qgw8RWBInMjC+v9XHrwaie w8KnfsdBOJt8amijTq0fKOY7SRQZxTo2/3XKpMZCjgTZpfS5Fbhp8dWpej9QEsVoK07x XYMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=O7noJ8+/L3xj2XUPPsfb7XAFkA0vM49g2Whm3vZOzsc=; b=G+fEbpH40bd58LtU/aBJ+FMcfUFE3oxiBsjslYNki/dMfPGoLfwWg2phImlIAB6P0/ CiPPavzde/OENA15+i+K1ArBoYEr6ZkWW1W/R802YRVbVreFGExya+YRsSBo1dbiC62M RbfoSubfi8qGh0kxe+Mx86iRiBoqJe42FSDe/wS+4CA7bW//+N39bZo6rE0eovrrz+d2 kNsSGXi777oYT0DRf9pA8Q0ZSHYdMCdbiMo2Isvskyu5auwV/Cmw9l5sMzA5LCdsbyNy +z5uXGhgjgQJSejnNB64F8c6/guapM9SKc5zNTP9Q1lKt+K/0zM93oji8+Jy83QN/5m4 uUEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=XIkh+hL8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e188-20020a6369c5000000b00478a7e7a62fsi6389253pgc.264.2023.01.28.02.42.59; Sat, 28 Jan 2023 02:43:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=XIkh+hL8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234091AbjA1KkV (ORCPT + 99 others); Sat, 28 Jan 2023 05:40:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233641AbjA1KkS (ORCPT ); Sat, 28 Jan 2023 05:40:18 -0500 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF49F7643D; Sat, 28 Jan 2023 02:40:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1674902395; bh=Y+8/fOapSSmWLEqg7lJpPnADv5hXIKr7UJtI9ZjvAFw=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=XIkh+hL8vbalP7MRdL/ZgaZpjd2pQ/iG9Qd+TQ/VsdiMWHQPbmKvPzgf0CgNYQdSt wNBH8aPDPOBddzN1/7mOHvJ50H1TUmt4nj4cFVkgGgSaQBHcFGVm3kMzpVIp7VzJFo 27l2eqCU/RGvmkPrRveaD5hi+s8nUX5gnt5uAX+o= Received: by b-6.in.mailobj.net [192.168.90.16] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 28 Jan 2023 11:39:55 +0100 (CET) X-EA-Auth: 52l/H8g2NG2HneUKl+/V3mX4LOB9amfBJ2uIMcfD2pL8zpPZriS/JRNd3NsdHCPbnQElAYsYvzFR+pHxWdPk8KRkJkpOlbWm Date: Sat, 28 Jan 2023 16:09:51 +0530 From: Deepak R Varma To: Kashyap Desai , Sumit Saxena , Shivasharan S , "James E.J. Bottomley" , "Martin K. Petersen" , megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar , Deepak R Varma Subject: [PATCH 2/2] scsi: megaraid_sas: Use max helper for comparison and assignment Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756262660010861991?= X-GMAIL-MSGID: =?utf-8?q?1756262660010861991?= Simplify code using max() helper macro for logical evaluation and value assignment. Proposed change is identified using minmax.cocci semantic patch script. Signed-off-by: Deepak R Varma --- drivers/scsi/megaraid/megaraid_sas_base.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 7fa472ab0b94..4ca9b04e1962 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5993,10 +5993,7 @@ megasas_alloc_irq_vectors(struct megasas_instance *instance) instance->msix_vectors - instance->iopoll_q_count, i, instance->iopoll_q_count); - if (i > 0) - instance->msix_vectors = i; - else - instance->msix_vectors = 0; + instance->msix_vectors = max(i, 0); if (instance->smp_affinity_enable) megasas_set_high_iops_queue_affinity_and_hint(instance);