From patchwork Sat Mar 25 07:02:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 13187652 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 43270C6FD1C for ; Sat, 25 Mar 2023 07:03:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231959AbjCYHDI (ORCPT ); Sat, 25 Mar 2023 03:03:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231963AbjCYHDH (ORCPT ); Sat, 25 Mar 2023 03:03:07 -0400 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FB3AE071 for ; Sat, 25 Mar 2023 00:03:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1679727782; x=1711263782; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=p+MxxNmS9DVwNUcLA55VvIMV4ImTHL2q/nFJco681WM=; b=VWl8kGbiDFRxXf0sDaHEstrDPpQY4yf5Qd9vYgL3EfM/mINilMFe1/j+ Ak/rFlUUxNNzFnil+2sRB4OSmVofORyR6w9zUMqnbuxOl4Kj5gkYMeybC u3/qIK57kaL0cruOuT1gZB7k7wCKyqn6SEgazj6TkPk+Sm5FAIqB/zj0Z bEU4fjTQ/CiQcIDnWwcij4zTAM5X07Ol+smlMpCW8UlwTH5BtFWBlvdt+ D6wyINVca2rfzXm7ASsIJZLdTRqESbsw2Oojqy7A4WevpARlKKEXW8czu 5KvMNPU7n3LQ6jA5jdtBKFrvfaYZHXerYyI7uLqVOEwz8NRbygRJqRoJc A==; X-IronPort-AV: E=Sophos;i="5.98,289,1673884800"; d="scan'208";a="224756931" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Mar 2023 15:02:59 +0800 IronPort-SDR: HvLVtuQ2GuoomnmtmE/gEGpf87Q02v548I6E5nRB0lzqIQGmbcqr8y9nrMNb2wHJAIMjwqTQSn lmbn3GZxauMPsuel/j/9HDSgO3jwexDX63Z1i9q6i2agfH8Jmj0e+0DXy8b5nR7+HtWv2sr9BF PN84vMn2DIydwJYMpHPLZx8ZInAvW3rxAkd6K6RzU9R3q2GuHN8WEPl+jeKZLMNFer4psH39u9 A9e8Nyy8GJGblJ0BQVvI79Z34jHJkb8L4n2WWKRp81FS2d7SsZzfu3uxwCAmz0fhi9uk0scVXk NP8= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 24 Mar 2023 23:19:14 -0700 IronPort-SDR: vuG0wFlbc5jJK/xT3HAm1SyFBDC9XttmtDyhl3n0Dfi5W/dS/79JpWWBPwMJNvE8UZFhXzJ967 GwEyHBclQYIaK10fFy2djj3R6tPp6jP5CAUufB93P09FRGo9xaZ9sx2nv/R++K0NmwRIlfctaK v5norezaqbW+3VuS6czkIrNOiyD5GwzQCf0Iiw2Kl5/ZiIW0pvADfYcx/ABz/NfP44Q884rZIo B7HDslsxiZclfxAJHvCxxDD2FWLfBspaRsUQFtTbiOnH7EPybfHZTVG3A9AXN+o4ZGIXVCgOiO c+o= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 25 Mar 2023 00:03:00 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4Pk95H3yQsz1RtVw for ; Sat, 25 Mar 2023 00:02:59 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1679727778; x=1682319779; bh=p+MxxNmS9DVwNUcLA5 5VvIMV4ImTHL2q/nFJco681WM=; b=F7gOef9JVRsRe0kzwgoFYK3QAFQZSpvaV/ 1vkTlkWbmJvzkWvpF1Kh8yjEBbSM1FHeatjONlTLshkweIQ+/Sv8Fknzm18cO70M /9RZyTERvc0IobleB5GFquG9BNJqFM3iEq2HbNYm/4ytliF6CoW2tygVNpUvs7+4 Jwxf7jlNzLfykDMjkCB5MumHRVv7VRE+Xqu03FzutaVrt5xz0KCIO2+P2oRscUy7 SDpw3djl5pNo7Bz0nrckJwrL44CunqYqPBCG35l+vd5rwweL0Afe8WUrRdQvQWxJ Urd1n+Qme/f3HyFmkc94FGBY5itSQkJKIb1jw49ZGHc14kS167zw== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id OFEOvCaWvJVB for ; Sat, 25 Mar 2023 00:02:58 -0700 (PDT) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4Pk95F39cdz1RtVm; Sat, 25 Mar 2023 00:02:57 -0700 (PDT) From: Damien Le Moal To: Bjorn Helgaas , linux-pci@vger.kernel.org Cc: Rick Wertenbroek , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Kishon Vijay Abraham I , Arnd Bergmann , Greg Kroah-Hartman Subject: [PATCH v3 16/16] misc: pci_endpoint_test: Simplify pci_endpoint_test_msi_irq() Date: Sat, 25 Mar 2023 16:02:26 +0900 Message-Id: <20230325070226.511323-17-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230325070226.511323-1-damien.lemoal@opensource.wdc.com> References: <20230325070226.511323-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Simplify the code of pci_endpoint_test_msi_irq() by correctly using booleans: remove the msix comparison to false as that variable is already a boolean, and directly return the result of the comparison of the raised interrupt number. Signed-off-by: Damien Le Moal Reviewed-by: Manivannan Sadhasivam --- drivers/misc/pci_endpoint_test.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index afd2577261f8..ed4d0ef5e5c3 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -313,21 +313,17 @@ static bool pci_endpoint_test_msi_irq(struct pci_endpoint_test *test, struct pci_dev *pdev = test->pdev; pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, - msix == false ? IRQ_TYPE_MSI : - IRQ_TYPE_MSIX); + msix ? IRQ_TYPE_MSIX : IRQ_TYPE_MSI); pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, msi_num); pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND, - msix == false ? COMMAND_RAISE_MSI_IRQ : - COMMAND_RAISE_MSIX_IRQ); + msix ? COMMAND_RAISE_MSIX_IRQ : + COMMAND_RAISE_MSI_IRQ); val = wait_for_completion_timeout(&test->irq_raised, msecs_to_jiffies(1000)); if (!val) return false; - if (pci_irq_vector(pdev, msi_num - 1) == test->last_irq) - return true; - - return false; + return pci_irq_vector(pdev, msi_num - 1) == test->last_irq; } static int pci_endpoint_test_validate_xfer_params(struct device *dev,