From patchwork Mon Jul 3 09:04:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13299745 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8A417EB64DC for ; Mon, 3 Jul 2023 09:05:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=rCWtJN68R1HhPxwC9VrxWnUi7tOuRuwEkcqHIHyRU0E=; b=iLwznKE3GJLCCEXfN525Cq7rir 7rjzJtW7/y7cUMM6fekSTKHqMch6tM6r93RqLGzuT46cepYcatYqN4VUuz6l65HgGVDvcMvloe5or 2wcZNiXBuKAbQj80KuKVYZckookLVUJ7rM5zvYUMCdsvvyVYHLRXuabixQaHlmKAAHub0veoeM3dk 8VUavujBYzw1Eb281WOoCHp1saJvQlAkFFEf51+XP1/Ac1ZNhDCOX9NicDQZNJgiakzEedVk42NrT 4Lm0hdlZEYxfg4JzAcWoqccZiFaa7BvrNRbsJ2HJu1on11ysrIt4bfslQLJvXRhzHyrRwvfycMkx7 h7qba9wg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGFUp-009qgs-2S; Mon, 03 Jul 2023 09:05:23 +0000 Received: from mail-tyzapc01on2071a.outbound.protection.outlook.com ([2a01:111:f403:704b::71a] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGFUm-009qcn-19; Mon, 03 Jul 2023 09:05:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lFviwpD1R9r8tmK3jzOaCtybz3k5c0RxQAD8uzVItjzJi2MOSeVMf0TLqVqaQ4jvTAASvK0ME2THm+TuGTcZ2nrSrUNVbGpxj+at7ogdM6eojCAHjAM5V2DDmBX5reoM1BKDruJTgJQehNKmkYkV7xYgXi2NURSTyx81pRf5MeDtuzH7bUdgjudWFUs5ZwgftzZqB/f85Z+HRhURUJPOydPsMZO70LZKwCV7J+Nkojs7IXopkCuK2TG6BTirjJj/JJZXQXBv2a28Qj16maF8iYjiLyBlMd3PCbY4OVI9OuFP0Xh2lkWw8miEG2oIeqKnTAXjhpef2Z8UzgHUB5lXAA== 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=rCWtJN68R1HhPxwC9VrxWnUi7tOuRuwEkcqHIHyRU0E=; b=f3VHbGGPhYCGpk0q2h6FN+cj/saJf2RHAU81KlQvfizeuQhvGxBxwBCpzpTs5SUohbp0oWYTHEPa5p0Aqcgm+pGLNjiJ4YRy23CYOiyePFbt6b80OlruLDbb+dis+2o2gpX8euuJcbmrZoq2wvxMBwwzPwN5qWI1IO6fMQgkikegAx4O/wR4KTGrYranEDRLLbXGhwHc4x+f6WwDiBJkTphqG7urCi5Xlt0dxUdeyCoq2vO1kQlH+A6PTn6GcPVozfuHSJ7EwKmd5E94kAGFh+fObgAXeNwbTbSPUHQidIWEZgR3/eVTlRiYiiLR5FjuyHnwdBTN/U5qOzo8HcrCSg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rCWtJN68R1HhPxwC9VrxWnUi7tOuRuwEkcqHIHyRU0E=; b=O//zC9iUN8xr8DUIGihgO4f+CcDYmkeBSwR045DfE5baEoo8runAl0Z6Uip7bYuAIfZ2XKgwhG3ZMWYHZf/+6X1CsplYR6RVa9s3uAgDmzMNaA2kb8zalQO1FoZJ9D5X6kpweIlRHKoy+qd4pmCK9wDFrSqa0vVANOs6sBR4loa2xnAnJUE5mIAheDR62HWDNfPAeUixuHF4hAOH/EKwfyq5gUKQHU+PHU/eErvnqWJFJTJLs9AlgIVwlr+ojEcKez/GmRLVpnQfVpN24KtDEJlKELKbgSs4k5g4Q2DXjDB0cv7r2V06Rp4m1yhBFriiPrS2AaNLDFB3lf77eQpxBA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by PUZPR06MB5850.apcprd06.prod.outlook.com (2603:1096:301:fa::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.24; Mon, 3 Jul 2023 09:05:09 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c%5]) with mapi id 15.20.6544.024; Mon, 3 Jul 2023 09:05:08 +0000 From: Yangtao Li To: miquel.raynal@bootlin.com, rafael@kernel.org, daniel.lezcano@linaro.org, amitk@kernel.org, rui.zhang@intel.com, mmayer@broadcom.com, bcm-kernel-feedback-list@broadcom.com, florian.fainelli@broadcom.com, tglx@linutronix.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, bchihi@baylibre.com, frank.li@vivo.com, wenst@chromium.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 0/5] introduce devm_request_threaded_irq_emsg() Date: Mon, 3 Jul 2023 17:04:49 +0800 Message-Id: <20230703090455.62101-1-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 X-ClientProxiedBy: SI1PR02CA0012.apcprd02.prod.outlook.com (2603:1096:4:1f7::8) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|PUZPR06MB5850:EE_ X-MS-Office365-Filtering-Correlation-Id: 97bac4c2-d106-497e-c1b6-08db7ba49958 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d+73wsR7/mieaY6O/VCZGbO+UgOjzfa8GCXMZSW/oTBy5KOH5Fjso5Ts0owjR3gSHkGagtIe5JKTlFO7GUS1aM9vSch6vb1EGZ/alkCHkN7rIgieVgQjSpexYSroLrl83suEvS2CFtXAvvw0xLM7j1lc8gTwe5HrRRY6mRPJKG1cPI8vVr5oQbOR5cW9yCG0qlPIGpSx5PAQ1p0ZzuvCa1bEBtApU54DxN4tUcKQtx2q5d6WfdgJdUPCAfy+46E0gZ1taE2IYkeV0nP6H7VzGZUftP5XuxsU+Y9d69QENJyEWnQmn/Us74GrzQv9asRSN/KwkkSccWP+ufr8L+gKZTcWGhlBnr5jHC2Xk/x5VC8ydAO2PcbIu+ay7MzMWvwE2oZrZ4YdIPuw8tOy3PESbkp7curY8KdCjW+pSrzgsAlAXqWFHdGkIWAx+JXWWedcuCw9oOxdt1d1RTYg2XBlk1nzCBjJATvZLAbiYkylG+BYe9m8ls3qw4zXRsMNwTyH38yEb8ZAiLVtFasxP84zEGt5A+ooKoQzzu/tL021Fctwn/iRphkixn7pe3NizxRkxpueF5G0H9qdAj0oZKJyefdkAIkKjAAvpq4bUGjQXzEPncLctPJAF3O5iefTf3b7nnaWQgJ9eOtezih+YAEDeQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(396003)(366004)(136003)(39860400002)(346002)(451199021)(2906002)(41300700001)(5660300002)(8676002)(8936002)(7416002)(36756003)(86362001)(186003)(2616005)(478600001)(26005)(6512007)(6506007)(1076003)(6666004)(6486002)(52116002)(316002)(4326008)(66476007)(66556008)(66946007)(38100700002)(38350700002)(921005)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7a4c10RXRhguPlr/LWFsPfEpUckr3zHzfd+R0rAKPouIgMubTHpoK1Dvtwd6QKM9Yj7nSmQlEQsSoXkwu/DF26MrVgqhkjFDx9EGeO0RFQeOmdDDPt/azGRPVmPEcWJJuF7Sqp484f1afnwUz6z5LLOERMGKa9XL2V2AhZP2Ywwb0r71Z7acMmhQM689mhXtYy7swESnk8JhILOaxuZF2GCfBjaR5Rq+MRRcyK2rJoBsTDS787sJ/+oZdrWLsPi+5IzfO0XzS5NHepSZ10xYkYCvgzJ7yB6Ld1HNuo3vqjUF+wv/PPhi2NTSLOMgF3g59HdzbM+bbUEi/quvQhmt4yGgzmSKBU2KYGDRukIGSe6LP/82WEBADjOTvRiURKc2ND3it0vG3Ef9aXLwgfuMoVQhU9u71WIsyqZU23N+a9r7M4R5JcWaKekgc1/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3f8vJSELwfgp+IaQivgN56+YfDCuJ6vC36xnvGsPOKIOQjZv+9YtKdUASuPAMUhHyyVhEZxawoJJEMzufH1V3mYA3Z X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97bac4c2-d106-497e-c1b6-08db7ba49958 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2023 09:05:08.3551 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZgxHWykNdfWeZxIEOBIk05He+uojXL/uQtLkwt4iPTVf6MDEEbRMe5PIEaf/w9/7Kk48nXeBDjkkrUXjhS6uqg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB5850 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230703_020520_739199_074FBEB8 X-CRM114-Status: GOOD ( 11.60 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org There are more than 700 calls to the devm_request_threaded_irq method. Most drivers only request one interrupt resource, and these error messages are basically the same. If error messages are printed everywhere, more than 1000 lines of code can be saved by removing the msg in the driver. And tglx point out that: If we actually look at the call sites of devm_request_threaded_irq() then the vast majority of them print more or less lousy error messages. A quick grep/sed/awk/sort/uniq revealed 519 messages total (there are probably more) 352 unique messages 323 unique messages after lower casing Those 323 are mostly just variants of the same patterns with slight modifications in formatting and information provided. 186 of these messages do not deliver any useful information, e.g. "no irq", " The most useful one of all is: "could request wakeup irq: %d" So there is certainly an argument to be made that this particular function should print a well formatted and informative error message. It's not a general allocator like kmalloc(). It's specialized and in the vast majority of cases failing to request the interrupt causes the device probe to fail. So having proper and consistent information why the device cannot be used _is_ useful. So add devm_request_threaded_irq_emsg(), which ensure that all error handling branches print error information. In this way, when this function fails, the upper-layer functions can directly return an error code without missing debugging information. Otherwise, the error message will be printed redundantly or missing. Yangtao Li (5): genirq/devres: Add devm_request_threaded_irq_emsg() thermal/drivers/armada: convert to use devm_request_threaded_irq_emsg() thermal/drivers/brcmstb_thermal: convert to use devm_request_threaded_irq_emsg() thermal/drivers/db8500: convert to use devm_request_threaded_irq_emsg() thermal/drivers/mediatek/lvts_thermal: convert to use devm_request_threaded_irq_emsg() drivers/thermal/armada_thermal.c | 13 +++---- drivers/thermal/broadcom/brcmstb_thermal.c | 12 +++---- drivers/thermal/db8500_thermal.c | 16 ++++----- drivers/thermal/mediatek/lvts_thermal.c | 6 ++-- include/linux/interrupt.h | 6 ++++ kernel/irq/devres.c | 42 ++++++++++++++++++++++ 6 files changed, 67 insertions(+), 28 deletions(-)