From patchwork Mon Jan 30 00:57:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shanker Donthineni X-Patchwork-Id: 50080 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1947190wrn; Sun, 29 Jan 2023 17:01:06 -0800 (PST) X-Google-Smtp-Source: AK7set/dmFGkn9USrvMx/OaoJrXAUY+J5/hC3sD7zqziFWwStcF08Gw4woqloMBon5w7vVYVWPBS X-Received: by 2002:a05:6a20:12c3:b0:af:dd76:4f0d with SMTP id v3-20020a056a2012c300b000afdd764f0dmr9185789pzg.33.1675040465829; Sun, 29 Jan 2023 17:01:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675040465; cv=pass; d=google.com; s=arc-20160816; b=OtUCNJUUiNZ4DdzMKgCQVxfCeVZtey4IycMCvGIoKRO/NG2vahqrnqJgkzg2J7BJMF dR0ksE93dK172zOeTtIaeyOE5zka+3sgUooveo26le5298hr1jgL6ez4lpNQ5Us1BKuA a24oLJOslz7Gq5RmNut4qczPlYB4gR9yq2o0HFMwT0CgkJ/e0m3Sl8h8dyn4ejjg80po lYNlpqWSfzveBKERgU/Ak73JVGfgZGBXLMaSQG7qgxRefThKX2zpGu48AhxSYTTR9+TK HIQH1eO6+mqsP/B1fsUw/fMbxCGt5fvHFMfgwxhJsUH1LfY5Lylk1MgEu2Mbi2pvNfNB WRCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aul/Qf7cN6yY2oVjkqrNPbt3USVR3a1xYMDesa8HJDM=; b=Rz1SfaBvjy5YuPAtrEWXzE51QhjhO5+jL3pZxDGv9wpKv1DxgMlFO2NCe/GHHYj6mv 22Ucq91tuAUPts/uwChEcb0tDSkFxISsoPJt0byAE2FLoHNKHBM5yYnSC3F0rc3t34uE LAH/bGE7jbTwW22X9COD9dDaFQ4WVnMyCRuD6IgNniF8pOTG3u36gj6uSfVWVNq0RM6U V98kK4zg52sKdD6xDNzJ9fvzG7wnUHqnO5B/PPpClfgYDIsug8ilq7sNs3dryVE+K2Lp wrqaynikmkX1LZDFTzSNGCl6BJQ1IJYaXVGwgNCjFa8Id7QOQhds4tGLcouWv0ev1fku rMDQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=KqJqmywA; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l72-20020a63914b000000b004c62c4e242fsi7118065pge.260.2023.01.29.17.00.53; Sun, 29 Jan 2023 17:01:05 -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=pass header.i=@Nvidia.com header.s=selector2 header.b=KqJqmywA; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235138AbjA3A55 (ORCPT + 99 others); Sun, 29 Jan 2023 19:57:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234996AbjA3A5s (ORCPT ); Sun, 29 Jan 2023 19:57:48 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2066.outbound.protection.outlook.com [40.107.237.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7B841D921 for ; Sun, 29 Jan 2023 16:57:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jBUJLkbl/woOAMEqQVF7QKVm+VvxjqCGzOCDjenWwT7L4IpS2hHOzhcyyecWUsBIWJ6qoMm6/tFB670YOAqyL4ZlNL2kQbbT+PqOCEuStNHMoTkGdW7bomIZkfASAEUo1QFa7sXbxIwb4uKrJSklkmiqf9ysEyViMXD1Q1PoKzpBXLwxNbbarbRcI3Mvd72at18Ieu6olotLV0O8UvOp2Y3QTEduv4+OKQqcA3e6Fxxs815S52eFdvetisgN/xiQqNgIEq4v0h7WXnmYzzJDXymp9zFlHGdME8gdNWB2laP5T5wYYm82+lflTQUyssau1c50hWMho9URjRAMkOpGmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aul/Qf7cN6yY2oVjkqrNPbt3USVR3a1xYMDesa8HJDM=; b=OgnCxD52agt6+5Xl9VUtVTpX7nv2yB9aiwBN5j6K+OOcIsVcc7Ar8EOElGn9Yw/NCeMMiXuDpomzqvbaMJb/F+17gp2EZ2OLjusJJDIi0TAWI4L5zE6uVVFCEH9C2K0XYygPfNrRAM3KGz0AgO6MYlNdxgokMiSClBlz/Tq0nHv+kdHRvPPHSD1hKYoGGDWtnNezD37hLWJpI051xRGGi4jzDx3V1Z8h9aV6tMZxjnn/MgZF59F8qhxRqctVDv7cmrxfesFuxqkhFeDfCpwjMddmSjvprLT6fBuQwri2alpq2NqVvA8L19u2grCv/ffogr49HKuueJJWAihtUJzjtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=linutronix.de smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aul/Qf7cN6yY2oVjkqrNPbt3USVR3a1xYMDesa8HJDM=; b=KqJqmywARmeZVCOzD+RCgdqT6myLHoVIsM86wNcCIH97dv/toVn5nOEWNL4t3+syOf7z7xg1+SgJwN0AzcOBGqtbZs4p8DMarHnLQWlrNf6SdlSorVoF5foHzUFSWdQ6iEwRfSztcllWk8ZaL0z1MfrYY8kwCaX0kAHRG1kr55v9WySYbLZ9bEISHm2brYaWEKDhXNnNYIpYv7BWar+O7ew30BgL2tOC3OodVfBInjILop6mgddEsK/pZxa6/Wyu4Ui6+EiwFpBOwso3Jd6m7B294CeU/nZevfhRw9zwf4yFp4a5SE0/h0dUV2+3Dt6elPyAqrg+SHky5p8jp71K/Q== Received: from MW2PR16CA0037.namprd16.prod.outlook.com (2603:10b6:907:1::14) by BL1PR12MB5320.namprd12.prod.outlook.com (2603:10b6:208:314::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.36; Mon, 30 Jan 2023 00:57:39 +0000 Received: from CO1NAM11FT079.eop-nam11.prod.protection.outlook.com (2603:10b6:907:1:cafe::4a) by MW2PR16CA0037.outlook.office365.com (2603:10b6:907:1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.36 via Frontend Transport; Mon, 30 Jan 2023 00:57:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1NAM11FT079.mail.protection.outlook.com (10.13.175.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22 via Frontend Transport; Mon, 30 Jan 2023 00:57:39 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Sun, 29 Jan 2023 16:57:30 -0800 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Sun, 29 Jan 2023 16:57:30 -0800 Received: from SDONTHINENI-DESKTOP.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.36 via Frontend Transport; Sun, 29 Jan 2023 16:57:29 -0800 From: Shanker Donthineni To: Thomas Gleixner , Marc Zyngier , Michael Walle CC: Sebastian Andrzej Siewior , Hans de Goede , Wolfram Sang , Shanker Donthineni , Subject: [PATCH 4/5] genirq: Use the common function irq_expand_nr_irqs() Date: Sun, 29 Jan 2023 18:57:24 -0600 Message-ID: <20230130005725.3517597-5-sdonthineni@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230130005725.3517597-1-sdonthineni@nvidia.com> References: <20230130005725.3517597-1-sdonthineni@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT079:EE_|BL1PR12MB5320:EE_ X-MS-Office365-Filtering-Correlation-Id: 5de7dc50-5068-417b-4c0c-08db025cfc12 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0PaGkUZoQGUsYUv1Nj0TpS9ej/NnLbCSHwFbcCSijbU23z/KXh7Tuq16KJT39Aty42cJITeJp37JDkCunyEsdBOzypKgXwb1mJGA7VTWFoPH9tZOKnfZFPX6n5vCqghLj4zOx6ILZSk+VDDahmepHLbzcQlfK9JWUH097y7xT9H6ACEUzHgPcsN+Yl9CzH75YfLQKkksLdCujspsqBDKnMTSZRQ0efAQ7t/rPwmI4bbBZKe2X65fCRmEsdmg+4Bx3yk3/XzWe7cSaaE7vC3UT/ZgFaWtC3FOTXFiE5z2Osrchfwe/s8NlahRUDwHRqsebBvba8RMuQvVaRHEgOVsYQ8n/fRNvXeJm2RCIxfmn2P3byVa8pbK6brUX7MTAX7yFQC4STTmXRfwclH63Jl3ciDAmTEhMZ2oUpVwpIyEnivWKrWqe13SqUSv1dT+UyI/9wnvhwCC1nujnJo/ycvQA+wY3v7nR598mgz0n1z1/0eDJxVCk5VJceballtH5FVq6VWPVuGUWwUBUszwrxlTuAfbH+yE6A420urwA+laDG3A/zJ8AwY2f31zJyfQEPWbrQvFD2Koq9jYPWAIb+oPsljylI6taaXlb2VZTq/MUqNFjGZcNfD9o701trkeG2McK1d1N9uYVD9MlJPfEgBgcGH7q9RyuGOfU55pYwl6/e8RlOBYuOvMB053Fz7agxJe+3T39vA3QoEYzN7Iv035tw== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(376002)(346002)(136003)(396003)(39860400002)(451199018)(36840700001)(46966006)(40470700004)(36756003)(40460700003)(2906002)(47076005)(316002)(82310400005)(426003)(336012)(2616005)(8676002)(83380400001)(26005)(478600001)(7696005)(186003)(110136005)(1076003)(54906003)(86362001)(40480700001)(7636003)(356005)(5660300002)(41300700001)(8936002)(6666004)(4326008)(36860700001)(82740400003)(70206006)(70586007);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2023 00:57:39.0642 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5de7dc50-5068-417b-4c0c-08db025cfc12 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT079.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5320 X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no 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?1756407231080729543?= X-GMAIL-MSGID: =?utf-8?q?1756407231080729543?= When the !SPARSEIRQ code path is executed, the function irq_expand_nr_irqs() returns -ENOMEM. However, the SPARSEIRQ version of the function can be safely used in both cases, as nr_irqs = MAX_SPARSE_IRQS = NR_IRQS. Signed-off-by: Shanker Donthineni --- kernel/irq/irqdesc.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index aacfb4826c5e..247a0718d028 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c @@ -144,6 +144,14 @@ static unsigned int irq_find_next_irq(unsigned int offset) return find_next_bit(allocated_irqs, nr_irqs, offset); } +static int irq_expand_nr_irqs(unsigned int nr) +{ + if (nr > MAX_SPARSE_IRQS) + return -ENOMEM; + nr_irqs = nr; + return 0; +} + #ifdef CONFIG_SPARSE_IRQ static void irq_kobj_release(struct kobject *kobj); @@ -528,14 +536,6 @@ static int alloc_descs(unsigned int start, unsigned int cnt, int node, return -ENOMEM; } -static int irq_expand_nr_irqs(unsigned int nr) -{ - if (nr > MAX_SPARSE_IRQS) - return -ENOMEM; - nr_irqs = nr; - return 0; -} - int __init early_irq_init(void) { int i, initcnt, node = first_online_node; @@ -630,11 +630,6 @@ static inline int alloc_descs(unsigned int start, unsigned int cnt, int node, return start; } -static int irq_expand_nr_irqs(unsigned int nr) -{ - return -ENOMEM; -} - void irq_mark_irq(unsigned int irq) { mutex_lock(&sparse_irq_lock);