From patchwork Fri Jul 21 09:46:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 705178 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 3FA97EB64DC for ; Fri, 21 Jul 2023 09:47:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231463AbjGUJrH (ORCPT ); Fri, 21 Jul 2023 05:47:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231293AbjGUJrG (ORCPT ); Fri, 21 Jul 2023 05:47:06 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2095.outbound.protection.outlook.com [40.107.215.95]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A270121; Fri, 21 Jul 2023 02:47:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AUkcqD3NiZTKjp1xtzU16fhIaEr4bUOtV4T8Rh7TrRlfGgWfJBffyslg0xE9HicWdo0UZ3Dfj6w+r2yAt5C6Z0F4M31MWQIGuUOhsBFFS+lQA4ggdhufES7cb2MZ2LSYaBDHrA5Sqfp14PNCp50OVsi8IqPvjpcX/dDtvMr+vlQONxkL0VtpAtRDhmhKzF7noKG+WxqsrpivJUccg6ztFGg5LKhBvfKo5HmPk+12q0m/KmIkXkynFOBFHM3eQT7C16t5W75TzW/0E/14JDZ3ku6YTs4DwGmxi4cwykJXlWo0YAEPKMHWV/IIUuAqHNDLVNdDhXmOMMhFR9bbM8pmAg== 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=4cslGBST80PBLFMrkaY/Jc9M1A0EqquN1GEpZNPex7Y=; b=iJFot14QsAyv72wxSMx6hYjatkE58tdkJPlaRH65ekLppH71SS+gi25HMtuCETzps3Z1UHq9BdNogrNfcCWkR/BcHDmen6+KE5l/3Sg3Dj7KPbrErtIIN25SfcOLyoQswKkswO7timKaGcm5r76G8RroERVL56nuXeUiF1O4+RwWzkKytLxZLbKRKuYP3of6bekQHdnRzK+Um5vrnQGBQniNIAvRo3XwWRCS2FZJ4/kZUYnbgP1HtfA9UCpZusDxN6uQkiCiB65BsClfFVPvIc1nQ3DptQi17gEdx7LacKNKFPKujLhdkSltHHrtc3R37Sy114IB6LDAkI7un3t4Lw== 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=4cslGBST80PBLFMrkaY/Jc9M1A0EqquN1GEpZNPex7Y=; b=KiuBelRL1XtxPBzvfMW2WALHrf5ChiaYMUGjzSc9PPGb/qwmHPomqFuXIidtuiPae0pEP5pgk2y2+A58syo3Phg/92rSsijld5Aq1ylj00PfAdSRsNP+rtov1Gluqj2knJeHKWmSxF2jwI7AdvTHibM3GzmzrIJa2M25qbQgsiO49CpOWA3e8ukujZchYPq4pLN1zZEMDJYlKQf6gyCCE+ej5+kukKIz+2QC02bAKBV6qP1jB9lyweAdnsaf6CJhh/RUy8G1slq2KsuCPnVhezBKMbwddgax7wLkAX1AJucHUFXLSwMZyEkCaRlg2DeGSSz0bsMASVPs0rQcPS984g== 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 KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:46:59 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:46:59 +0000 From: Yangtao Li To: Vasily Khoruzhick , Yangtao Li , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v5 02/22] thermal/drivers/sun8i: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:21 +0800 Message-Id: <20230721094641.77189-2-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 96f6255f-4cc6-441d-81da-08db89cf6d4b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YkJVPqDdoPCaO/MbhkSoJ0LTDGeToK5sNowFuzka6xhjQZrlYcrQe8Qlsmy2ae4bygQe0LquxRngQoPxEh/yg2Rg/4n3rz805GVks1VA8gCKjSMMbSpm9FdJu02BzBYFLaZGXlq20h0Pw4/QK5nH5aErt9tuzVaG0Q1FwLiFABHn+n0gT6+urvMy7OQE2DxqN1NL9yFKTFOrAemI8h03eFq/QzVe/uY2c7jwIfpqJpoVLMv7Yq3clyz8jlqIGYFzEYAE2piZyoML0EU47mEsOArdmc8aLlD5Zw3e0+ZVQVL+o+joAi6+xuRWTTiv4+Q9pHSnvmoB5NMbvkFJY57mArOqFhAXpuTPF5KrzIWM8PqMe/Ag1DnDqiCnIUd12Jg/qWfyBPKCQU1PBP1MjPreTzeQ7Q61I597R4B3slPPDZzYXiZigT/kU5tTd4Y4hIhmna+DEd+mbU5nPklrcXSEwGW5I7m+MQSPHtftEZD6BV02vCVVwubqjl45ToZZp1KdViy77FFUy1U8ib4QZSznmgDa6iBmoSCkizGPh8DHK6plAY5LUnX5twfRT00V8YU95CvUzMKz7rBSD1518yqkWpXANK6ajJjBOgYX8x/yXn8lDIaGozjn5QdhyRRfngNe 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)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(6666004)(7416002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-Chunk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utf-8?q?SfJ6++voDhnkbTyz1mNL/qRyN0Ty0AyrosELx2NmTJKJeUxb6fPJrAgbg5RM8cIsP?= =?utf-8?q?NMfZw3Sw/1mHDo3WYzHIoYdb3kpnT0ArhLcTaLTGM/FLOtCcJ94bSul+84diOR9SP?= =?utf-8?q?XfWm9/r2/ypI/6hMuFKLIIguxcU1WUZ91O0a/sT1rPclqUsvON1Sn+U45o9YHj/lZ?= =?utf-8?q?qIdSPeRgiDglS8O/hR2lzUHTN6ePi/zZ/inIIrkLgS8ewtWjVPCY8OueG7zrp8n5C?= =?utf-8?q?6GnQYRAzzFas/0JkWMYzHlOdjg0YgxctyU7bVGTS1ZNgMDUFnEZxy/1E01VkJRBgu?= =?utf-8?q?apvrhJjouActPBd3+JWJh9H/xSspNL3ZMiMQ1ydEuDI/sQ/W8EhIpOwhyzw9ZsD8B?= =?utf-8?q?79U/Z3vBy2Pyb2vnSVg99l0HeRbDWtcx+VzD49SBb56YdA7gtAUd0f/LgXWY+JXaS?= =?utf-8?q?/7U9oo0TT3Ag+dxKhu0z5IVX+/v5RvO9yIMAlbD5umbzUGRhh7UyTHwLxnFjHJxmm?= =?utf-8?q?wX0b9d0Iqrqu0LD4ysc898h5bSQhyz1qL/CaCTUrN5N+OEgkC2rxDo0xz9ByDt50z?= =?utf-8?q?/s5ZAUgu91mL767/dhHU+ty9AkRicmdTSZiOyMsSOSn2wrVhJccLp9/pqjSNM5xnE?= =?utf-8?q?gUZVuBWeoCEGy+yFyiCzXP6LVkhaIsIE9tnCOAmCjoJYD3sad+wQeC9xEDOGM+rK7?= =?utf-8?q?yS4xR7jzVFGs?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96f6255f-4cc6-441d-81da-08db89cf6d4b X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:46:59.0249 (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: 0pW2SSACajjScwYqnzDxFJFRqKjDgQGYKolViSop/ST3DOWC4v/rKKUARSTAiTCuB7XAzsu8q9fqHJj9nPYj0g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li Acked-by: Jernej Skrabec --- drivers/thermal/sun8i_thermal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index 195f3c5d0b38..a952804ff993 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -512,9 +512,9 @@ static int sun8i_ths_probe(struct platform_device *pdev) * registered yet, we deffer the registration of the interrupt to * the end. */ - ret = devm_request_threaded_irq(dev, irq, NULL, - sun8i_irq_thread, - IRQF_ONESHOT, "ths", tmdev); + ret = devm_request_threaded_irq_probe(dev, irq, NULL, + sun8i_irq_thread, + IRQF_ONESHOT, "ths", tmdev, NULL); if (ret) return ret; From patchwork Fri Jul 21 09:46:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 706018 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 BF36BEB64DD for ; Fri, 21 Jul 2023 09:47:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231579AbjGUJrK (ORCPT ); Fri, 21 Jul 2023 05:47:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231522AbjGUJrJ (ORCPT ); Fri, 21 Jul 2023 05:47:09 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2095.outbound.protection.outlook.com [40.107.215.95]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAB23F0; Fri, 21 Jul 2023 02:47:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LRyhLoP5jNioHSxfmlweb6URpGHiq/t+DY9AVGWuOwU7vGvbYJhWydRsye586HES23fmo70HuowBoWGAdmgkcapBMn473EMJPv0oDH17fJKC07mGa+mg1ppTvXJrBv930cfrAXoMycDy3juUsLJ3x4ogVmObeZy9LY5J9sAcmREdSRvBP/6ZYMVLmiuB0i1b+X0/qvrnpK+YsECvLMtQ3MWovTl9a/Bw2J3lzb8WvyC8mYvlNB1Q4DZgeRokwjYfFQbfs88jbDa4lpmsGS0yfPhp/5S1dDpGTQt+5e8RPJxjxTfWYUoo0Obe+u9yHyiCyjvLZLt0sZTGdj+6RLNL9w== 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=f85Sj1Pf7S/hIg2p7O0a1eybgIjJgZrXjkRNBEWx7tE=; b=RIN2OBBZYp5JhS/28AhrmnuZRbGa4SDTVNoisBmZYMKbpNFoJN0rZayKB3cVLveFRG3PGyOFAU5GIH9AqogE0BuZ0B3+ZBsWI2SmyLSztYXUtbanI3XAR2xchvROxoqCXK8cAtCb2TazfI54c0g5lhn4LOBxP763YvsJpfSb+qxYlJuoco4gbjju2vOfYpxpXB/eMBgG5/9zzJxvNFgMDhq2YEZxJGYQa01ahVIl/f8/q33I5AaawQChjjshvadHxXT0nE4Mqbq0bf4/LoPlQMQ0uUZ3X/qvcmcJTKs82U7QwfbUJ3jHuzeCG3LVhRu0MKxZXfkVPYMFPprEfoLzGg== 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=f85Sj1Pf7S/hIg2p7O0a1eybgIjJgZrXjkRNBEWx7tE=; b=XFMFuqY8WkT9rBj0JJJaUFperO2e/CowUJVLfnor+j8GpNQrOMMFPLawcE1DVYNloXT3t5/L0/8Fc9HNCfz5R2acrE8ccAFOq2mNmt9UGiaT8ZGDL4RuFKiZrM0HM/8dTF3VhdxcbW8F6uJl5nZp/0VSP1MUTA3/giJsUW53a5oVTWFZk+t+glW9Sb/Jl3jVHHTFErvp6UWTQHe+CxajjKSREYwROYvmzeT1CBUNEo6QH73Y6qpZlzEqo8enD4CnmRxfZQBeSVQMhtn1K/VJzcsXjgiT/mc4RdwAF9c8D4EDvvnuKOMnB6n6SHbb6EOmEM+gVzs5DDg+CqzcxA6iXg== 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 KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:01 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:01 +0000 From: Yangtao Li To: Miquel Raynal , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 03/22] thermal/drivers/armada: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:22 +0800 Message-Id: <20230721094641.77189-3-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 4def374d-d1b1-4a65-af29-08db89cf6eae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XJYYi3XonCH/O/pl/L40rEq4q21J+BJuETu3exDBCatkv9DqPm03JOHwfQrPtq/7oPFMPjTIGk5t+S5UHiT3GSGIMotcUnPwQfXofrHv9epVloi3z9+CcPjmQMOWq9Adxq3ZjoX6mwmyBFQMOiGfrN7CFrYsE252/z52LkJS/cMybbMIl7iIDGWFJtAk8Rj8q3HQ5ENLW31rSXKs8U1X7cJgkrqsG7keLuqRkh3h3ofpQ/7L1IB87PuELs8kct+g2gZpXyXWgFGqmc6p0l+8begsWfJXwN405/F8G2EfVELlrfR5Xi8Dl8qpPTgkwMO0zyO1rNb62cUw2A+zdfMjxN/WmrX1lkcJK9T1oq6Nwj7995lZCiEXvaWjePqcLaaBxw4EJ4ijIbQ9StngrbGHC3GcHMHTh5uyGe+xDVdlInOoQDzLUqp28VvZRok/r46S7GhuZAjQto00R45vDPJRXeAegHZZCGsP/XsxEFXATOyY6ofp1eWSrhzkgydAadBJv/tzTziSa/njEBvCT7XE2MB55noJ6so8kiRg3g6munpI1tF7E1buM7UzRDvnzmp/FMSpeJlvBj/pj/L1wcRAtZakYVqf+04kmKzW8AkeU9rFc6mCRoTwXg32EPlPSyaj 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)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(6666004)(7416002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?TNyTuHz/3WHQBddZxngSoyACN826?= =?utf-8?q?V5nNqcWtT/aBDRcac07fvTB3aVdAqcjSPuUIgU82kR6PV2iMgNE2l62O6bxMvo/R4?= =?utf-8?q?4Q2iUc13VlhdlwRoAnBPNDTGuhGGllRUc744jCGVBFhx/EOvxaUZ65NwNJvXPnXeA?= =?utf-8?q?XTW4B4gBZ/Jg9uinjFc9U0nAPAdfRMvGP4qfoDbrOBaNBXh2/DSrIXrUUxZlwYqTf?= =?utf-8?q?uWrYlq06gkwpZoNaeV0uMHeSHVkwpiJ8RtX882RXP8R3in6MulKXqFlLYVfgjA9lr?= =?utf-8?q?8hTrCmoHt9w/S84tBkabxYna9M9oIc4nYFyOs8vtSF2m7I4dmctaJ/p6DOMOoJLQy?= =?utf-8?q?iF61qU+PPyZdtQ0hFwnxWkR8fyMkoWu9dJBB0O02b9saC3Vxz1iA+IoPJu1svins5?= =?utf-8?q?IeeEQ+rZdljoIQk1QoVZL9O8m+TKMbpaAiln7viEySoxWV44OghnnDen+KoUdjnH2?= =?utf-8?q?OEnqVd87cCkgtUthVbBDCo9mfAdv1vFdJMRe3aJN8lGhEEtrqgm7X8JhcZ8AhEKnX?= =?utf-8?q?vkoZpuvX9SPIl4HT1CFDif3wGpbYAeDtEj7Xs2h+G28sPe59QeH2yvJj9OMUeeFIO?= =?utf-8?q?GDJqO7aVg68xfO9QEjUGVjxtxYxEbtsujAC4moNhbVy5Xtyzhgbwc+sz3+zHYUY0F?= =?utf-8?q?tHhU7bR/676UdmxIWhUZTbTg/5RuYOvRdPHrEZOj2NHzYDjJBs7l3I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 4def374d-d1b1-4a65-af29-08db89cf6eae X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:01.2807 (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: /gmYkR8dc9XF+qesatesHwZSGh2apvo7BaSLgRH+a0142eBL24znHvbuOSvRPGllviWQSR5vnZs2BBlXF7VYUg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li Acked-by: Miquel Raynal --- drivers/thermal/armada_thermal.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index 9f6dc4fc9112..b7f549b6f825 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -913,15 +913,12 @@ static int armada_thermal_probe(struct platform_device *pdev) /* The overheat interrupt feature is not mandatory */ if (irq > 0) { - ret = devm_request_threaded_irq(&pdev->dev, irq, - armada_overheat_isr, - armada_overheat_isr_thread, - 0, NULL, priv); - if (ret) { - dev_err(&pdev->dev, "Cannot request threaded IRQ %d\n", - irq); + ret = devm_request_threaded_irq_probe(&pdev->dev, irq, + armada_overheat_isr, + armada_overheat_isr_thread, + 0, NULL, priv, NULL); + if (ret) return ret; - } } /* From patchwork Fri Jul 21 09:46:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 705177 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 75197C001DE for ; Fri, 21 Jul 2023 09:47:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230237AbjGUJrM (ORCPT ); Fri, 21 Jul 2023 05:47:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231555AbjGUJrK (ORCPT ); Fri, 21 Jul 2023 05:47:10 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2095.outbound.protection.outlook.com [40.107.215.95]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 871D4270F; Fri, 21 Jul 2023 02:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kDXd/CPMirmrO+1y5VAH2c7LX0EU8LQnpp8FpQH3y9WwiHimci7yC0RbSqvnTuGIiFEhQSBvZLUQJSIVCgsXnfAScACyWDuRD4+pO+dteVkbFARD+BM+MMk9a6MuUj9t57K45qO7ec0kqhk5s4LO6DEpdQGqj6AJlsGYuz0B16Za4aKKz8HLMyfHjTR5XC1/T3LsnAdxDQxQ4grpfkmP5zh4SS7L/ZbOkM70LfFU6zhbuRaoo220LX+b6oriZ32aTODsrDMK3ijb5EYbBejQSMt/vPQyAbGA2J5JeFxB+cFe8+oZA8V9jEmB8UWaLmF6vn+jRC8/XdeO3ANQmIlRsA== 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=OjfxK/rG41MW8xIM0n4h07DdTRX37piixiXYncIAkj4=; b=Ne6nVZOisOBoZ1H7/Yag2haTWq5quNDobNRcL1NAGihZCdvsT10TcGvviGGYkQeHLJvJCBroDRWlWBdMNob6OT81vC0rscl7txGcIn4PaqyHCvkhtmHio4fv2jGpt5tDQqmr0bW/N/Oj1YN5LinOHsC5gO49OSICu3SJMD5hxyaXGdFEhuw01Wn9Z/2BFY3RfbcR+l2B61xZzChpCDPR2yg5EHK3N+qxqA38TBzK2xDsCWoQ3bujH4IZTijBfrWprjaS1dCMNM2+FlCOTgiCSRhzrbtfUNhRLR77Tmu05kllfFq4iPUAywoR3QXZ5f/pU+2moUqr7Lx9/0/0mbyezQ== 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=OjfxK/rG41MW8xIM0n4h07DdTRX37piixiXYncIAkj4=; b=e+8GAP9DxQENM00UXpAQWRd2hHCR5SqBmD+Iwc9E1ooecbqOKto43uVdUfAUsaVWzGJ+NuAl/1sJowUoWF0UrRifOckhp0yQr/1YR4LGVs+15fDGzvcG348evNFz8n12PS5J6Bhn9waG3EYBRrC8OqsQGzKb5WTLouWTt601J1smK3IMxM+o9i9d9U8m7yb5AgPnSzVn86JT9Fe9KeotI3Uv/RIRXMOB5KUn6GEylabPUiXoMX2wRZF31X1LEKuj/xPzyn2EYT/vPTcAyiWZn0JUjEfpNHvlpDZ/jWei+Fo3ux6fTO2YUivw6fb+5GHnPj8hL/foTcY7g1c88Tfdrw== 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 KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:04 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:04 +0000 From: Yangtao Li To: Markus Mayer , Broadcom internal kernel review list , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Florian Fainelli Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 04/22] thermal/drivers/broadcom: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:23 +0800 Message-Id: <20230721094641.77189-4-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 251298ff-5de7-4960-2ff5-08db89cf70af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: csWfH3CDlS4Q/rOIrUoJlYR/FVBebOJJXmnfcteUKGJDSOXklyrRmk46RVkT95zga50fuLc/4+v7k5L2/FVvTQQjnnO+jXFO/8CgjnbqNwmTzXOrzCDyDWk6J5GXtupBPbW0e9kqH7UHBBQ/TDVmaKM3htdIiZ9GTd6FTG78OjQXXJ2j/k8JHAWz/xpc2TsMefVwrXcRiSNwrgsPqJq53ATcgCqR1xmbHGeJ1g+nGCzLCIfRQC2YX4gwSeGljdvagMe+KIHXAGES4XUoLQyj0N9WhdY5eGUhUDx+28gTuU49pODQihOuLdbMDPlWRLVwnas2WSuFw5Pc/Ar4ZDiQGsrs6kAsbF+sSEKj4M8Xl12FUKLDqcD3tc+lHCSJfB54SFRww8P7XWHRpVUr/AkOEMPbKhiPkqiI7wF9PKL6keFaOZzo68IJN+7L9bgOn6Kz7jQZ62wt2vFI+Wy8uSWPKaD/oi9NdXyp8sr5vZdj9VtkdWe2ihvsY0YNAtuGPinlj+qY87BRxVtmNbufUJw7qD+4ViLGRuq/rsnJ0Lf96Ty6JnIP/MQBe5KQk9Pid4sfZ+XABTHEB6iArmlcWaI9Tanf1nfBbVMAucn/NWIPYIUbeONe+wMPEZCE5UVk3cLR 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)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(6666004)(7416002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?pcJz+DlOsLYTMO72BSk1oiS1D3YY?= =?utf-8?q?Z61GcCQs2Rd63SS749EOiia/vlYnBbAj/2mB+GVksLEhhmYYo+JHRlZPenSpWNQ+o?= =?utf-8?q?ey/PHiYrGrCE5T8ci7kzcuS/eToWpwVl0u3+UC9kz89s9gE/ROPZtxBULWiCfUKIG?= =?utf-8?q?CHr4V8SqXiGafzosm/ZefQtZ81KfkBfDFJ6UvG9WrrGFbvPQ/wfqzUqnskhI9jm7f?= =?utf-8?q?4/sR3D9JfLa/WeAiYe4PINsIBmmvKSEONkmOjGmalZ/65B5NF2POw6j1rk3sZBP4f?= =?utf-8?q?09KWNIIKuoDGPw+a6chhcoeo6eO0kQrCmx/lO0ah4aBXUwX/i1SI9jbtbdlOUtgKY?= =?utf-8?q?Cny6YYNrsBMCl0/+c+3eZ2Nkq3HCGUkAw+BxkZmS6q5Z/9ZDvL1ql45b3jaXRbbYV?= =?utf-8?q?wnSEl4R/svvConOMispxuvzvXCzEmBSq0FZEP8PTJspiDJ0QZSrgyrpycET56KzBq?= =?utf-8?q?SyUTY3CBx8E7YzzJv6YRA2V37G+exhVc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CdOPeId3+p1LGNLCAx/GMQyIDwktRr00?= =?utf-8?q?HkT9E/kE8hoTRwGNTsDrTGtG1HeUWiuC6oHkmN0Bpp/+3mRIzU01ROZ9RduehVUIc?= =?utf-8?q?3CD6pkLCkNLUVwFA5FMPyHwjos9t5sBRGfX3hp+9NRM4YhLBYdncHo8+CrujAL8fu?= =?utf-8?q?1EOa/9P5d/Bl?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 251298ff-5de7-4960-2ff5-08db89cf70af X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:04.6538 (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: TaILFn6eWtfhLoaQNiFFPimwnJpDkxzmQwFeY95M72/kvVNlMg30+EDAdO2nqaK2gxIVpSLc89Kz1oDPN+C3kQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li --- drivers/thermal/broadcom/brcmstb_thermal.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index 72d1dbe60b8f..ea37e7ee688a 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -349,14 +349,12 @@ static int brcmstb_thermal_probe(struct platform_device *pdev) irq = platform_get_irq_optional(pdev, 0); if (irq >= 0) { - ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, - brcmstb_tmon_irq_thread, - IRQF_ONESHOT, - DRV_NAME, priv); - if (ret < 0) { - dev_err(&pdev->dev, "could not request IRQ: %d\n", ret); + ret = devm_request_threaded_irq_probe(&pdev->dev, irq, NULL, + brcmstb_tmon_irq_thread, + IRQF_ONESHOT, + DRV_NAME, priv, NULL); + if (ret < 0) return ret; - } } dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n"); From patchwork Fri Jul 21 09:46:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 706017 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 8E9EAC0015E for ; Fri, 21 Jul 2023 09:47:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231806AbjGUJrW (ORCPT ); Fri, 21 Jul 2023 05:47:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231696AbjGUJrM (ORCPT ); Fri, 21 Jul 2023 05:47:12 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2095.outbound.protection.outlook.com [40.107.215.95]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8ED6121; Fri, 21 Jul 2023 02:47:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BlBnFID395hIWZq+tA4uOukFYY/FkZlzQBu5zT7tVw753PX1Mhl8sSR3dBx/RVzpGiYjD2rWZ+NBEX3quNO6+rWlNUOEgYsnWHL4m2gMVolNw6WAdgzRkp4v94eTV/T9RIscjE9vNxDAFKUC7Ci6m3uskBfqF4qvLoBPukAAXHg+Y6cwAnOe46Xul3XbkmEW1u+rNRyQ1ICKvrQp/d11Fjs09F+OZyH++eAMAAVoLccJKM623qD92AxNoryJ8uSCVsTH/AuApHEf4V8tK7tqfDh6jWwEnh4VL7HRkdaOHJJ6dJ/sk8sWn/DmIJzedjZetO1b9GMx8BVKOhxMkpnmSQ== 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=iZN/WFcRaP+9FH5BrXgS8aXZCGQPSUC13FV+qNWDPYY=; b=U8uyrTNEWl0DaPNn1ufB8CWc2L1LtbjtMJs1Oco2c3tsmVq/EYJHqWUf3nBX99nblJcrMcfHZrypNlG5jllH+9O2MA8Y/uRjri7FnaOd3DpJuIrLn38p4SlkIOHIfabQ6Q5cNziRNjl2O9dtYw9XeOmyT+sfcmZdqyUyrHX2dNLuBhXTQVRECdfW7M/fmLXZe07HGcH+X+nz3+edIMP8S3771Jh+dvh/UI9gKLMYcvdYZd/MUYX5FEjMvW3w4ebUiL1nQoDqVV7kU7uKTmHJ1UZLC8HtgJwS1YJSHEOMvlTmmOT5Y1jY/KTErdyvRxcPi1Bx12M03+m+doTRMCzrbg== 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=iZN/WFcRaP+9FH5BrXgS8aXZCGQPSUC13FV+qNWDPYY=; b=ep9CqEnu0mGdkvWCRjA9ppnKJJ/8RruH02IhFwNlq2QTGBI7i9rSHhrOkwKqyvg8cQaX25hxUHUiOA7WFPZjQJYL3DBufGquc//l6ErW5DPjiMHsayg18MnmFWUL/yPYx8k/e5oE9Dh67mhpn5qoEvEWPbMZpED4JsIGD3QNtELTiQd/lratoa4uPZQRg4/WMVx4pmGcK9NmruLkH3pLgKa57AYYKWFnW11azTwz1IfbI87vUohoIf5EIPxtUbpj7zuUDPpFQ7M1rj/+JhOTWkak33ZEr+vmSfVfd859CHvvJAZWU4PIdW0r6XrTNTHHNlHe1mn1Jd54rwFiJjsLCA== 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 KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:07 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:07 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Thierry Reding , Jonathan Hunter Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , Thierry Reding , linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 05/22] thermal/drivers/tegra: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:24 +0800 Message-Id: <20230721094641.77189-5-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 8586879e-d2ef-4691-cb8d-08db89cf7265 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: N1R/WRYUXWBRTlE/G6rI4oDPrXXitKWVveITneUu59A89PbAwXLRDrsboXQb5ia+kPWCK7OCn8eKoxNNciLT88c/jwRpVRMKqdGH/lN1RJ2Y28Hl/oZ7YnpCqDR7Eq4PPwYNb15x1Inna9Dc3QBYy0wTmlkIkMroaMNxD9LghV4+sR6qoJYp/ov8FB3y/GBoduKl2spiMtozsG8s8XlKgGM/DR1Ujx6PQ4tiv2UnMvuqxGNpX0yGcgjLIVATPvRBrRGa5F54oMLrDm9pHM9f6qrFHWIi2m2LtNTTKtFnLpITIlSGaJoMo7fupW2hZalF6wDoFd2UxpSBtT1iVsfBW9R5BWv0mD57WJtFaiuMp/oOdGKm3fLBPpzQkmHsMis5umpPahRj4YBvuuOs62f/2EJH7PiosOl95mGXvrzjmxl4LYsi6l0VLObTcE5/Dpzm6jAYhBJz2K6lHBCZg6I/82EKZ5yCvP5w2tv2Yl+jpO7X+avFfTtb63+7/wwagj1ppL7IxzzHNkhPYZk/Fzc3BX0tbsfGff+wJfXU0R+eFXR2bSF2p/ImBYtFfAkHCPRvWoAHtVn1FvJ/uueRVrP7MQIqPMisoAdT/TbIsMM2H+UakNfkZpSedeFJ3pCRvAhH 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)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(6666004)(7416002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?1ofWZt24utouz97Lh3DZE3SAEQ2D?= =?utf-8?q?hjX30ks2EC0HBzKCQT0OYpTNhDnrx2eDrie9jGdw66j4s35YdHoPYwpMQmnQDxOiG?= =?utf-8?q?IQmA9Fb1l+jAXFklIzU8jkVTyCIt1NNYPlyIc6VH7PyaAlgorTgy9C/Kb/3cAfnxG?= =?utf-8?q?rdYM6Xuq6owng3DTl4AAQdVPHOm/p97tj1sUirc3GuH68sD1aOZoEDeI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?oyBeGl3WLPwTwoS/Il6M1gJkctqW7L4UmydnWpVMKIGM67enW2FLyWFOzR4JzeehX?= =?utf-8?q?XeP/6vYcsm5++T+vFYdSt7AVsaP9g6jPwKN3i2VWaK1cTlfXIW8nmVkYkonLWKKYz?= =?utf-8?q?TjHLBSgPLYhyt7IrC995nTH3Jcr24blBo4RLJvjvnevQL+HgH1Pp7WufVz9EH37v9?= =?utf-8?q?ZW2JDZoTU1aemmjfJ/Kn0094v1TsBfzUe7sEa+jKKUa3CSMrHcVdpfHzsUqK4hP4e?= =?utf-8?q?wYCHOkIGkgDuV6aFHwh4Ti6QCirF34YEmaRyWYTY1TJdYC4enxyrcfO95zTP2uptD?= =?utf-8?q?B4VQZ111ttLm8+lO3oAflfxfBAnpUEZ5x54cIHqSGXpxC5GDOauUpJNC2bHTPGMOT?= =?utf-8?q?4PtmyoLj15hmDcCGbaFvtUoZy7EvZLX1g3NzEvx8Us1YMXn1w9Ua1Z6Ao4G0v5Wet?= =?utf-8?q?W/2nDd9jK8DV?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8586879e-d2ef-4691-cb8d-08db89cf7265 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:07.4997 (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: wNW3TPwwtEjDrm5Rz4FYU65osTkUsFpEgq9VpYL5lhx99qUiQhIr9x+rwn/fyMoruybFom/egyYNNbnF3KJsDw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li Acked-by: Thierry Reding --- drivers/thermal/tegra/soctherm.c | 38 ++++++++++++------------- drivers/thermal/tegra/tegra30-tsensor.c | 9 +++--- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c index ea66cba09e56..3d144377d90a 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -1993,29 +1993,27 @@ static int soctherm_interrupts_init(struct platform_device *pdev, return 0; } - ret = devm_request_threaded_irq(&pdev->dev, - tegra->thermal_irq, - soctherm_thermal_isr, - soctherm_thermal_isr_thread, - IRQF_ONESHOT, - dev_name(&pdev->dev), - tegra); - if (ret < 0) { - dev_err(&pdev->dev, "request_irq 'thermal_irq' failed.\n"); + ret = devm_request_threaded_irq_probe(&pdev->dev, + tegra->thermal_irq, + soctherm_thermal_isr, + soctherm_thermal_isr_thread, + IRQF_ONESHOT, + dev_name(&pdev->dev), + tegra, + "thermal_irq"); + if (ret < 0) return ret; - } - ret = devm_request_threaded_irq(&pdev->dev, - tegra->edp_irq, - soctherm_edp_isr, - soctherm_edp_isr_thread, - IRQF_ONESHOT, - "soctherm_edp", - tegra); - if (ret < 0) { - dev_err(&pdev->dev, "request_irq 'edp_irq' failed.\n"); + ret = devm_request_threaded_irq_probe(&pdev->dev, + tegra->edp_irq, + soctherm_edp_isr, + soctherm_edp_isr_thread, + IRQF_ONESHOT, + "soctherm_edp", + tegra, + "edp_irq"); + if (ret < 0) return ret; - } return 0; } diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegra/tegra30-tsensor.c index c243e9d76d3c..dd4c2deba93a 100644 --- a/drivers/thermal/tegra/tegra30-tsensor.c +++ b/drivers/thermal/tegra/tegra30-tsensor.c @@ -593,12 +593,11 @@ static int tegra_tsensor_probe(struct platform_device *pdev) return err; } - err = devm_request_threaded_irq(&pdev->dev, irq, NULL, - tegra_tsensor_isr, IRQF_ONESHOT, - "tegra_tsensor", ts); + err = devm_request_threaded_irq_probe(&pdev->dev, irq, NULL, + tegra_tsensor_isr, IRQF_ONESHOT, + "tegra_tsensor", ts, NULL); if (err) - return dev_err_probe(&pdev->dev, err, - "failed to request interrupt\n"); + return err; return 0; } From patchwork Fri Jul 21 09:46:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 705176 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 E1A01C001DE for ; Fri, 21 Jul 2023 09:47:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231827AbjGUJrm (ORCPT ); Fri, 21 Jul 2023 05:47:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231804AbjGUJrV (ORCPT ); Fri, 21 Jul 2023 05:47:21 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2095.outbound.protection.outlook.com [40.107.215.95]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 130E030C7; Fri, 21 Jul 2023 02:47:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U2eNIq/WnazaKQTWORgJO/oL1lSpSx2MFwpQAo9l65CzMaNqeW/ASQBvC1VmU1UqUD1xGgJjWf5KZ3I6cvJRg9NzRg6V7vj25Tzn78ZfSBW/2ozUYNXgzfT4+WFnUwtZtL/gHmmfpuBozkSFaOvYhrEvDPXYn0YLt0jeCO1Qot1KE/jrmO6GSPW7IjOxwn8sAXvzlOvTMXoiD/vXox8ybA0z6xCJk+TukGCgjiXDkj2a6f3r2wxPLRkGOXv9FKvqXwg33BkNLOzRvQ1rPj4M4X1XBtHRUX6WWzI04SXFSANYlDWUokgHLGGjtu/9oYlcvFx9s1kK49ZzIkaCG6ujaA== 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=OEGCtasWCOSsSknQ0GZz9Yd5JlWw//E0x5dPjE1KYLQ=; b=VPS+cy1up6OuFUufLm1kbZcGcWk5jNiIrrT3Q2ucD4LbpxqV8m4pSwxBDa7EhbhF9zmwqPTVK8jYqrt1KiFjf71yn13A55zMOn6Kt80bszEtHbRZTtKQs6Tcll/g5fqaOTtcEDPIecY0knAfkd8T2S0YyCFs1/m/hfs6oodzp5aUna1CCM6y+NG3TkwDUhPfTSJBo208idz7yzMuMU2TrKHIjyp5rVbC3r3J7Rn47VsF1nglQuGSIaEAsvXCrm3XfbyLcUrQ6U5/kSZeuD5HA01Jc+kJzzqtU77Mq++9jwTAascsFZ6YZOR05mQizrssQHKsshZB3tH6M0czKQ0iNQ== 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=OEGCtasWCOSsSknQ0GZz9Yd5JlWw//E0x5dPjE1KYLQ=; b=fx4kYkOZifPa/0KlMBxDl7LwrtimndrdTnyiS8ZtcIF5wk0kxVUDJVCrWTt3QHCucbVjsGXwNSaBOa80OK4SBoqS9EybEFT23Dagn/ZMC7Mnyb1MkYyBVo47vo65SQ0Nf0NJfgBl12u2FZ8bMc3ZT0C+8iCqtpeIL+RM4IZV1+pAFKEMKduUOOCsVZfKQFPqCvgDxFGAtlXQMFxxpxJ5C60ill9GX8H1DccTlkCFdTrTV+DGCS2IvMJ9Xytj6lg7XsZXXa81WB+Gvij0c1ZzbTpoimB9wlqynisDfaUu+QmU2+L83N30XT8fiEYE4RgPCfKhZMSjkobUaMcbyTwigA== 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 KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:10 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:10 +0000 From: Yangtao Li To: Amit Kucheria , Thara Gopinath , Andy Gross , Bjorn Andersson , Konrad Dybcio , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 06/22] thermal/drivers/qcom/lmh: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:25 +0800 Message-Id: <20230721094641.77189-6-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 1c826e84-7bc9-4cb9-1992-08db89cf740e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mnMlm9bGtj/jWhIWppXFpAYUjCvwFErB2VVBRYGpvizB/QDSW7KCJVq3bf1lyMexkdpxr7Bcbq3crRWn/wc6BUxjFdkZBMPExb84Lm+Awoz11AcVxUb72STe1N4Lgf/XtcgjT4TJ4uB7vZ/duw96cKYPdWNPoriBXbO5mxwkzScUsKl0lpZhtwOzmQihLpdQqujN12Ae3FvyjA7q5xoTHroEHs1Xk5NbLLNPDpmq7VDHDxdKbNO7B3JFCUHnl7ixiMynEgNDiKmVDzGiT0jRlI8okXkqNagRDlFnRgkHhJkwzSK2wC/kgAMyiQwANtWyY9BAti0D8m5c0SKJQ1dStUGxrpkSgKedW1Pq8+di4Lv2xzyyRw2eyLjKol+WeiwvJe6TXRjo4ljC+4iAcC5C+pV1QlqYm8G0ZZdJeIPSKdI1gDk5U538AMskqzaokML47wflAF2LCR5gZnTm47j8MLRAa2Unnl06Oexm8+r6u8WbTnPuYkwvbsQ9kdmK1QDoAO+zi1ikc0y8s5B8C6F3UAcZT8HhRy21AdFyOr+DH1DmUs3BZgPbiBuW1nt/2Ts83W3aXuM0Q/qXR7LvM5BEEFnGkMob+ZEs8X4JFze1UC7wQmZc47vieZZDuhq7829F 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)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(6666004)(7416002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?2NKEr39uN2Wv4JZHezP+D58SVxGE?= =?utf-8?q?b0t271iy9OoSG5HF2S4oIYbe0NvF4t60a0kLHlE6Bnsxm7WQMk41T3UUaUlhK6cIg?= =?utf-8?q?bVFuN7XFVUmmC87zrzqEPCKD88QbF6SwXhdtmNKLqlUClHCrg4gNA7kBS5t1LEb2k?= =?utf-8?q?cCSKPwIdelxu4mVOnRyec4CqJt0NSy3I1hUS/a7wiSM+KquqMK7cf4w+YbTfEbtYp?= =?utf-8?q?MdZAp/pvA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qiBNZX/Dk0gd6bnRSgEZF1SeuDzLGD0kRakPzJXF0Xy2?= =?utf-8?q?7f4Ce6y1tCEJwzMHlVNFrKqsTvS2B9FLgbaG1SRGnouaCBNDFPZNq42gsXL6kXiLa?= =?utf-8?q?vJbHEa3L8364LaDjGT1b9D5I++yuBgdqbA1GR5G369x4+KRHeaI55f+1Y2EcskLmX?= =?utf-8?q?LNDkAu/bQ2fT08budwlVlKEZSS3Bd+hALIBxu5WWHS4VJzUMuC4SdqbaAoR43totG?= =?utf-8?q?fyJjBrZcJKL+9xWuqhZyyRhrtgvSYw3zszk20vnKIK+h4JeVjAytW6T8qClLpcKgq?= =?utf-8?q?zILYCM7fqFsdwRIY7z1155Ib/XQ3nm78gRxQo+2roC0DK1WM0rVLhgEdy6ekAv0EE?= =?utf-8?q?mmVDeNsOm0/qKiyUyW6t8N+kmallGvFr71VIwt6ylqSaja0jnSEkg4eNrVEugksog?= =?utf-8?q?TuGBDxIs35KQ?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1c826e84-7bc9-4cb9-1992-08db89cf740e X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:10.3028 (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: rueYrhLiUgrUucvyzkb4TPktGJja1cwq8WVjB2LGMxeNlOuVn4nePFmOfhFz1dBZ5OFc/DifCkArw8nu8UmcQQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li Reviewed-by: Dmitry Baryshkov --- drivers/thermal/qcom/lmh.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/qcom/lmh.c b/drivers/thermal/qcom/lmh.c index f6edb12ec004..48a14d7e8bf5 100644 --- a/drivers/thermal/qcom/lmh.c +++ b/drivers/thermal/qcom/lmh.c @@ -207,11 +207,10 @@ static int lmh_probe(struct platform_device *pdev) /* Disable the irq and let cpufreq enable it when ready to handle the interrupt */ irq_set_status_flags(lmh_data->irq, IRQ_NOAUTOEN); - ret = devm_request_irq(dev, lmh_data->irq, lmh_handle_irq, - IRQF_ONESHOT | IRQF_NO_SUSPEND, - "lmh-irq", lmh_data); + ret = devm_request_irq_probe(dev, lmh_data->irq, lmh_handle_irq, + IRQF_ONESHOT | IRQF_NO_SUSPEND, + "lmh-irq", lmh_data, NULL); if (ret) { - dev_err(dev, "Error %d registering irq %x\n", ret, lmh_data->irq); irq_domain_remove(lmh_data->domain); return ret; } From patchwork Fri Jul 21 09:46:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 706016 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 01B01EB64DC for ; Fri, 21 Jul 2023 09:48:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231852AbjGUJrr (ORCPT ); Fri, 21 Jul 2023 05:47:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231818AbjGUJrX (ORCPT ); Fri, 21 Jul 2023 05:47:23 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2095.outbound.protection.outlook.com [40.107.215.95]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 498D930D7; Fri, 21 Jul 2023 02:47:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ICrn6L49WCKH73MWdY9X3Eh7bGowQFLSJKr6iu5vDdcvTsC4aGJGRnqJg4CXywLs/bnbIzNFcZfqbGYGT/CYO2kcByD2fhuQyG0jD53QZE23uew2CXB8SqDsRaR9jxb4EGvfubMH8OZqOBvcBQBhzEaQEE83lnf6EvmpH0NJHYelJKm++uw+EvMUhLKG09EGv4o3zB4REMtnx7WUofoCeSUk+3dRWW/HphX1iK+6kg3dRSXh9/BrkLg4bmqlcH8dYJoR9bEIqiVlvAZqNFrn9bKY3oGgJ17AhFSHJ7/HKts5PrGA2FYxHvX1tUGpBsg88tWIdkUhAPjIt7akz0srAQ== 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=/+gwW3HWoFbyKNr4P4zmQsQ0AWdekKwoDQhwbjDld4s=; b=J2X/hCcddxm6sMaBw++W167h2z/j3UKMr0CnULfgtGFLwbNWZAoiaRmYs+V4QhKFa+w0HeCzFBQyRAjU03VL1nsJ9qs3rw+z3Je4xZFgT6lIJcNk2Cgjo4J77JD38Z/bJtd8IlkDcH8Zo5JCy0aiSNSjzPvjoattLCGCpUGTxm7SQlWX/AJnuUasvDRtVQFyXDbJcdGz+PS2Gpy5cNiiozR5HFw/fSBxeHj10n33E0qJWBb3uvc8zNH2iBQXRQW9zavrMcNEo/thYy3qWKV5vz+TyBFaY0uK2s4Uip7UP0CLo46R+v4fqJxZx2IruMU17ml/TZ2KwlkT8WdW65MiCw== 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=/+gwW3HWoFbyKNr4P4zmQsQ0AWdekKwoDQhwbjDld4s=; b=cF2JDo5dPh1vPk+ZMHECqPCMHysej4t8qvwFlUK7Pc1+9z1CIbWZeapFwF/Du5Nq96jYnPSp/8DoSzmgVcyi8U+GPDL3KgIKMe+2HMAd8JQZjt+7w4ZU/BzGJqL8nJo4N305nV5R6YjdO1BOtnPn4HDwLG6Eh4noF9XbgR0SomNKWjtdhms/4DczdQi7aVEaeqpiEl8LK87Nrd2w0PbgXEMlJRfBwD5YlLcOx/9jD7QDAM+kHPg6+vpShUg3dUT5JgOa2gixaVYpX4l71KA0mQhSc0npFg41RJW3bWMJV76P5jbxexxIozqpZOsmoDQ8J4QBW5tsMvC4B4sa3EiU0Q== 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 KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:12 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:12 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 07/22] thermal/drivers/db8500: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:26 +0800 Message-Id: <20230721094641.77189-7-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: c0dff76a-c25d-482a-d2c1-08db89cf755b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3Nf+mI4/Mbgb4QIPpg+NgXypRZOsvG9mTHKTYKoRjvR9DdmfEaP9Tqeni/OMV/tD1GQRL2C9u8iArqBTnqzJk/o5qVcXpJBXIpbO9wcNneFs8W8la/JntM6wPCTZedM6NCBQjHpurQgHEcPH2CKZN4P4RNdgHXuqpQIonqLvkr8XTW7S34VNtlPxrxDxQsQ6NgXFj5U1UI/HGnYKJE9VK9i9NnGLusO8RUXy4L4HkMUxXzTqp2q5fnP1DxCzw4NB8uc15MwJzu5vYfdMd6X+hxhBpAs6e4LXEJ2GCBkHJoMkHhOWtMqXR+BM9+is3xrooCMNd+hEqmye643dunzVY/1txENvQtADY4UHDOA1CNLZZGdcJxiHKTE9uuhUDRXURRRtZrjJkOMznjO9CtJ1MfXhicz/ZLySV5b6jv7y38nq3jaORKNm4gw8dJsQB7HRGb/x6ICwLWFhM09Q8fNmk2ECL9OnWNyqX0jNvpU9r63VAcsOFM+co5j5WLtLioIyJkevdGKSXVisLWN1YUffggobRtFOFdlKAetCTGZAmDGA8lhzDh1lYCtRk6RR+44pIC4BsiKbd9KPcaVzMGYMkAY00YItLE0wZXihigMS3wZPP1oF9jTd7odq6VKOQEWT 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)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(6666004)(7416002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?JJ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rKnBPpBXBNpRnQQ?= =?utf-8?q?nHieOl4O6weonFKOoZyCz8VJgsEWwqLZQgM7qsirPTcf/4nz7UZBsCK42z1w2r+t5?= =?utf-8?q?x+yRsTDhK+ZtYuNcA9wGbJzYBcQJQDtweNTI3JMLNnchUQ6B30xKBb9j7xzNJx0HE?= =?utf-8?q?EOTkcxQN8CfZMeEDzhQzyefx67abfls4BVbVtfCq42KpPttiyzllVsMBaRuVqk1JU?= =?utf-8?q?UNNev+/ldhCdGncVypq5vtJduoh0tieYJisoDRGgzKVB8Aht/eUtdXpaQuak4AQBc?= =?utf-8?q?NjjxaDbuRQQ/hNFaow4FuqKn0JCDj7RFyQyy4xW2pFxUXXaUY1Osn9Kp4Cbn0tq+B?= =?utf-8?q?x7NX0jIypp1T3l2FS2OxXB+dbIVaQMs+Ga4KcBTVkf7ZoxjkEWc3Ddxs8sQ4NL3NM?= =?utf-8?q?84OyhvLuigwztcTtPz/dalNBNb2IYMziOvkdiZ2NUqnaFWj3smlltg8Vr9SHEIF3n?= =?utf-8?q?1PGvS+ctNGWmn0HWtk4XenBW6sBm6TX4btClb9TFnqLNo/sXbKpG28/2+NSNZxssu?= =?utf-8?q?pkkINd7NgGe9XdxiBAVP4g1/mrWTQI26S9YLcz5CWaFcalRn0sHNNCEv1yUlj6okC?= =?utf-8?q?Cc2sEtLmiH/QWRlfY+j6soa2K3HcHIC0QmObPDTIVfZMi1AyveMO0/1vtXw8Wjucg?= =?utf-8?q?77UhzEncDIUy?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0dff76a-c25d-482a-d2c1-08db89cf755b X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:12.5246 (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: ImTdWJDZnd6c63N6ido1LZwl/uxovGBRTpXyATl+75blg+1emqIuXEp9ritOH+qTmWmts/25B4FOyfuFnECZmQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li --- drivers/thermal/db8500_thermal.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c index fca5c2c93bf9..0ef8fc2eb4a1 100644 --- a/drivers/thermal/db8500_thermal.c +++ b/drivers/thermal/db8500_thermal.c @@ -164,25 +164,21 @@ static int db8500_thermal_probe(struct platform_device *pdev) if (low_irq < 0) return low_irq; - ret = devm_request_threaded_irq(dev, low_irq, NULL, + ret = devm_request_threaded_irq_probe(dev, low_irq, NULL, prcmu_low_irq_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT, - "dbx500_temp_low", th); - if (ret < 0) { - dev_err(dev, "failed to allocate temp low irq\n"); + "dbx500_temp_low", th, "temp low"); + if (ret < 0) return ret; - } high_irq = platform_get_irq_byname(pdev, "IRQ_HOTMON_HIGH"); if (high_irq < 0) return high_irq; - ret = devm_request_threaded_irq(dev, high_irq, NULL, + ret = devm_request_threaded_irq_probe(dev, high_irq, NULL, prcmu_high_irq_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT, - "dbx500_temp_high", th); - if (ret < 0) { - dev_err(dev, "failed to allocate temp high irq\n"); + "dbx500_temp_high", th, "temp high"); + if (ret < 0) return ret; - } /* register of thermal sensor and get info from DT */ th->tz = devm_thermal_of_zone_register(dev, 0, th, &thdev_ops); From patchwork Fri Jul 21 09:46:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 706015 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 8E75DC00528 for ; Fri, 21 Jul 2023 09:48:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231229AbjGUJsW (ORCPT ); Fri, 21 Jul 2023 05:48:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231845AbjGUJrr (ORCPT ); Fri, 21 Jul 2023 05:47:47 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2095.outbound.protection.outlook.com [40.107.215.95]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91AB5359A; Fri, 21 Jul 2023 02:47:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZsE54HUe2/tiVY/iyUUv5v0xH4hcc5AEYZWgDdu8T57e81yCrCnALRMeaYaQ8arBy6SLV8KdQJlKY8O4U2CJA/YaK6s3ce0Uhr/Sjy1VDcdZMd5qmjx/DCdyxabwtNAhs7Zw/cZjWz6BwbH6A+0FHG4d//ay42yHxoL75UU27RdvlTMgSe60fBc4IRkAsDc5+glHZaLMPk2GYQNou74NOLGbrEkjhdJZhH/FBA3GE2T4fg4br4m8rFcLz3XB+qGzUObGERIPJYbOueHeDRqifWycBwlkPZqR/3NdZpYwxsZgc4SmQVFkVmqtOEPeFfjNzvyJJBDr5/ReSYmrjYWoTQ== 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=UC+Tw9tBAxhMQXbL/7pWy43tyxpZDYL9sm7HLlbfqK8=; b=ckixOFQHaWJm/O6wB0XGNLTScDRqgxqMku4RcbTipvwJYC5PClU1aocrHVFTR+GULvhOntQ2wIUiw4Wg21qfRWEBAjp/xQksQm9mD03iI5PpsZb5bVOGAf58LPaq5WDGvD8wQ/t20VAWO4FfrYuXGZ+VWH12PKmdJX8aE0ay1cPHZX4037J9gtrWi126PifEr4SWZDUwGYlXQEbhJE/eRrAgQwbi3NiIWPHWXp5okqFNX5kZjpdn5waml7eD/Q1x7wO+TfTTwzVOfp5w9Tz6/pYzGEho/7L0EOXv9JFINFhMzvjgTdPVvzzRR7ErqXpEtAG1xWHCiGCzwXYQm7FL5w== 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=UC+Tw9tBAxhMQXbL/7pWy43tyxpZDYL9sm7HLlbfqK8=; b=kGuPR3cx1/zZEg2RiiMeJXtXBdhkZGeYvWSkQB1s8ox86hp5KIs0FN35THD1tyL5bHb4CvFSoziYF/X1XX4hLkLDsj4w1pKI4HjZrZ0N329nTkQVgh7FPW5/xaqe3uShDhPUf+dcG8NyJx8aoNg6+9HeD2/Vz+0t0DVFDULFM2x+9QB0jF0fD3159/tR6ARjLjbIz1n4NUvT4utRlc4lRUFFIMdWZ3WMN32IUAHBpwsZgLffKwBukwWNTSSfEWtlzrJVJmudTyAp7/YuC8RZgSxegMA1cI4GmYw4fHiQZJL+h4sgVH+H2twV2t4J3uKxznrcSjc9YbLzk1ao67DrHQ== 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 KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:15 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:15 +0000 From: Yangtao Li To: =?utf-8?q?Niklas_S=C3=B6derlund?= , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , Geert Uytterhoeven , linux-renesas-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 08/22] thermal/drivers/rcar: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:27 +0800 Message-Id: <20230721094641.77189-8-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 735b28f0-2ae7-4018-3897-08db89cf76d9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iabuIMEDtyVit7Z+kgPtdxxo64epokqH1k85JJcJZsghZgffTDzc8dSJ8KlChLVcGajRE2SwMQGMsDezXUIDXC+C22NGZm884n33DgG4nsKN9mOYHWh/Ti4Tdf9flJ4cFyZEjsTOKMyeFzl1FpCoJb1kifb+LxclLI6yWiohQPwu5rvjW7HMvxRmuNW4gxVXh+6P49K61fpfGaSs/s0do6z/MyPLhQMavVkvN0kcFGdHM1/bzqG9PNo4XUOF2NqM4Fhe0dTjqpOlPn84/h9r78cPiu5/+dy/eQipUtZ05fdohtclMPLOt+BaKQOmTO1JOxC+m5eI2eBVl04vVRyPWstkWvCkqM3GnROYl7CI5MuY9jwt2XBKBB+089Vpq17KDgkkdUQqaEbvkvfjY4LF++n3avgTLdALrzz73x2fJCIS9Po0FZCHtrFR2MKvCZRk71Z4hF3xYHmkWesG2GxKH3tnLiywlEbeBbexuxFWEtHr017CQnGd7nfyVWv0RJnvwLmF+OGWgQmPylleI9kD9ApImihmrpCd87sx1I/bLRz9QEtbRoeDcYVCkxReGnHKwUY2W8Unoeul7+32YXpVRWhF1cexXS04LcCt+FsY8p2wiiGz9hQ1F9UYBLASm5yt 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)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(6666004)(7416002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?XjuJiaUwwveBcFMAspYNdO+pm+2E?= =?utf-8?q?XHEiWgksXDyFsNXH5ABF3b2X+/0x1Ghr51nopxRk0e68b6QPsN2oQrPkUmwtso14w?= =?utf-8?q?D6ZSJLiImO+7s9t0r6BEWT2TktW9oUqiYWlbdS5jc3X/9VVg+M1lkeZv3t6DiRdYN?= =?utf-8?q?VEVXfr53uKVccS4Aw2v9W9/g0RWX8ZRz8i3m7xd6gtxKblOGceJ+pVJiVOjiiIyU+?= =?utf-8?q?V4P1RFCPwTuf4XTNInJbwdtippPWF4nc1kx2XanvsmsfvFDyISsjDZEcS24m4VTBX?= =?utf-8?q?H0S6ptlfo5vWpanvmT7JXgjmIV8nVPMl11E5KSdrNgEHn/pKjSPAzwWJgStU0jpDl?= =?utf-8?q?xbeBVSyuK3SemXSAqF1y4pukltR7673FlwEdOfsdPrkORHOyMd7CdTQwXMmkurI52?= =?utf-8?q?1pLbog8goH+EY/EXp7rXrN45HR7qx/jaN8JsJY/0t41Q7RDCt0BKpDmPmOutl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?utf-8?q?WrZc6BABbY3AgV/gq4Ka6DXJSWSYfxccfdTpP0simBNC+hNgHw+xoqzsLeSQe2n8Q?= =?utf-8?q?xCGxuG6MBDvcJHkVMM5SyTmuaEkbVSF3NTRxcI7XZmAUR9u1C8MNjXOHTsTI3fRBm?= =?utf-8?q?ddr4sYXzEUnNHNsygVup8c6OrSsrbS3cbmyMxYsHZcLPmz+xUmo8DGVAGemiJTMb9?= =?utf-8?q?zlC+gkbTrSwA?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 735b28f0-2ae7-4018-3897-08db89cf76d9 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:14.9940 (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: gTEUwsAhi3qp3oxLpuhxlw+dBc+AfnajAD4A6RlUoI9Y++6hRVK1+3peal+cz8vP4h5UjbWxrn3vwgDXjt9Jxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li Reviewed-by: Geert Uytterhoeven --- drivers/thermal/rcar_thermal.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index b8571f7090aa..56f3983dcd5f 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -446,12 +446,10 @@ static int rcar_thermal_probe(struct platform_device *pdev) idle = 0; /* polling delay is not needed */ } - ret = devm_request_irq(dev, irq, rcar_thermal_irq, - IRQF_SHARED, dev_name(dev), common); - if (ret) { - dev_err(dev, "irq request failed\n "); + ret = devm_request_irq_probe(dev, irq, rcar_thermal_irq, + IRQF_SHARED, dev_name(dev), common, NULL); + if (ret) goto error_unregister; - } /* update ENR bits */ if (chip->irq_per_ch) From patchwork Fri Jul 21 09:46:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 705175 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 97680EB64DC for ; Fri, 21 Jul 2023 09:48:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231715AbjGUJsR (ORCPT ); Fri, 21 Jul 2023 05:48:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231984AbjGUJsD (ORCPT ); Fri, 21 Jul 2023 05:48:03 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2095.outbound.protection.outlook.com [40.107.215.95]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8E3D3C03; Fri, 21 Jul 2023 02:47:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mY1qTVsoJH2z6vvm5lUuy9OS/o4MZCin4OsdqiraRmSWX304TK3DCOJpeR0bGH3U3rIwvYHfvJ6VdiC5j6hwlvrXOv7sz/mwjxwoL9QaYcM5G3Klv3YMI93Mq/HYqWspPHcgCQCWx+xMYBPLoyXyfpHLmb1gWN5KFtNEqFXDT5i7T0QcRxqiiXjfEOi4IRPPncXApai65kfodCRZbhSuet1ssp1OfZ0T96Yh6R175zMs3F8TqPHcJLiAOZmuOMGxenRS0IOaakp4KHdPCkgyDgA6JReatfhDUzO32b6y1permb1oRNRTSHUY/y4dWsJ2RA+T07BViZwSMm19DsLkUw== 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=lGhadKGMb1A6nuEIHOjE9NtutBhspKIwNkhmP0V70x4=; b=bcfrIHxU2PTogKS/KzUziprUHMBbDxktaiR8rOQ6ifSk0q/lRRxul9+dvCQYmL1kRSLnBmcGUeOsdHX3gOpAF5mEUzz1sBFvhqxgf9jFKNPJ2Ns6UW/fqp4cni4h9L8zZbbnpmiT3YYc4P9u02ItUJdyWwvrKuBe2WXmhSULcAwSbaVyrYBk6miFCg7/XaEoGrsy+J72QekVDw3QN7nBTql15iIT5R36B/WfiynkC0HWwZimj0D3o/YOZu5BGfldEn7+18xRLHlW0qwJ3Do95B0Rc0eTqtND4s6gPrm1ThSVURWlYTkFpzBScPnM4f0uMdTMR0pX7liVG/ycx0UgpA== 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=lGhadKGMb1A6nuEIHOjE9NtutBhspKIwNkhmP0V70x4=; b=X+sBCMev+79DSn634Jp7QAcdTitTxF6/mepxBjbpaLw72W1f2U9FtTGz46ltkuy2yun1iuIVZgzhNEmMSOWpPG0Xhc3OZ1qqv1Ckh2mGBDMMz4QBB7ofTAYWARY1RXWrZd2UJpTuurEycQu5WHhfl+JwQergT42h91J48lrXALf0RucKUsqpGFsbgbP4v4NctgGiyifSJxjcff2LTuHXODh6abmdGQxpW2unuVJ980Ct731yg0uWCwTCmRDZ0oIpYgL3tRJ+4MCTsUV2ZGDQlN/wox4oKm0bbrRNGsMbEbsVzuB+vYQT/PA8jD+9yKai9IhQ2imWFGvXQSIZXdSeAQ== 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 KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:17 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:17 +0000 From: Yangtao Li To: Amit Kucheria , Thara Gopinath , Andy Gross , Bjorn Andersson , Konrad Dybcio , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , Dmitry Baryshkov , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 09/22] thermal/drivers/qcom/temp-alarm: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:28 +0800 Message-Id: <20230721094641.77189-9-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: abdbf403-d44c-4de4-ad67-08db89cf7888 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ByFKIY58ETlxR62LHxf/7uxPL6Mhmt2eMYkXod9unv1x8txr9IUN1SnFUNUDRC7IRvjbgbM0qRmIMmTZzTzfIZDOQg81O9lq3qWZZ1FKGLdkHNp/1iJ6PDLT6QxKAWWk6EI8sqAcg+PMDX53kchfsTScqsa+dN3N0f892N3cjxr6pxDF9NgFLCPh9Koxmb66AWrXY+IrGzrnQVU7tm8SQAgINX5OCdnq+044cRbghVPbS+EYxNIuGxKSKiYblMUrrY+x96UWsdoaUaQT+FIvNnNnYSKC735XGHRq07au/boYLtQoed9N7dyLWYRWSYyeTbA/DibBeqBHVxxf8x+Jcvdfd0t0F0x5eq6HLEsHYuzeNngl6mPT1epHA5U+6a2wurgN1qzwsi+KqRYYhuK1649vvS2QSEYsXuxvL+0lB9TbwyH7kH9IZSDqbENhsIrow4CWJxHB4VZB2D4MbxvEfhXaqrdVbqw7ODmu2sZQTneO2LiDGe5u2iiIWRyy6gcIIKWooVNLSo1/iYqLzNDzhAce6XNQLcE0VzPp4Tx69aC8bKg69/PfPsfQBFqI47jKg4zB+s1agvGL/f2qhQFP4eTD9BcS9n3Xc0OC8aWZIcQC2ygB7lMWa9dcpnMhlhdp 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)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(6666004)(7416002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?uF1j74hN07qs0YlRcX2549EbIxHn?= =?utf-8?q?h5B8r0sY7zrErmFPi8kipRUVL2AL6OHLrkXBg5xEc26263u1TyrXOwiUhIFxhrzcd?= =?utf-8?q?My2vnLd0hUB9tjfnfgWHRF/yJRF6/1WJqykMI9PrZlxzNOuxQkMtLPEu33JX1exxU?= =?utf-8?q?EPLAFObUx72D10QlEo0bG9fuAcD8YK7jg9fdoPWo53DFn1QT668hpoSZ7jQGd9zD7?= =?utf-8?q?MdWLgM/q9diM6vg2qj4uyCM7O0pktzuO9xTGZIQOcTmR8/a6Nq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0lmp/jHT3G?= =?utf-8?q?C3uIaathCqHEzuOMo1Eh/o6bWPN0tuWdzxz1xzWxtza/SbQ/mvbKEglNEm+EGkqUE?= =?utf-8?q?Ow01E3Qi9EcDQao3gg3lGid7BWBOJ81Unz7ZXP5wpQIHSeiA/VMC0c+mTgDX4n6HF?= =?utf-8?q?SPqhYWsVg+UMXTBxBlsx7c/2AIWBTeCf1kr8m6TYj/4UD1ifjVWkDPxGtQbBYYtti?= =?utf-8?q?7dqI1cU/3vN/ZD//8XFZpRZGmAjPy4hTgd2KF/mQ0KNVPPzEjYpbHXbjQrNGWPgG/?= =?utf-8?q?t6ZZ4CcQA/ZMYX/mUBQF1W6EmpIjQam+A6Lzz0l6PdtTrDJ7UUziC0WxH1xkAcVRI?= =?utf-8?q?HR8nsedvyF+0RO+p6vZRtI8op/jckXANtvQkG2rI1v9/JFN23cMxqJiVYbgFj8nXA?= =?utf-8?q?vDJFevg9tg5l?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: abdbf403-d44c-4de4-ad67-08db89cf7888 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:17.8103 (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: ++9dHGbQ94Ijt/IFm8e0+JlgYXnRFbTGg/Eoyv1hXlMSTloCqdJTpXQFf90A6lJCKV6LoNPPCZKL+JwDkJWazQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li Reviewed-by: Dmitry Baryshkov --- drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c index 0e8ebfcd84c5..1b4a7eca181e 100644 --- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c +++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c @@ -455,8 +455,8 @@ static int qpnp_tm_probe(struct platform_device *pdev) devm_thermal_add_hwmon_sysfs(&pdev->dev, chip->tz_dev); - ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, qpnp_tm_isr, - IRQF_ONESHOT, node->name, chip); + ret = devm_request_threaded_irq_probe(&pdev->dev, irq, NULL, qpnp_tm_isr, + IRQF_ONESHOT, node->name, chip, NULL); if (ret < 0) return ret; From patchwork Fri Jul 21 09:46:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 705174 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 F3889EB64DD for ; Fri, 21 Jul 2023 09:48:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231843AbjGUJsz (ORCPT ); Fri, 21 Jul 2023 05:48:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231830AbjGUJsW (ORCPT ); Fri, 21 Jul 2023 05:48:22 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2112.outbound.protection.outlook.com [40.107.215.112]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57FC530DA; Fri, 21 Jul 2023 02:47:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ggBM+bqdfFHPmeWa/kBYl3IqgGG0WXW+VfsAEUwa39ct9DB4NVCkDPEpDluL9NG/tUxcVQM3nYo6kxeQaE6jsjlraHeUeHvtdKsRxrn8ZfOf+uop430CgF7eGOW9IbzMABnOU7hh7cQvNPTpxxfbR/aYohQqj/exoiXqbZaIsHqqKHTXVq6mwg+qG7yYDd4hf+3dCGKUmiQY1NXD/A78vzDgKbROWIEIPy+I/0Bx+jP+q05zt6jZadA4powd47Hr16TFOlrhF+rv9SlVaEgQRNgoD8urdlQdGGDSrMMthFWzmK+sl3IvsX+4ImziJi5w9lI5Bf1eW7aCUVmWrx2log== 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=CLDhRPJ94KJ9YnANj8lefH54Ay4lhdCGR4Yz4x9Uz7Q=; b=n5V+T6dLeAhl8mTtGCEhlCwGYHoOYZO4uTCqtl8O4Q8Has+59uaXmJprLgmOPDwIxI4isqnT8GRDxFzYtiycb+l5u0wrNvTKpZjWGPFwe/eMzQ2TvLtODPHc63ZGMcpsItEfXxr5y0ORcE8Mp2X4GJXWtcAhrwMSedn7t6N99aJTqobVjk64FQAdPS7TrwwrlOFbCO9/vj0rjX/h3xsLLi5m0ecpMPEJCPHf6E4YsLb6L5mYhA/R6P3WaQFAL6jLHSBzduzUXv0PxLW2ZAlro3mhyaD6DyiTJjvF8CDJlJmQ6iRgdRoMdhA2co1S5X3Wo7zy1MenS02rkNJnxJ/l/g== 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=CLDhRPJ94KJ9YnANj8lefH54Ay4lhdCGR4Yz4x9Uz7Q=; b=BSZ52gzXGJDO7PUwNkRSAiPx0o+deyRFm/crRhHu3eVjAe2tloasBCiEb2gdvn3zCAumn2KPevKcWivK+TwYhjTC3oZ0Y+Ta5N1dDOiwZy97z6AtDDDCDQpaZP15VS6KD51fiaRlxUxANWjIUtWVTp0R0BA1G6yTwctUNZjIFv1AxOh5dU0xJUJONw97qOwne/2piHsOfenevPWfp8YHxxvu7Yh44Ps7X3q9pRs+XSIDwsEDemZukXr3nuLOSRJJAYhqDVRiMmpnD3KjpFqS1qremp3X/7xkA09oFugLVTXRlEo9uYkDn6gTdNDDCSCdU4OlSJEC0T5QVVtuoMNsQA== 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 KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:20 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:20 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 10/22] thermal: intel: int340x: processor_thermal: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:29 +0800 Message-Id: <20230721094641.77189-10-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 8c6eccb2-f36b-44e4-6689-08db89cf79d6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gGvDbGfXi4aorYe+CUHUkREmGZ3vrj0uMRcCStlCVG+bNEsfZEO2pfJ+3Xkzh4c9mTyZ0LObPNNhnIPYNthkgo8RQZAvmbT+oMb8y+m6rvE9eMBHikaCXWPIBWioIaES1v9vOHkfpECN2I2r2dZ/Wa15vwY4+n/FS/BErYoDFtr+m3MDvex6DgZkTKx4YVq8Exz4JRnmHBQfiGPilbhxAsfnHMBxrNsHXmiTqzIBx5i2N6q9aj0hbD0khCh7Wt59ct0d+g/ABY1juvIi1OEszsTUOlDsgC7mhu2HX9kkXBLEYmIUMQ50P1KBbw0OT995ooHjuX2iN3ROTPIXjEokbcT8EoPSbvJ5PigqD2opHdD2tdHcdtLaGlrGYg+Z6JB796eTniSmCtiRp2NpNT7pRioP1a4xeqasOVk1/va5V4yVbtau4sT3o6SPAmCYsi0P4sDTKzSuCa6tZn7VDCFKXkCTlNg640whva41YhnQroghjqKIQHKP1z/bDCC/A0kJBJ5PmfTrk/rXW5a9c+qTTrvdnsaDN4rJKAR/tYO7b85UUzFeg/tHkzmrd0dsl5X3YhwYiMhoIA/t/7SA8qhnE8jtinMMikxGn43Et6uyy7R+03H7uVRYwJCgCPmu0i1M 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)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(7416002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?7Quv2qskArCkEI1EbE8BS6W2CT0p?= =?utf-8?q?urSkC83rMB+D0ASZ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4eFmyXW6+boaZvBGCVuObK1UauqCC/iRRyiCAjIIjgCJSM?= =?utf-8?q?ZordBzJD2Pnou4NsFK37mTLZhzPoqWYZ87ueApTHPFArxS3u0+qWvXTzW/i4U9s8C?= =?utf-8?q?y4oDGpFLryUqTtd/DKbw8eghAeAeu9zEW9QdXD1GDRx7qySBj/kKZamAQqu5ipqnN?= =?utf-8?q?qKCWlEKuV3apmGxRLOzXvI96t/fDTCPM3uxY097CVHjW600V3W9xSli3DLvznmHDL?= =?utf-8?q?zJi37s+xgB3RHzRtc0i7K8UWoiFLtFoywiLTfrHZHwEu+oAc5QfVLDILUHv+4xRR1?= =?utf-8?q?Xko+onB+r7jPM+VjLJfhn5flwVfnThBYIvmXqd1eTQmIAQUa66K22jB9/vbKZ8k0y?= =?utf-8?q?Mi86JcPBPkmK8+4narTjuluaHqn1eIaiEMxchkK1DOXr2zqZD5si0WXEcXNLAitcB?= =?utf-8?q?vd3lbvcR9+lnX6VT8Gqgr6wtf0NTygicc3KPHM86GlLKDTg8Uxaxi+IYy0gklLcN1?= =?utf-8?q?RKNeNF+UVsKH0b0kF843vb1Sb7+96HbxEC8j//eS6Oc7fT1ppL+KU2OckzuQ9bKjy?= =?utf-8?q?QbkGvtNS3rBtVmn6hptq88o5KIhWlgYCo9iiVe9V1S8xvEzppwxANyYsT5GWR0SPU?= =?utf-8?q?Q3LFCwsmsGqP?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c6eccb2-f36b-44e4-6689-08db89cf79d6 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:19.9843 (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: IzftlrL+dayb8x4C5+NMUQSSJBChHW4uGfhD2tVFifS8msJgeix7MIp4/JSNudi+nLuWcM/bz0bqJp1jaFrgTQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li Acked-by: Rafael J. Wysocki --- .../intel/int340x_thermal/processor_thermal_device_pci.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c index 0d1e98007270..ee766904b314 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c @@ -258,13 +258,10 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_ irq_flag = IRQF_SHARED; irq = pci_irq_vector(pdev, 0); - ret = devm_request_threaded_irq(&pdev->dev, irq, - proc_thermal_irq_handler, NULL, - irq_flag, KBUILD_MODNAME, pci_info); - if (ret) { - dev_err(&pdev->dev, "Request IRQ %d failed\n", pdev->irq); + ret = devm_request_threaded_irq_probe(&pdev->dev, irq, proc_thermal_irq_handler, + NULL, irq_flag, KBUILD_MODNAME, pci_info, NULL); + if (ret) goto err_free_vectors; - } ret = thermal_zone_device_enable(pci_info->tzone); if (ret) From patchwork Fri Jul 21 09:46:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 705172 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 B53E3C0015E for ; Fri, 21 Jul 2023 09:50:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231955AbjGUJt7 (ORCPT ); Fri, 21 Jul 2023 05:49:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231962AbjGUJtY (ORCPT ); Fri, 21 Jul 2023 05:49:24 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2119.outbound.protection.outlook.com [40.107.215.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A30FB3C15; Fri, 21 Jul 2023 02:48:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T2Bu2rAg8A/6NkmmK9oioxIYDuaiRclYMdhO4opH+NweLRn65QlEcVkrr0dLedcH7b9iVTTgtAcEs2vchZE3TLBBFqEcu8AaEpRM8Ji9y1y34sGIn1jZQkmqyDXFfrTSm3H+nj4BOXTkws8lCnmmtwCKPEI5pvAHJhpcJDIm/HZ2BBnDbRw9nGdQ3n1H9GkN3WRmoE0daxjgFZdR+vD1tHw3+OcndLUc1FUSX7lGjG9tlADtwcri3d40I94OfUEJXDelyzckvQk/fUs542eaJUp2rHnakDww5pGCYLFyUyQCTW9Mm65D5GKBAuS+2Rk8ae92uIkVql9rPjHgshRnAg== 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=izFgSNRGswVrvbWqupaMcttliD0G0cUdm7n6fKfxdI8=; b=ND5iQn/zWgbaLBRfWYdwaIVt9yVZIvCqjCcc3yOfKh8DwMHk8dp64ImRWiNTy3uB1+0x1A4i3fGAjM2SDBkD/3hoFxeLQmFGiLNw35er2oEvWipyOwaVzR7+tPPdICBNTnX6lZ88SJ1+/+4gpm3WpM7w63FuNjKKaUiOI7CZjf7Gy2LOhlF8HvstLoq3hCS70NVac2u/5kFYS+TKw65wmmqwWuh+BPNC4FgwZN9X/XUhzNj/MUsDqSMjlXN+sRHgSQ7MxHhphTn7z9odeByPYBU4d7tWgTqjUMyET13qe+jNz7+9m3+WmgPr+Q1yOTC0hJFkFIQAcZaa4dC+DqMZ7Q== 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=izFgSNRGswVrvbWqupaMcttliD0G0cUdm7n6fKfxdI8=; b=K6dNsgHZpXs6I4Z4Pgto0mACUwSiRC7eLCZgLc5JR6J6BPOxGZpluVePxi61HVcQG9yYEXadFNEFnSnf/SjqRvfzSnOlOztS1G37UEzi0r+wGrnA7XlRfoCDSi/YKSniwM+0otsYcx5z1qaC4ZIKz1Gii8D9zglSf7Tiodbu0Hb2xU8woSzH0exjVvy0MxxLkSo5LXtHJekMRVMBQ0JxBb1skR5qpCrNahnbGKWvXRcltCFSPCB8mJZpVeQzOXiEsRjCOcuS0AKzVJKMuTTOcSb352fUVKEWdCMNqgZbmAVxzTJ4Cr4KNV3qGlUCyxoPy0NGb6atCUB21zv+a697yA== 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 KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:22 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:22 +0000 From: Yangtao Li To: Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 11/22] thermal/drivers/exynos: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:30 +0800 Message-Id: <20230721094641.77189-11-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 0357db02-0714-443d-f01a-08db89cf7b79 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: emk92A8G4Bu7gMFUnbodr9nLJUxYzuUwkYSvPoVRUKZRVSUrF7RFdvZg8w4VWtU9malvJcGTc+ept5A63CmlN7yA+9WxgptNquq9B0gEKfXsk0/usS6Wkr6ND9aQXCi1l0suMzQEbuXNsZ2OARQzTApcr+SmDBA1WRkb//kv90u1IYyow3S680DuiaG4jWPY56B2fyHG0bmAoeWUQIlgKOpUxgFH5lsJuUjctNascUnptddBVXvjQ7mi6o9qq4d/tzEqXvijCqcm0H8a+IfPxMY6h4t0v1Bj/A1PeqBRqmSwk2qX7YZ47LretDO7m4lXR8O/URiFgjRj0m+fhqkIjW++iozjIORjF4ChIjUWt1/3GO6GYBP0KFjNDUhcx9RRp6WquHaci7WgPPtvg+tMVLqRSSR5Nub8hgr8x5Mor9vkpc0vhgHCZhPULdage/UO2dr7F6NSLCyMeIHmU+V+3J+7z1zpvbxSgh5BMSTPEt9ITnlS4pA1uccBROC+UD2iNMnZ6015WfjAo+ij2G167rb9kSUC1bDpsTnyuca3OIUAIeH4qV3czn3pvSpUmrpv6F1xaz2q64F9FM7cnEyVMTj6UmqhkAnt/gHUKaZhtcjO8mQwW652Vq2LlyQ2+Wuc 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)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(6666004)(7416002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?3bEQ8q61xVPp5PfNDuVSCnyLsc/l?= =?utf-8?q?yq31CbfnshHuq59sqkBT+qonAwqJZ/7eq7QvgVTjDWXZmjkH0nwejAW2PxT8MHFEV?= =?utf-8?q?hxB5ACBcYi0V/eVY5atkrb3LRVM8FDd672gHIuvM7//4J39AZKjVI2sQ/Pc6ruI4P?= =?utf-8?q?mHQty67csHYAHVwc6S8X3+nkRYrRtFu3Df77R6CVXaR9mH/IxaYgwiIGR3xhHHS+N?= =?utf-8?q?DJB0Q6jU3XJeVRBykXutaEpyFuyxVbuFWGmxQRqFKTsSDVGO798vXLQKNC71sEN8v?= =?utf-8?q?ats+/aLGJBJr3RqLWZ1Tff9ONYuq7GVUjsMy1ERA226d/6+GiQpvl2Bm8tLI7RePX?= =?utf-8?q?xAvf3GpFvUVBstLnZiyBVRVVREBkUopZFneFb3sTu1Ob93pn8OZIuz840Hm5/U47w?= =?utf-8?q?oWhpTfKLhoCJ2WaT8MP+Yf9t/k+JnajHgjVLdSqLtnAXi2h70u4gjfjBT45aH6TSQ?= =?utf-8?q?vF2mZmskZzE266bHZdaQBLvvbwPfCSAMWGsSCpUprdNmxcFJDC5Au0e4SV4U5Y/3V?= =?utf-8?q?M1u6topYhn19L/ZcRBLUKInkq+5Zwks6ihN4CDp2P04iKRlGUWHa6wVWTD9sV8wXA?= =?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KN65AvKXYnXBpsORi5MAOYIBIkR0OVIMCtLqSZ2j1z391R5s8UZTiT03c79?= =?utf-8?q?R8FBMDKFEre4?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0357db02-0714-443d-f01a-08db89cf7b79 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:22.7518 (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: 5EVO4XBOLeE6hIhifWu7A/5dRljc5ycb2D+y3S65tEwJfgHbAjtkuZ+Kskou6Pv4lbiYeUo8SBO+S753utvyBg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li Reviewed-by: Krzysztof Kozlowski --- drivers/thermal/samsung/exynos_tmu.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 45e5c840d130..697d2fbdb1bf 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -1100,12 +1100,11 @@ static int exynos_tmu_probe(struct platform_device *pdev) goto err_sclk; } - ret = devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq, - IRQF_TRIGGER_RISING | IRQF_SHARED, dev_name(&pdev->dev), data); - if (ret) { - dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq); + ret = devm_request_irq_probe(&pdev->dev, data->irq, exynos_tmu_irq, + IRQF_TRIGGER_RISING | IRQF_SHARED, + dev_name(&pdev->dev), data, NULL); + if (ret) goto err_sclk; - } exynos_tmu_control(pdev, true); return 0; From patchwork Fri Jul 21 09:46:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 706014 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 EE4C8EB64DC for ; Fri, 21 Jul 2023 09:49:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231905AbjGUJtV (ORCPT ); Fri, 21 Jul 2023 05:49:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231908AbjGUJsh (ORCPT ); Fri, 21 Jul 2023 05:48:37 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2095.outbound.protection.outlook.com [40.107.215.95]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D0B12D7F; Fri, 21 Jul 2023 02:48:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AAlvYNOHbLRWL8dkY+rxaIkaylhb9PZ+z2o+5wurx8Hv7qgyZ85exdWLRFYlJlBMzSfo2CRljWRJcPPtcM01/0k5ooGQWZYgWrFmuDseiS0yqgzE+tGh638cC+rkHteO34r/CW6FDO4IcyyJpxvXgBEmRdAxNEUyWtAB+Ahe+BXuslLs73VVIKA3n9rUtovnWTqk2nNu2Gws9KVRvbf+Fjv46MXg2kNKzt3eAej1tjWGsnvsF2dEqvaJ1Wp1V67CVvMu6FWwrY5rDWc2Kd8Vc52ADSjAG6ipgqd0cqN4CEi+5MsHIYP+dxNI9kyT05Vx2YzP3iZLGHw3KLMLJ5AjEQ== 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=Q2g69HSmEHuTTYKyKe+Ic9ejjUzfByis+TpAlcnSq4U=; b=kZsKGoO4Q4fhuhAEoJzNR/2PMJROpaBDPllmeHrVDKB7xnrlKInRj+o/BPemzKtYrenwnQORgKjTXPG3hcCpoJ+Al7GVxUVgvLTbIATSpfGY1WbK6/kVxhblsppKUN+oV+52V8BCo1dx/rLqT30J2Gy3si18eSUqhuP6pu6K+Kt383VFHz3ycJ04MYta8Wx9EPyrtkr2CZbuXkp7pBWMdYtK43uExFSXcZp9NTsau+eqU9c3KOHYsTbhbL5ZdMuew0OdubRuJORfAqMYpvT4pmTckcUXHCNIe9R8ivLjLrMhLAFemju2Kv/4pj4Kz5b3RINS5pZ1P4Ry3j39u87Cpw== 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=Q2g69HSmEHuTTYKyKe+Ic9ejjUzfByis+TpAlcnSq4U=; b=YTb6enSVBUaz+anOhpMDaLr+55YqGeXHhuNnCgZ2ki7Db5AOVri/B1zUuBWny/HyRQPFqFnYbM79fzC9cF9FZb0b/z8txIv15AxN4FBXPulcrUYSmTtOBuWXwOrTA2JLImVEGFphBOt5/Pd+btTouoVeV1lVvF6/ngjZTOz51wW3IrH3ETqZwa1ByOa8QurqZoGwVp4//h/q+hb8ZQdXJ1ludefNzqC2lj172wZexfsIwrlkM6FgKBqtpR4qqYlj027rxYbGC8sV3UNzLRRrW4ElVe8dVWospzAFXKrVrFQnTC29BOzAihTVxv/k6kJZDIuluA/8CKVUW6y3o4ydvw== 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 KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:25 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:25 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 12/22] thermal/drivers/hisi: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:31 +0800 Message-Id: <20230721094641.77189-12-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: cb0de5b1-2c60-4176-d00b-08db89cf7cce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A94iBdEAKMIA9jAfumInEJw6Gxgt23CRzdQ8Cenkvwd/do5Y1Y9LG98albR70c0NFvKxNZ4ugQ8pHXnmm7lxEMhxur/8wOjZdNe1VmjAaquXlOmOm1JrlxM/u/YwMI5jt6zv6o2f66D5AHFnQn2efP4WJM3cVyidgdjrEwAl2sc/FqwrsUYc7E/g2swqku2YUbafxxrNA+3s8TLkFgImFBfDJuqEYh7N7nwgDs/b7tuOj98Gpv6OF5BxHg6V9CkfInG3+OmYQVOKdL9YJpiWvBHloz+cs6lPGh2eQ0MOFbtxQkUaAEClR9K89qh8pez6UW9axK+Y5n2fojjKCdKFX80jJZEVgK2FKInQneqdPHZzdPBl+SSLLKmFIIcD4/SztxX8wCkDokm29EZu1CtFoQrScwArYSz4Uyo4tb4fR+M4bk2LskLhxnBkYQ8M9BOluWKOemiiLVZjNpOcX9Qy8ExBBj+O/XNgtY967FWPZDQUK5xs37sV9p0LhDn9r8eGYN7GWEJXR3UyiYxuaAmj/V1J0tDQOHoOhBEVnxuTkK82G1zFk9s89KqnDgabH2Owevb2ffvdpA/SHZmybtMa6JebAsAhpT6/t4uz2syaOIvFD7TZNw4qrhibjRtRLo5T 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)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(6666004)(7416002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?pGKIrrhK+MC+k/RXR4YyS7KDDxYY?= =?utf-8?q?TnmfgF624DFw1fDl45gHEF2InPoQf8WWH8i9WXF2zlUDxGemxjakILE1UZnLVN2+6?= =?utf-8?q?hEtFqYOfccvQplakcIDN9jA+hH87XJbQx10uDL289eb/kUdG3NxEiZR1bOLENKtbV?= =?utf-8?q?eN2TqpSJHvaatxbo+a6MdGSS4E9ilfotwwcLAG27jepLYifNrpaGc3xZxtYVYBdLL?= =?utf-8?q?hRRBpuy55HgCahw7GIWCyQ96lypFyeD4I352VQ/0r0DpeJ1vkGr/OoTpcdXB+26qH?= =?utf-8?q?dz5KlEGK8gM0+jsf5lV8ZOj/bMxTipgJWDd9Mak8IBb+/zvvAHNYAPmdzEqv18RX+?= =?utf-8?q?UPfcB1JxZsaJJ6XR+foSvtcE/ZiXDcUGJS65+tZAGFuRF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LDhZU/d9?= =?utf-8?q?dmqNfn9xj+yxR4THMRwdg158T2jvHDcLH05+ThFnNx95kAyh3nWeYCJQvoJAVwidn?= =?utf-8?q?E4iqWq0pmoAUXBcXzbUqPWCZudkWgrGCDnF4+1A0NoUodgpw5CyVbviNRNWr1IWAi?= =?utf-8?q?//LDu8ltUAO8zLXM8a3d0JJWcPQDQrl0tj6pJ6cOEVWu9itOwzxsMfcM8Y3bTvq9H?= =?utf-8?q?3Zt3dxfHf3y4o65HCXCabvK5QvfLs/BqQ8MTwi8LUG8CxnKjQnEbpO8plqJx9szzg?= =?utf-8?q?ISLrcqNlt3gT?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb0de5b1-2c60-4176-d00b-08db89cf7cce X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:24.9605 (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: z7S/F4KsXjcZwEmXyB3eJXKExHfOhS+U8UsY7mMnYWZqkejnM8pEXBTfvZGUJTFBwspFpOjjBIu9xhIs05xw1g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li --- drivers/thermal/hisi_thermal.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 3f09ef8be41a..ee5f50fb2b68 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -576,14 +576,12 @@ static int hisi_thermal_probe(struct platform_device *pdev) if (ret < 0) return ret; - ret = devm_request_threaded_irq(dev, ret, NULL, - hisi_thermal_alarm_irq_thread, - IRQF_ONESHOT, sensor->irq_name, - sensor); - if (ret < 0) { - dev_err(dev, "Failed to request alarm irq: %d\n", ret); + ret = devm_request_threaded_irq_probe(dev, ret, NULL, + hisi_thermal_alarm_irq_thread, + IRQF_ONESHOT, sensor->irq_name, + sensor, "alarm"); + if (ret < 0) return ret; - } ret = data->ops->enable_sensor(sensor); if (ret) { From patchwork Fri Jul 21 09:46:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 706013 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 52C57EB64DD for ; Fri, 21 Jul 2023 09:49:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231969AbjGUJtm (ORCPT ); Fri, 21 Jul 2023 05:49:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231842AbjGUJsy (ORCPT ); Fri, 21 Jul 2023 05:48:54 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2112.outbound.protection.outlook.com [40.107.215.112]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B05343AAD; Fri, 21 Jul 2023 02:48:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KnbokOjhOVtCzeTlxV/MiMVcrCx6WzlGT6gdTYl0h5PGmxdNB0sXlYn50aksdYEXZ8H3MndA3E9MmdDaYHRfJqZgY4SJNjjZmR1xji95d58IE9MPpADbQCkLIGOnjx5nIHIa6I9gjSjIueF8S1PA0fQCypxyXAp9x4eFrsX47x+43eWimc/tqsydCb5DseU2XT5YM21YiXzpQfROxFyQ+BSQBDMN8S1bVgI8jz8IJdGpTyY95bk2Glj+6C+EBOeuywiGj2q6O8a/n2tV9u2djp5ZSLd5agOsDEfdEzCN3mhp9snHD99s0F0XCo2f2sQQHC9Vf0/03QYx3DaB307kWg== 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=N03nusCUS3siQa14uFSaE/KiicaLWmrEtJVE7dkAQQg=; b=LrAHWHmEeSNXRkuD4wRPGMHsqFDa//bxSNhCqQgPah9G9LuIVRU6wSvSOx1Nn5B/5ErYkFGTL9T6jGLUJdemaSyG2hrMg8rTa7oSVktYQaKpwshkvfgaI4GVD7lIiu4aKAEB1slNkW+F/cMOhBgq9xg6s2tdu5x8yLhQl597RMzbgyzDcULqzvpyZqOnc1zCucuFYpux+3xL/aoUAzbADH3GMN14Oa1ey8W0CAdiOEJlXf3az3Syx1f7fWxK2Q485C9d7/JOXI590k4beTtGBTSwuk/5bXIVqYzDnmRWVY+k7wYMd6etC8QvHDcrmoH7qwWGFlRD+8b55DyXJBv63w== 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=N03nusCUS3siQa14uFSaE/KiicaLWmrEtJVE7dkAQQg=; b=YmBKuiCviNQBuNCuzg+QTbpGCyUE+jyOIL7F3SS1ND8w3sLMMSRppFhQj3s+OfekMjh0oY0e8tpzA9/Yrif8DwJKM3wUSaudAVvj2yB6LEBZMNX9Y6/TCq1nkhksI0am6utH8ns0wRZCQ2x2C5Ff4PLP1V6+dPQzk0yA9uPVUknR3KpvNs8HK0MamPYtKiHKInZ3GVzV8em+c/g89nyxmx7V4cEmCX76r6RGWwbLrj3tV25M1QyyfyB1D8rk7khbbhEccIDWOhqxX+QKB9GosnLERamGomXYO16afyY44C1MlaUwfSVBM2NbV9cjC0SjUylPfdzqrQ6u6ecWo06uKA== 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 KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:27 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:27 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Heiko Stuebner Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 13/22] thermal/drivers/rockchip: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:32 +0800 Message-Id: <20230721094641.77189-13-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 48502543-e9ab-4a7f-0f0f-08db89cf7e45 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ukcEb0DILkyCxXqQHdNv7ekvSDDN/IrjTYQ6bMeJpKOdrfo8Fsk3R21A9yayXa6DM8Cgcwne+5rOH2Hk0jVOISLDX+MjssZ+416rtntKXsRVn+SFU8lHmT+gnMrh6cfa/7A1az7SDuEcbMTOBUyWu2gsmCEuB6D3+9PQ8LQRhaQ4/cglfnSfB9GOuh8P1RkxH0NbDa/76cVmPbqlJinrLysZN1sv+4aSyOVtWcYSmjbgfiv5al1AcnEiQ8JjZGsg5NddfDyacN3/VxR7Ud0J2wD+SdBA/abrOJpV3k9Q5+CR8r1zUrQBuo2IjWsaaAKWKxZjfF8KkFpEJay2J830Uvlgj9rpGbMvgukRKmBeHVBltVgzE3wRz7TJWfAeO5p5HV7+3p/BJeyr6PrJAaJx2vYuvXNFtef9iLDlRy2xOMG4M59BeXqVpJ9UuKMuWNmFagwnIKgPZ8UMlVvMjaGLlZMhqh/5XDjNplzCT9hR6GrMT/LpX26zvPFkYwYZ3fNceS6e7LHSGbwNcMYNRqNEWR6iKv+4VNoNqlLiqevBClkPhzUgGyIUqQWzE8XayPPNSBr14gPBSh4QqRm0UcKBPJVSS/Qd9Sl0Db6OvHapsDR0vDuAIAdZnF+HDDuk9Vd/ 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)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(6666004)(7416002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?QcpomNZZEPC3zGuzBEjUgBAvbOg9?= =?utf-8?q?HtFcGhK97/PwXViQ1sbJ7dT8n1lBpFckkUapW2bs00a1dQc/StuQ9ihHefUgdR7t5?= =?utf-8?q?Eyastexp+8WGjW5GTV+c/0JcnEnNNCj7D1Fv02qUa8xDH23MPLOkxcZ4tLGrMfWbs?= =?utf-8?q?nOni3D807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FNRMhsgXXOuKusMr2V+2yPgWiD39uRAOxO/TEk9c9riJ6WRY1XOAKuEd8OyXI?= =?utf-8?q?3nIooqPcvytqJV86Cp0NsitQdeXBliqFDymn/0xvgkPt/81L+qA6ORjbZO8weqALy?= =?utf-8?q?KHCh4vB/7Tg/jJr3zltZAfvf2ZmZZBPiMHqT0uBfBVDkglNcJfCb0tDFhRvG3BPVO?= =?utf-8?q?4D4Cj+YxnxkvYxpg6YRq3+HQtrcPygN3Otm6IpE2dT+D1NODYDbZh4blJVed/lKKg?= =?utf-8?q?FXKqAGFvzd2EjabNWCAfZgbfO5v+l1Rno9PJfuqY/6Ubk1DlrlSkg2GQgd8GL11TX?= =?utf-8?q?/d7W12A0HhikrYJQyCvRTwx+7UniIHnqjdhzGU/Tv1pNEok3KuLMTNO7brkgvXB08?= =?utf-8?q?dg/G7Xhi/QxESlcd42A8smVbCMc5vhcFggDbLedF4ac7zarW201xXI14t6gwQnkPl?= =?utf-8?q?pQkSdMDbNXqlNyBQtOtUNU/nJa7CCSJNfshHF/x8YKOL+FQj6DBQ3UjR7X1GNrhkb?= =?utf-8?q?lfcry1zTNR3T?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 48502543-e9ab-4a7f-0f0f-08db89cf7e45 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:27.4223 (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: 98HfIkJnvUzbfPH/v6gTYOVZQe3WuIa3X3f84vvDHhlKY925sYAuXfUsOSZdLQXXVot0RLeLfsFL1rbwny6f0g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li Acked-by: Heiko Stuebner --- drivers/thermal/rockchip_thermal.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index 77231a9d28ff..11061f6ef323 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -1577,13 +1577,12 @@ static int rockchip_thermal_probe(struct platform_device *pdev) "failed to register sensor[%d].\n", i); } - error = devm_request_threaded_irq(&pdev->dev, irq, NULL, - &rockchip_thermal_alarm_irq_thread, - IRQF_ONESHOT, - "rockchip_thermal", thermal); + error = devm_request_threaded_irq_probe(&pdev->dev, irq, NULL, + &rockchip_thermal_alarm_irq_thread, + IRQF_ONESHOT, + "rockchip_thermal", thermal, "tsadc"); if (error) - return dev_err_probe(&pdev->dev, error, - "failed to request tsadc irq.\n"); + return error; thermal->chip->control(thermal->regs, true); From patchwork Fri Jul 21 09:46:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 706012 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 3B903EB64DD for ; Fri, 21 Jul 2023 09:50:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231920AbjGUJuB (ORCPT ); Fri, 21 Jul 2023 05:50:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231922AbjGUJtZ (ORCPT ); Fri, 21 Jul 2023 05:49:25 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2095.outbound.protection.outlook.com [40.107.215.95]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1415D3C16; Fri, 21 Jul 2023 02:48:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kPFvUYegnG5ozoxKyBEMTaD9W/enVEZu5/0zXSHGktpLCTch4I/tCcYbhnPSdvEkKKZYsfcnwn/NfY3LQ91AkNnTsveje9Ljff9RtWmY//J/yMe/yTVtu9gYx80tWBnekuTw+rpefJE2ZeTBw79HJgrP9a30r5Lrg8vqMRLcs0/rKYbPJed2mntGI8dDPNLjfvLozTMpomjaAdI93laepATwKcpghbfMhMykC46Ep9OskhnPScRGLzuyCQhn884R+0jao/oasrH4a6P2cx5wQamj0EoCBxWyVcj6z/RX37VaT0aw+g9VZBw0LZpac3ups/npq5ItoDegC+ygdkOgkw== 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=pvlUx4SI67RgVseXdZyvUk2DPAtSbRfR6U4Mi2B03kI=; b=MuZwVfKqCT4z/Dg2qluTfZQxB+P7Kw2gd4Krq0MYRgEc3sa3HQmFfKl7XrO4OVA+/zfPl4X2qG4vnL/4c6IalBko6SniPLH6djqEupUUHCc7bk2ppBYdu2q+UWxBpt1ZZgOA1jknGFqQ4JdyDm0pJ530hogXNsRkq0oea2Dy81HDr792e8elN8+Ovy8whLsd2dg2TAT2QRBEHsTyJYpU03oUFPDuNIxldNJPd8Vslg3SPqdq2GCDRUqpTq3FS4lIQMhwox1e18flwfM1m0SjcmQK1tr/TdoaPm7s2Op80nPZMG0pZV6sjRM0aAWlhB8ThxGKBRPbxMlexnrEb6wW7A== 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=pvlUx4SI67RgVseXdZyvUk2DPAtSbRfR6U4Mi2B03kI=; b=UO3AkBA8A7TeezaYOAAsCt4TPkTigpciotg0Fq9ZWryUvjHvVqYiN712Cs6FWCLpEujeFXlIpUyZYbwa0TAZJ62mf/UEjuyTRZG3Iho0uxH718K/oF5nVoP+Wl5PfUkgnDJa/C5WTkg4RrFF7bc0c6ztUZZlP3PlLSOQXAa8z6bpAV9gItLS/qijLjQfCDHMeambaf+IGwDTYydSZ/Z2HEY/PFnfzzxkSWzen3Rd+5+/SHg2tspJh9eLORljVwpMmV+hqEjdQqV5eLGCccBEbBtJtGny8OQTomnF53pOQjwCP9rCTNSRKeP7dTxYuJYjh2EjEfMN30vs2YIQH0PlgQ== 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 KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:29 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:29 +0000 From: Yangtao Li To: =?utf-8?q?Niklas_S=C3=B6derlund?= , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , Geert Uytterhoeven , linux-renesas-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 14/22] drivers/thermal/rcar_gen3_thermal: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:33 +0800 Message-Id: <20230721094641.77189-14-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: ef273c35-cf6d-42e4-ec06-08db89cf7fb8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bbklQOWFMHFTb+hMH0tsGtZSvFKEPRSkYo5sonnhbJw9ZuiWUuR2TPTwwRycjNR9gUOj29SyOfz42yMpCtTSavosMfpRu67Ctc+YrCBCMOESsPsiOY6A6ujKM6PafSiXtwYC0vEoC0x34NWFq2N1lM6FKJouFE4WsV6JMaaHHbpKkMoHNRKw107AlbpPKFq/3dGL2CTu+XWiOYquJuP6VB4RFrQaKCH6gA2y+KzDs9PyLbNPvNnkdR5akFv9VwlNSjgHuzSvefE615cIH+ZsA++86TueqAc4et0JX756MnR7v+EwbW7CgIx8yZXneHD3kIuapUHAyUrcSRgV6+p5g3AQROObceXBnT63WJwyoOSnaISK7D29sw1xeWmmCqPmVyEFWWE6i1Cel0umBPE0Qzq+G06r0XHgWdYwgm/zCXCWjEg0QFxnpmV+NOMAO2gK4BHonm9ujjX32K+IehIE9E+t763WEERYFjVhNWU7Z4xHNO/RJAWzzyyy0X+c3kydQ0I8CRFo6YRal8Lhk3OPaPE1vXKosKveBpBSX4BUvPfMaJnq5HygkkM24Z8zSveV/g3NhYad/eKW7xM32z+adSyYeu2N+Cxmneif8L4jq+PNon/+HVYZz0aBhPNEt2ax 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)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(6666004)(7416002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?stpRONE1nuHggfB5b3QvnBC8Kz8z?= =?utf-8?q?SP3Nl0z+ihD2bxvOS9t8xlYglik12Yx7KXhhJdmjPWqmp+vGrp01Er7IAIGuW2EaN?= =?utf-8?q?puurNDO8BnHp3q5eLP3h0VW1MqYu8ASIW+w6L0XGsySbfkCp2GKQZhrwHZ9oATKvm?= =?utf-8?q?8P6WquYlzuXs58g7M61Br5E2pnzW3S4GkURpa7RjxrSrHIo3Cfu2koX/zjyyLr7Fg?= =?utf-8?q?YEKBecYqHIRjvi8zJ0aQHifv3IpBM1F+EZYRuPIlRgzBH6lpZabJKr1ognR8JqUjc?= =?utf-8?q?iCtAoZQuX6dOJ+FQbONElsPNDF/noOsOgBJdQTa7lPIcaVfpOcZK7USttTXJC0Uhm?= =?utf-8?q?y54fTyaBIVQrm3R8nbhVKeHcQaE225yJzVY3LuBK+VEYoboLaV6gEzSEJc1IGZ3T0?= =?utf-8?q?g3EOseSfMd6mG+A80yjNl7fYrRfoMJGDQRwoY2+lDSyscwyHeJ1lQanACUAXg5Iph?= =?utf-8?q?ja/gxtahk33uzlWEhELGlsVpfkmytUwaVmL61mqkmteRK//m7UKFgS0n7DauMF8qy?= =?utf-8?q?pzirIQQUNmnT3rGnv56m3XnXY96WzwQxputBf3G2d9E56Av1NLRUOthmUAelq8BkU?= =?utf-8?q?+ckMNhn26y8V69rYaoSEBvZqhOafGcgsLQwYlgUIK0DVSD/h5d/FLkIyZKN6b/zyq?= =?utf-8?q?TjbcAkZe0xvLqKhq8EyfAZUVRc9GIfX+0rmbVF6CdZ5qY0nysJl8QSysfIK9AcUDi?= =?utf-8?q?8QmGkvbMPjqXlNFJYAjX2Ff8r3JMS4fqtX6kgetXEOJue5wPbVY4SIRiD4prGF+BZ?= =?utf-8?q?Y2uevO8+GPyVUGc9zY7kcECFT9HW4vGFokyFUXQosz2ZKjtvqz6/BRJL+KUPjQzFi?= =?utf-8?q?e1CCoAjc6EP4jRiGzKTF3Ma0mOF69uv3dCHSyb7UT11b7m3rjLLCXsh7V+3NrQbyC?= =?utf-8?q?Ly3kf6560t49I2YvxG5wovjKfoa3v9CR92ULAqtcQBJkt1ois4aVhJ/0foIgwNY9q?= =?utf-8?q?uNEt1707Pe33kPhnF3MAgNyOGj9NfM20nU5KKm/A4Mkjas7f8QJiGBS1TJnfHrHY5?= =?utf-8?q?AZg7K8CA4K0RU9CxFntp3OSfD2OqR2EiRNLZniIawVutge7pQtxmLUQ7yBwmWRTze?= =?utf-8?q?YFHPYT37PNwTghwrW/lbDwsoDEi6f7gTYunMYo2PiJaIZzeaohQHbgQcKecznJ+cr?= =?utf-8?q?gjR5pZz1IM3i1zVj52BdsFbAEhZ7HR0dJsvPEwlKvV5HPHbg4qAXqybKWS5rPHnN3?= =?utf-8?q?PqD4PXGx+2673Grt9hljspW4AZev7Rko02feBppMZgsOyFH34/ae87VVRJVFrcVXP?= =?utf-8?q?w7qXABjyBREDbV5Dq9s/xM3ayUwGMCMMUBFZRYfnebkykPMoAPZSxfZBtKmWPNe69?= =?utf-8?q?24nSh1NjiefQvN66zgGDyvqE3nC6BJ5kIpTIgqfDa3I10hEoQ30xlHCzn+gKwV7k6?= =?utf-8?q?pquZOqAerIN4kJMfn3zpoAS0b4NQ/XLSujKMeL7LezUkHk/XIcXu2AM/XmqsZ4BVH?= =?utf-8?q?4zzlJGhHcUwmGOsjvrbXP7hVWeI8DUe7/TtQ3MDPZQsGo7B9jYPObygvzD4gcHzaK?= =?utf-8?q?brXwgqiMannZ?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef273c35-cf6d-42e4-ec06-08db89cf7fb8 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:29.8570 (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: xGN7Hd2CeDPR3JKR1SDX9PyDx0WOrRiiLZ//Hm4HWjfYNb63aNGFnyF9adEK6lJLNtqb+L4NI10DCXBA0TJ5pQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li Reviewed-by: Geert Uytterhoeven --- drivers/thermal/rcar_gen3_thermal.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c index 9029d01e029b..ff9cd43e1881 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -467,9 +467,10 @@ static int rcar_gen3_thermal_request_irqs(struct rcar_gen3_thermal_priv *priv, if (!irqname) return -ENOMEM; - ret = devm_request_threaded_irq(dev, irq, NULL, - rcar_gen3_thermal_irq, - IRQF_ONESHOT, irqname, priv); + ret = devm_request_threaded_irq_probe(dev, irq, NULL, + rcar_gen3_thermal_irq, + IRQF_ONESHOT, irqname, + priv, NULL); if (ret) return ret; } From patchwork Fri Jul 21 09:46:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 705170 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 1728CEB64DC for ; Fri, 21 Jul 2023 09:50:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231892AbjGUJue (ORCPT ); Fri, 21 Jul 2023 05:50:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231890AbjGUJtz (ORCPT ); Fri, 21 Jul 2023 05:49:55 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2112.outbound.protection.outlook.com [40.107.215.112]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 429AE3C3F; Fri, 21 Jul 2023 02:48:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N+lVj+3eWb+bFCcTtJGts6pIaz8UCVsGW2cV4r4z66wXOvV8kwujLa4OG6QjihqMCg84zxeVq7RpChisu6uwc6w7/GxaOIzBk/lWgHH0amIc9HD6TJEuGx2YRcZIbPhoFxXdXxV/Oo3nJYFpjVjqVTNalaw/tf3pqTAdofwZGFwKSQ+DPpS705GI1uYPGYGFFYw7sqKo9EafoYU2Dxa++hTJbbtnbUlWJRcTQ/2UMsjiYdTLKak2DGTWIihKN91mYfMD4pON4nEuYWswF9orHBnJoDtp9qNtrUGnSBayYB6Pj3VRENcIGYeT4v44dnGX0hkF70NeUs4vRCoyke2BRw== 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=MeiyD3bTqLrfzoM7xfEdmd/j0Zm3deDKudXtSJLhE+I=; b=WCpqD2AEpT8/3olPfwTv5xk6ScKgb5hubI2/D5DTPM9X/hts5vp6CiuFxer+axzVVBKvBER3UCOJWSSX+eCMaZpUouzeryb+TL5XYIHXl/1EVLoN8SNkksQcqVzaVJJQdkhQREmpapbbfCwd0vJqWLBNZdjEoAWliAWJfmlaRyIpamxgZcMalHfzsGXAO2MDJSH/5SRVSXP4VxfC2xPLPUeXRiaAFLWzDW5XMoTx7GBecM5EihfBI5Lx3E/dHYSpaQyviqtk3B5G+cMRmF6aJORHyYvPoz3yCZ0h+uCT7LGRNFtT8wqALvhHZg8Av+pwOh5N1TPLiV2URyMoRMXU+Q== 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=MeiyD3bTqLrfzoM7xfEdmd/j0Zm3deDKudXtSJLhE+I=; b=nRJX5RyMKvOloZaQkT9IEwsGRUR+ybLYByRN+fBaBtxjuoHil+hXmT3eMWSBYM+/D0AK+szA6eschxIU6MW/cBzP1xgfEzFoUQR5aROrycb5nrP/RhRp4Ktjdl5ELrB1vYj6IwwLBc3N1IRPBTVfSAUmuru7LcJoCT4QlLOsnKPRVPRHqDfXmyGhwp4ttCGj12gx+OXGdZq/xHT7gOn1BvEsGdX+vL/g+bEF1EA+ADCJJD8LcWsF8RNHyKgn6h74STBNYgw+dE6gcTGsVEIFHwxzNBuluPz2YPKDNbW7wjTpdXZAqkngMluKHXV3iV8RvBUB4q06GABgXcTcj9r0vw== 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 KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:32 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:32 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Matthias Brugger , AngeloGioacchino Del Regno Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v5 15/22] thermal/drivers/mediatek/lvts_thermal: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:34 +0800 Message-Id: <20230721094641.77189-15-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 7d904bc8-9024-4a37-107c-08db89cf8179 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t015E/Zo7+fHIPTgrQeNUiz6oINhAOxuanpCEG12+n3L75kBoK1fbHoh8fPKZI86I2iPRcVjV0aRHUd4YUCmcXgLbmBmyatqGBfW17z0wlpW/lbq/vdNpFspZklKY7WzpsOa38fwrQZTNlg+24RvxhY3tF0PlRbd/3O0uk6Mtdx+ZI0XOKgc8Khzuz52zEQZJesncrP4dW3rmQAIbF+Lhit5XdbF27HFyUlgqZcDugpSulK9kSg/i1OIWU6nVGkf87ZEFcZ1rkQdxFmqGirW+XWYZA5tqttzF77WZWrENZtkDGKN+CtN/IJbDi9WLNUZTT+DObULU32/lwam5TDS/TzIRtZQb7bz9BX735zN7VXNpMgL0SmNXBheOuFVSCDIg3vjsHwoqKV/epQf+LZj6An35gbOYQ/w+a3LPcF4YORwjnOAP1Oqh9hqtPlYt8rbrekZyEyV1MKz/X0PO1SPYmgNqLQoBIO6zwZE+3G8BYV7pyZEEUjNj52/Q7PjKKRzvuCMjPwexdrjnxyqf+5hxwb9D9Seh92qgXJdtPnTyMmMxfeqPgHAa4DnsHT1a1OhXN+wwkIJWIrlfOYsjID+f2t1kMUr2IVr7InhhLbiNasVMtTdISrDHPgHm1fhQ9cm 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)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(7416002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?G3huFiEpbDUEDqdsJm3YdmUpaqAc?= =?utf-8?q?SNzbb0a0PGlOKVNyInplVUqoWUpd5QJkup+QFqmtDrG+A4L8KKRaMRik541NeGUK9?= =?utf-8?q?QM8mNb/tt5DbcpFL7YA+rr+rIe1cdSMljYlC4jdoptnG26+LdRt6QFovxstSnv1yZ?= =?utf-8?q?nm8xl/sOuMtBtj5GOJbNJPsjDiwXse2hDb75aO0XLNsPeZH/zoI9hY4RQ7ncZLeDP?= =?utf-8?q?BpllTu7S06zu1SLmfu6jq/7EghfVvDl+tOTzfQ6P0Dety/zyNBpLanxB1ZDKcTyBH?= =?utf-8?q?eoYPZTa/0ZaHNgewIK8XQM+hqYaFuHiwAKvoeYE8KCy3FcP3w2TNbrv+GYnHnprU8?= =?utf-8?q?PGYoNScdUHQHiY8YSl+uxXmUKXdC18WK8zkeWo94f9VkVUS3GpWhyY2kWJM1KPTPp?= =?utf-8?q?X7DLyb7MQiJnq7aQ3a9knILE96djpGDIGRGurwfuWBFQuRhh6fvYAaN6AYEbfTX2V?= =?utf-8?q?a7kkwqld8Xoyx4es46d1Ohbgw9ML4YDzu36xW6Yf5B88/WlSn6tDtVgYDeGF8SaaU?= =?utf-8?q?09C+RiVtusC5wQOBYVhJPevLneBxXZ/FWMTSJhJ5ls/95etSQRJKnA/dZWQeSKIN8?= =?utf-8?q?EPMBfa7xUx4fY7zl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ESffQhlgKzqZL4VCcNOuJjqawIYLzwpl8T5gkpjKVqFPlNKLSAzOkX?= =?utf-8?q?J4mJDe4TuHC0?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d904bc8-9024-4a37-107c-08db89cf8179 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:32.8010 (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: iTvBotaaKSb/ON42nH/mgAJX+8h/eVhrzkoDGf+xjt2N8yJI/UorZQbPb/ITZlLEPRRcww4xieqye/X4yakTUw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li Reviewed-by: AngeloGioacchino Del Regno --- drivers/thermal/mediatek/lvts_thermal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c index b693fac2d677..1e12410820df 100644 --- a/drivers/thermal/mediatek/lvts_thermal.c +++ b/drivers/thermal/mediatek/lvts_thermal.c @@ -1148,10 +1148,10 @@ static int lvts_probe(struct platform_device *pdev) * At this point the LVTS is initialized and enabled. We can * safely enable the interrupt. */ - ret = devm_request_threaded_irq(dev, irq, NULL, lvts_irq_handler, - IRQF_ONESHOT, dev_name(dev), lvts_td); + ret = devm_request_threaded_irq_probe(dev, irq, NULL, lvts_irq_handler, + IRQF_ONESHOT, dev_name(dev), lvts_td, NULL); if (ret) - return dev_err_probe(dev, ret, "Failed to request interrupt\n"); + return ret; platform_set_drvdata(pdev, lvts_td); From patchwork Fri Jul 21 09:46:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 706010 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 D1A6EEB64DC for ; Fri, 21 Jul 2023 09:50:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231981AbjGUJur (ORCPT ); Fri, 21 Jul 2023 05:50:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231822AbjGUJuS (ORCPT ); Fri, 21 Jul 2023 05:50:18 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2119.outbound.protection.outlook.com [40.107.215.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EC844220; Fri, 21 Jul 2023 02:49:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J43RpKt4DRzZ7yOxVN9y3MgwYBWFbX2tH8eAl/7XdwNMzjTpgCC4EICZVVDnNU2qk4mZKf8Jw60FR+dubR6MUPlkklnSpsyDlCxBdbaq9hkSmlsWCxGjC4CcWbW1ClEjDMw6i8y13xuyzRb5VTWG8FmTBb3bOPIodkdvYPOpQn3FRdufbj8qefUauAbkGFyNVys6lOqWow9Lv5IOgHlSSKYA5OEDSfMZOKkW7CSygMXkdrVwUsxhjzZuvnXMtJ/7yrft0rPvKY0Ws481XQTIZlpGIXriIjlzOhjsG403wCcvv7pQhPZn+5ZWAtsFtkbRT3ZA1spIJoncfnuWGKkplw== 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=f4bfb4yk8VVql8CBIboaJds/47jikygD97Ynoj6D92M=; b=bZo1qAAcMO6KhjoLfNW/o9Oj1skYQ/Akx/kw5pFjTxFWnsI5YKh8vEMMWCiRMfp/US7727c+U+WViK2TKwDzf5iweYZcwNqbao2Krls+M1hRCd5fdingjLjgrNNWdrkEOJeb8Q/cNnROJDpLbyuocxbLRefrHbHEXtsjKQUQDye19cqTHv8UntPH/xP1BgAm4lykfGOfxzdLcO2WcIEeRLOPUnoX4rAhJbazwio0ukrchiG87DBzFKWBg1bfVbxKJyQ3e57OF0EI0dBWnmLlY6MdYtRpQFgKeT0R+BjSYb7M93FWCPERxVMpB6QuRWt4TmudRT7bhna7VJCMpU/r/A== 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=f4bfb4yk8VVql8CBIboaJds/47jikygD97Ynoj6D92M=; b=dnnKKBLOvkjihUG90bDE71v/OBJS0X566qXj11vWSsMEnnUfPo36m7VEixLFmq12OsblsyGelu9dnjVp99ujhSM+W3SVY+P2wlZ+gZNk6VX6Rc5+FgOQKp2KuRvkcGQ2pNba6AaxR3N3x6YcmHNOGeIjR8J8iKWcznoiABqco5y7Dlu2yMAr1kWhe/Vj1T43p2iSy3I9IFTQGdN+X0hw98kpCxw4H50xJxxmik0tkn2Xmr+c4NrllWji3sRHaVLFLK0xmiU0W38oexps7uXwXZxH5eg57Xc1TksW+OQ1wNu4aUTiPZduxjCe92BrF3TqvuQPXNHGvse6s11iRbzxGA== 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 KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:35 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:34 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 16/22] thermal: max77620: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:35 +0800 Message-Id: <20230721094641.77189-16-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 54eaae52-7f4b-4efc-0536-08db89cf82c2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mrjw952keaR9LHfNm1FjYtJ2bgUpy/RDKZ5P75vKFScAmbDLZN7IpooC+JoSdBORrvV2jci8jsZHj/uCno7dZ0F4NeYb2DiP03hOtkvPgkdbBCTjT5l8gTxxTbOiwiV41Ve6XCErYqjDFabQo/MwUEl1ISPWpLkv0dyE1/uU1enmg9k/MglS0q+wpRyGpnRBBwfP6enDlAz/kYCiPlHyDwfRkF+c0Yqw3VnklvYUJqKOyZynwU6sh3oZ8xr6lqClaiHkUM1XxgBY9oAA8SO8Y54CmbX7t8p7sBmteWAh6UGDHqs2hVNCLl3zZfA/enNpEJ+2EGJeHFtCQR5lOUln4CjTQ9he4bC5V+n4matfRVxswm7UKXuyJzX2YE3qDoBeiqWWv8GFuEfu7hWZXzcM6A0vC7/TzBSvZSA0VAee+DB9g5H+nYZJDOemHX3VOPAZy+bHS+FJswgae1VxCqdKwQ6BJhez1Tkoj9DqSOSicqEX39jG2MBFGuZ6Sc2rQLPQjM28JcBhmdWjZVOy3q530OYWldsUB2BsWBYPUWs4vCZc35UAHVB/HDCdy4pqpeHU/eOYACsKMwQHUo4G6W2lXiCmTruk5BxwzD/iAd+NpaXfOjjzP00v9bN7yRu3D2L+ 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)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(7416002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?6SHKl2amuMQC0zaHdHkMS0WGCZ/E?= =?utf-8?q?dqaqC5wAvPCo9ZglKMXN0yl+TCnC0+wxme2VE7Mep+hG+E3JB+F/klMfjRvBMaCt1?= =?utf-8?q?jME96BGgebzH6g8ZDxV35yUbGndvhKgEop+8FFbFnpKzp0s3G1PNMh739rXiRVi9T?= =?utf-8?q?91pPzEBx9Z9Mo0YgLBmzU0q4/kQ2l9PASymGCJIPgTWCtqfvTCohDgwAPsMdSG48/?= =?utf-8?q?9bFaiWK97w8mjck+mGmjdlFMW4NrXDC95Fz8VleJ+FryizysBn1GOPbemnqROhnt8?= =?utf-8?q?qXisi1lnvUZoxd5Usob5SkkfumYftNOSUVt2LdzydJq/3IkyIopU8RDxHuNH7f7A2?= =?utf-8?q?h7H1ZOdqZiTDI2AGDwjinYmV/utqW8IiBjbrhTe14Suh22kJbkHauJujRycyIAOv2?= =?utf-8?q?kLRspJCRJYfXBwuw5RFk2uBqMJLvRQb24a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MMpxrOoa/7S5VL/hOlf/d127OV6H?= =?utf-8?q?qW1s0kQcb2A2rQt3FZvkpLhX6iDekbo4XMowjjWhwya/vdSndQlunw21skmFkt461?= =?utf-8?q?o9gDWwo8MnqUclg1uJlKknbA9OewNKklvJL7HpGN3ViMWEjmvDmqIX3+LEp3cMtmv?= =?utf-8?q?b2swWKVg9Ik6nhrAPZMj30c6t+p2D4lb2Wt3OCWvE9id2+eaS9hMRUqoPwrRr/vZZ?= =?utf-8?q?y2qyBeyK5jrL?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54eaae52-7f4b-4efc-0536-08db89cf82c2 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:34.9390 (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: hPReEiJND1ptIyymzFa/lkGX4NU7ll0E1KKVpG+b//GAxdCgThRqrlCglyx7/om2NvTTJuhBUhrOnPCKVTzwzw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li --- drivers/thermal/max77620_thermal.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/thermal/max77620_thermal.c b/drivers/thermal/max77620_thermal.c index 61c7622d9945..92289498fa17 100644 --- a/drivers/thermal/max77620_thermal.c +++ b/drivers/thermal/max77620_thermal.c @@ -121,23 +121,19 @@ static int max77620_thermal_probe(struct platform_device *pdev) return ret; } - ret = devm_request_threaded_irq(&pdev->dev, mtherm->irq_tjalarm1, NULL, - max77620_thermal_irq, - IRQF_ONESHOT | IRQF_SHARED, - dev_name(&pdev->dev), mtherm); - if (ret < 0) { - dev_err(&pdev->dev, "Failed to request irq1: %d\n", ret); + ret = devm_request_threaded_irq_probe(&pdev->dev, mtherm->irq_tjalarm1, NULL, + max77620_thermal_irq, + IRQF_ONESHOT | IRQF_SHARED, + dev_name(&pdev->dev), mtherm, "irq1"); + if (ret < 0) return ret; - } - ret = devm_request_threaded_irq(&pdev->dev, mtherm->irq_tjalarm2, NULL, - max77620_thermal_irq, - IRQF_ONESHOT | IRQF_SHARED, - dev_name(&pdev->dev), mtherm); - if (ret < 0) { - dev_err(&pdev->dev, "Failed to request irq2: %d\n", ret); + ret = devm_request_threaded_irq_probe(&pdev->dev, mtherm->irq_tjalarm2, NULL, + max77620_thermal_irq, + IRQF_ONESHOT | IRQF_SHARED, + dev_name(&pdev->dev), mtherm, "irq2"); + if (ret < 0) return ret; - } platform_set_drvdata(pdev, mtherm); From patchwork Fri Jul 21 09:46:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 705169 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 8EA90C0015E for ; Fri, 21 Jul 2023 09:50:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232003AbjGUJus (ORCPT ); Fri, 21 Jul 2023 05:50:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231942AbjGUJuT (ORCPT ); Fri, 21 Jul 2023 05:50:19 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2095.outbound.protection.outlook.com [40.107.215.95]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02C1A4222; Fri, 21 Jul 2023 02:49:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cqaINiKihsksGuzffqa/5orRhMAzGaDuCXo47dXRyUF7JnuXx0kWbbyILUWhOlkt5RknTiBgLapi/5QzTPIpKd/ob8L4yg8SNlbZYEk96dGKuezweUOEo6Tr6h+Zx4SbIzSWMI3SduqgkRvlkXzHwfSrQ5WQJb8WyvkA6i+IOaCMnDr82gzgzswwYWdD3/WAyClH4HQFVG6GH6FTpZubyUKwt1CtF2aRP/xSOkl6SemP1Hs/TIh1US9+biC8Vi9LztCOSo+6oMTU8QEXsTxDjWPdGgsRM3E7hiuoDMtHo6vsDIlYruSWpF4hcwtvdbDl50eGCNLdoNss0LGYrVfgaA== 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=LKc+TavFd7Ci1xyoSggA9UVGFRc6ndR0B+ijlcDKBLQ=; b=YklT5ULoEoc3vlSR05cN7cSYJcSuYqbBYf6V+XSdKogjK6qiufiEQGBDGjYMCrU0oSud4gfux3xLIND6UwtqPBv5sPEnz04Y1JErG6NyW+gwZoWAPwLgz1yx6pXDt2ffeg8Zgnk55QXW0HtVyENMUMaLuMY2yYPIpSEbzroPitpSoLvVOFDrG7boOO7vhbjbFUmTJqjHDak4re/oyW0I235Xaa1fzB/h+5ZWl5LH2Lxnpmpw4f5s3A1QFFjlN4GusgRx/IXTKXe9R7OboHKzIfuwrFGrx+WktXm9w2iv1Srbcdc7HL+46ut94IOfuMpnukJkz3jzIJfO0tPmfk16Ig== 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=LKc+TavFd7Ci1xyoSggA9UVGFRc6ndR0B+ijlcDKBLQ=; b=S4UIcSfipj0LXdlHupYKxylrjpB/8UItARa6GgK9KzKrW+72yqxQ8pmDqAzDszam70srLQt8WrGujiaKpJv1Lu6XcfEscXbIRorvNtxop5s3oeKEkUEOrlQ8r9TQ8zdiu8JTyv65yd6UdFHUB4F8r2lgwLstfRUhSa4iBVAd/vJduzL0su0S8J34NYc/8S7qo2FlIbQwHS6iVRc0IUGH3VZucXuWcEcLYT3gfg9Gp9+sNJPZihiTW1+hWG00JYw6k8qOEqnPDkAYjVh+mIh0CNWEUSyncrXPDKQav9F2Oih1edv9GVrI5AT6HoGNMaS+5NpkyLX2C2ZwALjXCjYyww== 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 KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:37 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:37 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 17/22] thermal/drivers/intel/bxt_pmic: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:36 +0800 Message-Id: <20230721094641.77189-17-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: ffaa159d-3b1a-48ea-d30f-08db89cf8403 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +PGmhYBPSC8kHw55zlzS4NYAsJLkhO6VmXZTcB+vfVDtSNGJcPY7C3YiIeEytVjsk6Gu6sxINH8XBldrCGlfj+Xjeb7tiaZQMH75KonUFkxqSOt8b9ojBo/TUKWdXLkelSCiZTIVfTyhFvs7mQ7LcKSo5wuqeDPPZq7Mw3LWKuC1y3NCdbodTRh5eZH+coB/j0CnDsgCfUELPJmnYMWGi2F2gKW1rJvCIBAclMJg0ArgUEt6b5GIjlDsbIO4yh3xD8FKHh31HJI3VIRpaPUK8EGlh2aoH2cbU3XnXyg2EVgG2fdlbX8SkRWIR6mDjhLLDRUkxboveMXlTkMrGj6q5cOK9+qb4G+NrbKCmHsXdx9NlRrdmzmNDOaybXwtKAV0iQtNdPjEKP8I5GV9jCbm+7tTSVARnyusHVhcCLyAVplebPlK8mfsbQcjJsvk18t6y53BUlESwLBmct3suJuPIU7vLzSKx2eDjAdj4XI+l9lgMxwa/twOeDa7puG/pUm+wlL9olU8nD4J048Hn2+ta8jZQ4Me+N5EyHIJP9ZuCf8c7FqgFPdX9VRfQb0KkpT9fKM5+p/oB4lElvVMGkT97QksBCLQZZYlGgbbrbHixJV2yvKe+TrVuIfYAm8/OCDT 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)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(7416002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8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DUc26LcdGkU+qaTHreAtmtec0wvKn70/?= =?utf-8?q?AiWiloxfc3eBK9Yv7rZ8WRFFjM5aIZTHXarW7n8pxdgwUnyaPlj893vMgtvN7rpzJ?= =?utf-8?q?UCWnQP7eS1c9fu8QpwU7F7K1r53gjiw1jxrOt5ggUH9Wbi1bg88bcbukRoWIAz51/?= =?utf-8?q?kEkU5IHiFsvUz6otQlZXV/0c5xnjABNxpGd8cfewMQ2XFBg4yUVY6Lq7Z2ulZI4xl?= =?utf-8?q?ZJuBDo3SXcShMLJyjTRXCQuYlXA3en8fpRbUeDc6MbSVC8FH0cY0GF26jY6+qyxpp?= =?utf-8?q?NmbZ1YkpBo9VGMDR4hs0mYZJsASdWNH3RbxLLZma18ofG6x7gJC8gKu6WrUiZRVee?= =?utf-8?q?gijyVwg7UdwyrXtBlTHG9ias5Uda8PROEBCev4NyRtt8cQH1DsqxByFopGLYXa2Ro?= =?utf-8?q?VgS/YFu6JcayX+mTw/+a6ZpvfZgOKd7Ax4xm3gHATsLAc4aLK/DyB+2/QfGa2aAay?= =?utf-8?q?4lGOZc0AIp2AWTiqc0K/QVhGv/gjfibVLOuIW8VVvkIXQjTCxb2yG5PLOsH9316/w?= =?utf-8?q?xg7QtFxsk1DxWLahHVHs2OhH0QBur17ylIdYgsUgIsEQUgDnMtxwzSlYYx+Io7yks?= =?utf-8?q?Fi3M1CVwEvBAGaPM59pKpiibkmOq9u3T/DEmzzhnizgyY5AtdaRhNHjPq2JSWgvg+?= =?utf-8?q?MaLDNLoZ+M84?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ffaa159d-3b1a-48ea-d30f-08db89cf8403 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:37.1054 (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: cHAJRwKDLNhJZYqTT9f1rEEeDQ2U3uoNf1gmtYLHNdqZKI/8Y7DmyvXjizsWw/EQn7ohcc4n/XWYTC7HeTWDqg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li --- drivers/thermal/intel/intel_bxt_pmic_thermal.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/intel/intel_bxt_pmic_thermal.c b/drivers/thermal/intel/intel_bxt_pmic_thermal.c index 6312c6ba081f..1bf3e6bf8052 100644 --- a/drivers/thermal/intel/intel_bxt_pmic_thermal.c +++ b/drivers/thermal/intel/intel_bxt_pmic_thermal.c @@ -241,14 +241,11 @@ static int pmic_thermal_probe(struct platform_device *pdev) return virq; } - ret = devm_request_threaded_irq(&pdev->dev, virq, - NULL, pmic_thermal_irq_handler, - IRQF_ONESHOT, "pmic_thermal", pdev); - - if (ret) { - dev_err(dev, "request irq(%d) failed: %d\n", virq, ret); + ret = devm_request_threaded_irq_probe(&pdev->dev, virq, NULL, + pmic_thermal_irq_handler, IRQF_ONESHOT, + "pmic_thermal", pdev, NULL); + if (ret) return ret; - } pmic_irq_count++; } From patchwork Fri Jul 21 09:46:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 706011 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 7B959EB64DC for ; Fri, 21 Jul 2023 09:50:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231846AbjGUJu0 (ORCPT ); Fri, 21 Jul 2023 05:50:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231952AbjGUJtl (ORCPT ); Fri, 21 Jul 2023 05:49:41 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2102.outbound.protection.outlook.com [40.107.215.102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 677D230D0; Fri, 21 Jul 2023 02:48:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V6wlzlGQPvtMMyFqjjrmiYvHtVLAZ1aCeWbkDzsK7Vn8V0priy9jgG/qU0M2pvjp0YXOglaghury+lfYAsx53Nhh3QrYRPEMgdQToGhAze7IEESbZ/rZvhm1GnAVgPzlzR0bEgKwCO3w8jvuwgBASm4S4l8U3MeNEaQEUkMg/miBUR+AyMyqG5ntZnEW8l9LsVEpanwp0Zk2Qgy9aSjYrtiEQqjsE9ltTJlc/fKIaTJYr+vaNgEsopbVciPt6Ox3F1fxOBSZP5V6RLtA4JTatvh7v2r0QPqsOlzZSFBSEOXHQKH27L8HnN/7kaGcgAlC+lR5mOnMouLTe57yJcxnSQ== 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=q+TzYuEeTgIKdnKfQ77B8vedEfB0P2/z7sQrh3Z4zJE=; b=JVQgROdNkBp2PKh0grjhUy+F6cDegVgT/ijW8wOzGgQjw8etkfa+W67oceX4ULcPfv7LwEAaGIihpTLiGyuakWSQx8/VbbsTjjhg171N83SlgCny74Ehpz7LHYwX7pxkfBkgVwSDj3OKRQ5T3S5cOsm0gWwDQKS/HR5rEb578E9d9dfoOGdlsvtuYl2HnKUeeuNQT9Z8o3GKI61IO0r11ACpxDHbD+a0v9cvuNtmEnIdmW9+87l/+SAGGx+PhfiBqPwSodN39pcQWPzTOoJQ0HDeU5RS6S5okpBaWxaqfAAHn06h59rLjpTEr8FAEip+xAh7r7UaDa5YdDg6QgJhCw== 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=q+TzYuEeTgIKdnKfQ77B8vedEfB0P2/z7sQrh3Z4zJE=; b=qfcHrklTXW184EA90QgOV1RDHJpntKHaG+564U4M5St5ugEuR0m5OMWRPh6AooN7IbLq5ZQc41W/8iPrxRUHcG2P0bZU+vAWakaChBKqu8OeqOfcjZOzsV6x0xQDS87E59AaqCU0/OS9l2z0kWS4iV/ct5DmiNAHqkxlH/zdt49k+GFtpt2qiAoIrWTxDRPi09awjePWuDBGGur2nkEadxKMpgS1UoKjJNTU+zqi6QJE3ms9KyoVPVtoOFOQrgJzrGV5c4RWP/w7LAS39+T5951ve17d1w7KkXsKGvz5lmzT6a/Ondmz2bZ2bX84Tu2nFgzHbPFm/14IDB9FXtZfSw== 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 SEYPR06MB6311.apcprd06.prod.outlook.com (2603:1096:101:13a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28; Fri, 21 Jul 2023 09:47:40 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:40 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Maxime Coquelin , Alexandre Torgue Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 18/22] thermal/drivers/stm: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:37 +0800 Message-Id: <20230721094641.77189-18-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SEYPR06MB6311:EE_ X-MS-Office365-Filtering-Correlation-Id: 25dd82d3-01c7-4f43-e2d1-08db89cf85cf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ty5Gj0IOo+nnkQtTl6AOhfhcPMvlwZ6WVnhHrYNVE9iFMsTqS0/Weh/6mv6mk19sLje896WMO/SDCMZ/Z3Z8I4nLqNgYl2IiUePmTPHM5Knw8N3B2j5qpucWDOnHTPIUPLOKlk/7pxXiPOfiLAUd1SMiR9NmpwGtTlGvJkTa1yVtcBTzCuDkGYF3AOEn9Zl7cTn1h04DhFjPYQst7GHd5bA6MPHHSvcXZYQDh6GV5pMS0IJLwOaYQSBRyRsqkGOoXXkv4hzmYo/caNgw28UAtFrqtIYEe3rAHxrT7bj6c4ZqNVLcDFcX7hnReWHvma6Y5o1qZkDXXTTkbPFvhZ9/6+Vt9bE1qhat/2Jqn9buRnsl78JySBi6Y3QNICb6aBjARuZUJELKPG5k0OamAtW+aKfP5YRJAO014V6xn/YzeC/mLmzEk5OOZ22URwL6PEPX189GNqxttNzRHSsO7y5UuxjOQ0ibdzuHgdgt2CeVCQagi9AP+1FjosCJkQ9Htiw99J9AhmoE+rCjLDDVwsJqOry5Hyu8mZyd0+tTvfSp3A3vW+Z95nbW/ukBEW5qGfeiHCqs0FNi4u5MtgetnerpG+Y3HsM1X6g9Q8PT03NqfsSkGcE38RT9adb6uG3TG528 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)(396003)(376002)(346002)(136003)(366004)(39860400002)(451199021)(54906003)(52116002)(6486002)(6666004)(478600001)(110136005)(6512007)(186003)(6506007)(1076003)(26005)(2906002)(41300700001)(316002)(4326008)(7416002)(5660300002)(66476007)(8676002)(2616005)(66946007)(8936002)(66556008)(38100700002)(38350700002)(36756003)(86362001)(66574015)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?1cFhDDgPherQwVI1kkzkJNu07tKA?= =?utf-8?q?0c1z23Mekni1l603FRHn4JlAYj+b6nonsZ4ljGXXJn5NEe9jJvGM+NUfHshKLQDW2?= =?utf-8?q?QPyAmmFKrjZ7Xr4pn15hMcmpqUMSlHcRY9Rf/Nsgg51Qa2RGoBvp2sMybFrvJUZxi?= =?utf-8?q?v5Nc72at/hV7Dv0qH2SEPDZV3C88KV1xKhSXqXmcan7NR7aEko2Ey2M8Axp6telZ8?= =?utf-8?q?B9RF6YuB+M+uxxxMONHSo8YlsPcaEHayfmyTVFquZXAdKdDG/vhjtYJyd3v93HitB?= =?utf-8?q?D9/nj3qnxIbOXehjodTAvwu2mcYdaovSysHXKWgetFJmuxF9T4yx/0NHKukTI33LX?= =?utf-8?q?H7GmqOtk329TOH5IqEE734HOHr+2huF0cfOZpAkWxJK8PMJFTZ1BkQRXZ31Xopzyp?= =?utf-8?q?kmHVRLMySKvQkENMBaHtilLo1uWBN+jWLNXWOEN0B9ZkM+AHHzZIugFUSeuaz3Jfj?= =?utf-8?q?PYSJJ4zh7u9MjTaUwR6Nlw01kYI6Pgpg1SSYFA6yCLKYsmm2VC/FSsGP2gnU0NBhW?= =?utf-8?q?4QLoWHWTVS6A7OHgaQzgG4xOze5/YSy3aeIsi1u29miPis3P4jvVt/EY13ZGiMmpt?= =?utf-8?q?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AenOUJ3mGd7aMMD+33n0iyUe0v1FKlsR+pciL2hBmyRMTiNKLYoWcFTmY?= =?utf-8?q?MWkFDzVCIfO6?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25dd82d3-01c7-4f43-e2d1-08db89cf85cf X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:40.0831 (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: YxNfBV1HrrqXpF3MlG4NPuTs8lJNpDnAqWpncJfNAMW+b4eoJfsMkfkREzmvv3sv+TI9Y3d5g8Kkqolt+tK6Ug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6311 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li --- drivers/thermal/st/st_thermal_memmap.c | 12 +++++------- drivers/thermal/st/stm_thermal.c | 13 ++++--------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/thermal/st/st_thermal_memmap.c b/drivers/thermal/st/st_thermal_memmap.c index e8cfa83b724a..40bb318b5489 100644 --- a/drivers/thermal/st/st_thermal_memmap.c +++ b/drivers/thermal/st/st_thermal_memmap.c @@ -97,14 +97,12 @@ static int st_mmap_register_enable_irq(struct st_thermal_sensor *sensor) if (sensor->irq < 0) return sensor->irq; - ret = devm_request_threaded_irq(dev, sensor->irq, - NULL, st_mmap_thermal_trip_handler, - IRQF_TRIGGER_RISING | IRQF_ONESHOT, - dev->driver->name, sensor); - if (ret) { - dev_err(dev, "failed to register IRQ %d\n", sensor->irq); + ret = devm_request_threaded_irq_probe(dev, sensor->irq, + NULL, st_mmap_thermal_trip_handler, + IRQF_TRIGGER_RISING | IRQF_ONESHOT, + dev->driver->name, sensor, NULL); + if (ret) return ret; - } return st_mmap_enable_irq(sensor); } diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c index 903fcf1763f1..6a36a7eab9bd 100644 --- a/drivers/thermal/st/stm_thermal.c +++ b/drivers/thermal/st/stm_thermal.c @@ -387,16 +387,11 @@ static int stm_register_irq(struct stm_thermal_sensor *sensor) if (sensor->irq < 0) return sensor->irq; - ret = devm_request_threaded_irq(dev, sensor->irq, - NULL, - stm_thermal_irq_handler, - IRQF_ONESHOT, - dev->driver->name, sensor); - if (ret) { - dev_err(dev, "%s: Failed to register IRQ %d\n", __func__, - sensor->irq); + ret = devm_request_threaded_irq_probe(dev, sensor->irq, NULL, + stm_thermal_irq_handler, IRQF_ONESHOT, + dev->driver->name, sensor, NULL); + if (ret) return ret; - } dev_dbg(dev, "%s: thermal IRQ registered", __func__); From patchwork Fri Jul 21 09:46:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 705173 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 53D26C001DE for ; Fri, 21 Jul 2023 09:49:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231804AbjGUJtX (ORCPT ); Fri, 21 Jul 2023 05:49:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231920AbjGUJsl (ORCPT ); Fri, 21 Jul 2023 05:48:41 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2103.outbound.protection.outlook.com [40.107.215.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 842BD35AD; Fri, 21 Jul 2023 02:48:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cl6BYj2ZKDT13HtNKI9yGBhjEtIAiezQo3eg1rPA1STUYfy90inWB5xHGvcSs/WXuXOGaq53OoO3hzYBQMnlygCUhdijnE0K7qd2MCGhMOl29T0GqzzdBvyPIIKF8HMYeHtsxp5VhMQxEkzkvdV8Fsbvb63LlIDfoAgRw0Mr+z4bp9/XqyqVHpsN2jy16XU2LB62e359LpRPXusOw7Nh0nsiVOT+4azodiVqSvzfPUIdPsQw7j/EqWYihDNHthwgxl8nRo+nynxaFOuAJj1P5+Z7Xh5ghMOJ2sXVIS+U4yuWUcFGPxktSbHGCyn0X2i2LT3eaTulSAD56Dv3PTIyvg== 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=U7xJSqPC6R6oyLUW7A4Grg9gjrzZA4zR9DzCNmCHg5k=; b=jq8eToF4MZRlz/OyWTgVXDOwilmP70wYhKfo/zktwWJ9b9tVfFcb9JPo0VIeAF8OkJbhVgfRTvsLwC+xcec2d3ix8Mz+I+63NKMlyd+1/XsFvLPS4z2OlvOW8v1V1/dKTaPdwaK12okR96ePMrHu4sqamIAXx14KZfFPXHgDbN2qkNIzkhrsUcGzzsV3+vxGhg42uZT7IS0lbnbPJarZG4D4xV3gyLuaStUcchrKdTK1adQZ1dJQ7AAXd9Y+K6bP1alkwaoerIpR+6GCzVzyJZmIETkwiGyIbLN2stOdHVyYqqpXv3eRQAhMXYEj5Ax/8+5seLkHFaaMNPssxhwe0A== 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=U7xJSqPC6R6oyLUW7A4Grg9gjrzZA4zR9DzCNmCHg5k=; b=Vfg0VrrWIQ7lE4EPXt51RC8KzvDDG6MXA8DOv8YPcr+6tEMh94myt9tTymy2jInrzEaW/1dsbqIhDo5ip82QZjmybaJ9CoHMUWDvbsXum4fPu5lZaXc6J70caWWl5MbjY3/9Sb9quK0kchmra2kx0goOZOFb5nOTWkYdM/7SQ6xPf6wImoWLO7nF1KdxzTIJeIu0kiqQdulvSh5XT0C0bps4JH+lrZWw44srL1HwdtK+pqP0Zz/CGXyKUTmWaPc0sRsTtZ8OSEq0Gr4zi38Y0oS4ZfZfENW3EqE5OTtslAm5x6ydMF4pYb1xBOTNeRAerLXaR79XHlM1lwpzthmVuA== 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 SEYPR06MB6311.apcprd06.prod.outlook.com (2603:1096:101:13a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28; Fri, 21 Jul 2023 09:47:43 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:42 +0000 From: Yangtao Li To: Amit Kucheria , Thara Gopinath , Andy Gross , Bjorn Andersson , Konrad Dybcio , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 19/22] thermal/drivers/qcom/tsens-v0_1: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:38 +0800 Message-Id: <20230721094641.77189-19-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SEYPR06MB6311:EE_ X-MS-Office365-Filtering-Correlation-Id: b39fc405-4e07-4457-1c11-08db89cf8784 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OzMUkSUhbywZQpA3N8ZR+aY4fuifa+oAlXbD0967Ts5nBmreNKTjHsJCNKlboBzljeZyZJd4KNbSAGg7vBv4pwqBkeZoYtxhAAo2rHPx0TWQWIk5u0FUUEqXB+QbnIb+ICfcnp1YboQWKuvqWylNU/dmop/1nkHAHHhtcb76zcJkqWSar49plXTHBqhv53kpI7W0ROTC1Yb9sbFkpPR1nEhANfKR+0HI4MseKbrDJCDuZmTSQtFhG598NdHAtdToiwH61f8ANlFCPZ+zgr1muC6lhUlA1Bg4bq+4nTqRMhM0yYe65oQjVtHrCzAWeDmNtuinIHfczxjMaKpWWJMiDENpo187Rdw1s4gPk2Vu/0uMAC9MqIIIodG5KAnT/voK1UB/pe4ssSbMASN312e91xBbjRX9smShEWCD0f+YsOF3DrLSL3/oEZMimvHE0IFn7+yukiub3kgZy3Gaj82qYHJNUBHX2enJW8kBIGab0YOibhoLPH7vd4BuwEVWCmNNXw4JTJG5P5bDdniCUtqqxfuhL2YzYQy1249ktZ0FjCjSErgGgoR9A7u+Ld21kj9lSZR1MQ+CIRLdy055mXRJy1n+3fti8G64G4lABWrARxtElSiZdxsH/eq3OEJbxuwE 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)(396003)(376002)(346002)(136003)(366004)(39860400002)(451199021)(54906003)(52116002)(6486002)(6666004)(478600001)(110136005)(6512007)(186003)(6506007)(1076003)(26005)(2906002)(41300700001)(316002)(4326008)(7416002)(5660300002)(66476007)(8676002)(2616005)(66946007)(8936002)(66556008)(38100700002)(38350700002)(36756003)(86362001)(66574015)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?c3FJWAOQkscS3nq1q6u/QcueG6dj?= =?utf-8?q?t3+RVDw061xcefO0B28MxbteeuiTo0G0ch/VBLuQZdRzsS3h1CW5rsAvE5jMa5jbF?= =?utf-8?q?EDWsZ9e5jx5y7ROcCvMlpjkmb3XFGPacRmA3Tx4Iq2hzBdWE0lN+niwduSGZgcZGv?= =?utf-8?q?+hVxuby5cuQXrIjaV8CX5TGUhbrFBlglyfO5ivy4lvR+JJyETmz9cyP/vQrJA9ubw?= =?utf-8?q?dDiksG5pyClq8chw1jJVNsoXyswibjr4t44/jU3qRzCq5ysRjx0ymsVpAef/tE90i?= =?utf-8?q?qKafRSBROIBQBmlVMo0qHUAUFcow5H5vniLabVCvEuskJczisG5USrW7IKe0vZJCd?= =?utf-8?q?klMTjCObmu25YikDQXmwGbhnq2/Xfo3V5WDqmv1slmpEXr/54XqY6VYlQ33Si1yDH?= =?utf-8?q?fuDFj/yt1JuWVAjVFjevWIrHBOZOPlVHWh2Gb3xlZJz9SG9r+qJICl/XYU7gpPcje?= =?utf-8?q?rHc00GpDC1Mb7biz2oDIJ6oUsOJoXz3fR+f9xMWmOdCL+e8SbafGSHNN3OXUg1zsn?= =?utf-8?q?eS14hr++EVESJEobsNuZlIsBcB/jNFc4csdZy/k73BkIY/OjD/CPNbE73kkr2WH0r?= =?utf-8?q?Mmwt+L790hsuimzkGxZRgk5mP66FvQYcJOeO0/xpzRWKn7Gfuv+FxgP34nSMdf+No?= =?utf-8?q?5UArcJ/DhLkPbeg+0OfOvvuN3ylAitFVDHKSixQG5sgJm1s9fUqaQKgoRs6DU/qUK?= =?utf-8?q?1saKk6bKhW27p1hWbuTSiHji2O8rGVY0BCP7spNsJ0LGleSk56CKFd9Wldrl7WNjD?= =?utf-8?q?7dnKqKBH6H4P0PlRPpkl+iApdZc2B4pr1OKRlixPDX6/2XOGT98X7EkXAK5OzO9LU?= =?utf-8?q?F5zVkCT6mm6aEEtp24OJjRFxR00WNQ9MOrUSZqsnRbT//fho3nNiWCG/skRT5ZabC?= =?utf-8?q?6NXtJOMOkojLDWq3DWjMuPzoisEZIGMqMGcqv8e6gl2DsEIEHr4W6J10ip61l78n0?= =?utf-8?q?OFkRi5wxQq0tgSzeCbnt5Lx3tjCaW+zRMiat+tW/KA/2a3WCQbUpqvEtQ5R5ywZJG?= =?utf-8?q?G7pqhD933R7+qyurooZGBPzWf4axKlxkS0gbVeGnOJCLmDQNEPjzicAC7mAT8dbUs?= =?utf-8?q?oYUaJbVa9ceRDY7nV6z5f76Kr/BvMqh98jcf9k4fMxiTZ0O9UBET4PbwL7FMgQj0Q?= =?utf-8?q?pHvuq5ifjhqJmcKX9n6zZbd2TlwXi4t8/hgKIIL/w0EIU3kJmCHyBn77911o9vwLR?= =?utf-8?q?z2gOA7Kq/wgvNG2sv30/P7sCfwgrElJQ+g+51Oss1kg0EQl4+u1LiuxYKCeyO2TvS?= =?utf-8?q?yY4K6gbqrS/4PwvAHoK7Dz6tf0nkry/7K1RsCzky1ChiIqKx0Brg+tNOMDsUVSCtQ?= =?utf-8?q?BHue24JtVaC+6paVLMN3jiLClQa9+sl0FUJ1sQXuc8XMe3jKOH3Ug9bKj6hoeYuR+?= =?utf-8?q?9LKxlQWKb9GKn1VopTYPH4IRQ3xiDspU3cY/Nm5SFCzLfzWV1zk7cTaQdSkwNcbhC?= =?utf-8?q?H1tOBoSdqS8sTjlGfGv9p97MdOuvfwg4SMuMVJZdJOf16KecCpI6B0sKQyfCsThMk?= =?utf-8?q?US88D6r3tJuV?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b39fc405-4e07-4457-1c11-08db89cf8784 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:42.9298 (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: vRDRWDI9cXvvvsa57ELLKLgSYKtxp3ZD32Bm1yRVSh5N4a+si+9iS+XECjHeHa9rTBmUkXIsaOsXamLXH9mkBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6311 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li Reviewed-by: Dmitry Baryshkov --- drivers/thermal/qcom/tsens.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 98c356acfe98..d4528d36c085 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -1171,21 +1171,18 @@ static int tsens_register_irq(struct tsens_priv *priv, char *irqname, } else { /* VER_0 interrupt is TRIGGER_RISING, VER_0_1 and up is ONESHOT */ if (tsens_version(priv) == VER_0) - ret = devm_request_threaded_irq(&pdev->dev, irq, - thread_fn, NULL, - IRQF_TRIGGER_RISING, - dev_name(&pdev->dev), - priv); + ret = devm_request_threaded_irq_probe(&pdev->dev, irq, + thread_fn, NULL, + IRQF_TRIGGER_RISING, + dev_name(&pdev->dev), + priv, NULL); else - ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, - thread_fn, IRQF_ONESHOT, - dev_name(&pdev->dev), - priv); + ret = devm_request_threaded_irq_probe(&pdev->dev, irq, NULL, + thread_fn, IRQF_ONESHOT, + dev_name(&pdev->dev), + priv, NULL); - if (ret) - dev_err(&pdev->dev, "%s: failed to get irq\n", - __func__); - else + if (!ret) enable_irq_wake(irq); } From patchwork Fri Jul 21 09:46:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 705171 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 69CACEB64DD for ; Fri, 21 Jul 2023 09:50:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231937AbjGUJuF (ORCPT ); Fri, 21 Jul 2023 05:50:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231822AbjGUJti (ORCPT ); Fri, 21 Jul 2023 05:49:38 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2103.outbound.protection.outlook.com [40.107.215.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A2C13C1D; Fri, 21 Jul 2023 02:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XaSvtVA8WOU9YZTnb9NU4Cbw3W78DOV1+OdVlVuZ0ky6WIAy3TLk+36ijwKLToONA4hF9G9BAoHte2S0TzVeSDLk4wzJah5vF2bEZ1Wf350WQeV52m1o01ALJQZSM904JEZ1+/qvVRdIGqn3tSl46/h/RK3VUlesGbAN31gCamJpNA+rySUIcvoutmE12PWc1fSx+tYetiSBDJSEqB7BKLLKXSoO46AGnPXqp7oNwMpzJVQZsCRfHsTkuj08rxvnNbekZ08qsSQLxLwqxHklGqfRNjgHcnPjbltO9xkU9yShI9mvrZ2+GsK4pfv8eyDNoh7pQIzU8rkKt1KCa1V8zg== 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=uDVGgpitxTT4QdqfnkpzTt8ouLLBgOS6RWAujk0isLI=; b=C5CbYOSjPBsoBhb4e0e39IyZEGIU/Yvo6a9Sk/fqxi5X42XJwQHmkFkA9jcFTDFne2X+WGtLEMhC3j21cAZwzsk26Z8XCL/tli4AyrefuVn/crvfYvq63MhOSqlVHiyu+9AWK8vMQVpSv16GQohdNTI3thmsX9gIe7M/YsPjEjHFT2hxiVSouIg4dvV8enWS/di3Keo9Smk2KFiU2ExMJjiFz5HkignF1ItiQfEprpx7NHZYQKoIfVoO0sMP+itTtdsMgaDbHXAzncz9cDLMe1XjDc+vcNzuZFai/NBp/p6iTAf17YVKvYkAWFE2OlhPD5KJsqF7XENfYoJqhga0Hw== 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=uDVGgpitxTT4QdqfnkpzTt8ouLLBgOS6RWAujk0isLI=; b=WMNetiS9o/NWbhoqQeem0ItQ5BWoNQOPMaAH9bY2v7qyIKjUsw7PprP8f1DnMf7LUEhg1T3ltH4Z+9P4f6WAf9UnCZgesms7U7EwMN0nx5+UVIPPn3TP3h9zIvQlNPm6qe4WVgSB7/5YKWMmu5pFwJ7he3q+rb+6tc8wWiGI4HfUYzNNOVxi0B1a65/CLyifTRlN1kGdE2wwAQPlPiQpf7EvEi3S/KOz5E1wxuzCwzsFBl2PWS77kTlnBx7Mtbu91uKmK0l/2FbJTEjWaDChTEBh3vZ+Lpw6x30fwGjWugvC9EG1l+4jTVWkuZHDLYwiPRV9HEoggcnZXRL8loF61w== 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 SEYPR06MB6311.apcprd06.prod.outlook.com (2603:1096:101:13a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28; Fri, 21 Jul 2023 09:47:45 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:45 +0000 From: Yangtao Li To: Amit Kucheria , Thara Gopinath , Andy Gross , Bjorn Andersson , Konrad Dybcio , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , Dmitry Baryshkov , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 20/22] thermal: qcom-spmi-adc-tm5: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:39 +0800 Message-Id: <20230721094641.77189-20-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SEYPR06MB6311:EE_ X-MS-Office365-Filtering-Correlation-Id: 8dac6673-6c6f-4d9c-f323-08db89cf8935 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: srgO8q0mpqgKBoKgZ+JcioeFAfus8MhZERhiFSAF9zqjDEXLhewOFSxvd11NCi+wWLIHSNkeAV1kq9DoElEzO0co2NewFuAuzJkvtc9gO4aZb/qYdKbmqBOAyGhZgUrAj2XvVhBuwDeMAmoJwehkYVM69LBjewtkAM6F3GDz6eyMrgR7P9Y46ZNjBtim2YNnH1+pOA5NRW37LpRiF/v+lR3Vw/wQDjCVANzJam77RxqSv88la1cTSN/XSXRU+JxlIzCVBFEek9inJLS+EpiyszWraug1j8SwDBo9oLVJ/fCaSSMTcKSEvDJNsmlCRaHL1wJQDyXFzTjn8h5QBT9l9jR/2EOzIMnPyunzkmmBewkVi3e/LYYzhWKr2HQg+69MXBf1umSfHvJ6zmWswu/LX4i29lWRIW2fpXVif1ypckQA4xxlkniIdTVV1cHBek2FH97FRFRRC85CzjLkcpvbUSpj2YeHVdweF+D5P6QXaihNpgcPF8GErsQdOvLPtN1rp6jqZ0RMgWVDvUyU5GPL0PExUBggCmHi436x3g5U9wEzYnGKlfG6bq47rmPKv4mSRtODiNQDrCQqxNkXuaFIMOfZxwloWMnORwpw21Ik/zTuSSLLM1Er4eZbabwKTjCk 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)(396003)(376002)(346002)(136003)(366004)(39860400002)(451199021)(54906003)(52116002)(6486002)(6666004)(478600001)(110136005)(6512007)(186003)(6506007)(1076003)(26005)(2906002)(41300700001)(316002)(4326008)(7416002)(5660300002)(66476007)(8676002)(2616005)(66946007)(8936002)(66556008)(38100700002)(38350700002)(36756003)(86362001)(66574015)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?baGbr84sBQMasjgrtsPf7wNtk3XT?= =?utf-8?q?C63lQqVg0CjTufJTx+YXovorPkFx0SLw++9NuJxfc55W22taExAN26jCazgU18dg3?= =?utf-8?q?kWTbpJDHMPxBo2gHFij1GkeHH+H/aGpvdHAjdB0u+VLEAEjHbsmpGzlQQ/ihcWP5l?= =?utf-8?q?x54KFQWYI/UzXfnbw5l1ecPrA83fYsfgs5hfyclc23Rrb3WIwN8kmLBsGOc8YlACe?= =?utf-8?q?bQp45JCTw50sp7pLeq6hY9FF36mnNKKZFejO+DItxGPG05kZVC3h2eVP5MNGgXRn4?= =?utf-8?q?HLl8Y8jNKyGkfipPo6zoiHZhy2T/+q+XOp9hcyzuwLAuaLSHgYhZRPT3JVJuc3PQu?= =?utf-8?q?J4T10eMz0s4o5VUS6oqpZ3nkfaqpaBF705WFYbOdItonLp6yS9bBmA+8JzUGu7OUk?= =?utf-8?q?JCAOjr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FzFUUaU7FnEQklsAsRbdfiLvM5bA1+LI+eR1DHwZSfxtG1Db2?= =?utf-8?q?WwQCi3M8y0B+i0dQd4t47bJdygeTJRE6sc/Xy4rP5utb+X40RR82zYEchFjEHaeXu?= =?utf-8?q?FIiVd5gTWVI+6GYkiLAWKdj46BYTyCvwm+KVfA0CGvWBUiKR3TOp4okoKZDcdGEov?= =?utf-8?q?Ffd7MlnXdXi4RluSyCyunEZ2958zb97nccCtyxLszP2fL/7uWxgNUo+vLQfADWszf?= =?utf-8?q?FQ9CWUtDYigZ?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8dac6673-6c6f-4d9c-f323-08db89cf8935 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:45.7886 (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: bln0xofjKsrV1z3kn7cqGyKU6+dlyIcvr24REKgnsOO169NSSeYnIuf3p119QYN7cZ423FF/o/ubVHa3XgOsfQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6311 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li Reviewed-by: Dmitry Baryshkov --- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c index 5ddc39b2be32..90d46dc60806 100644 --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c @@ -1044,8 +1044,9 @@ static int adc_tm5_probe(struct platform_device *pdev) return ret; } - return devm_request_threaded_irq(dev, irq, NULL, adc_tm->data->isr, - IRQF_ONESHOT, adc_tm->data->irq_name, adc_tm); + return devm_request_threaded_irq_probe(dev, irq, NULL, adc_tm->data->isr, + IRQF_ONESHOT, adc_tm->data->irq_name, + adc_tm, NULL); } static const struct of_device_id adc_tm5_match_table[] = { From patchwork Fri Jul 21 09:46:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 706009 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 19965EB64DC for ; Fri, 21 Jul 2023 09:51:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232008AbjGUJvG (ORCPT ); Fri, 21 Jul 2023 05:51:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231954AbjGUJu0 (ORCPT ); Fri, 21 Jul 2023 05:50:26 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2103.outbound.protection.outlook.com [40.107.215.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C92D422F; Fri, 21 Jul 2023 02:49:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YxRsoKYW3nNSXUTcM/j5I+PG5P+DRLcNK411qzLRjqo0Y+dsN/ko7uAZenqFhPZrHvfgYXNOaQesqvl7Zjv+4hb0gKSsyNG4OJ2MJOggGXwBkC+PqXVmUovUc5YMKOS1gNjlhhhbsz6TZmOEurScHULpGNGvBXB0ABsv7Xe+Rnc35dy0L9qE7xkR0mya7H3G+ARZudLex69TYLgNfTpo6QLgFsCpHYBrdZz//IN04iuMeb4hDVxxyii4+FGL0GGSq1gll7NWAp4mUcogCgRWekGACUncPpsif0OcnMQCFi7/JEx+W0gCs98i4WxcvloRRMggVwh9v3vxqyPljP49zw== 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=eHS28mIWTpLDBdxBKQHMC8i2TLY/+VTjWtqoEmhSPRU=; b=jCSG6QiL9blOnMDXr5v2mdl8tFsHfWVov+vl3KEkUdZRPzuJ4rvmZvSDrvb8yyjp/x7epiGKE6ZnWEyxtCIWZUvSFONEvz9JQCHQhuYWkgdKXHAF4eU4U7mGp6hmUDIVHFvRZ8XCXgFznQ+IACrytpZTIrJry0rkEtWIVv3RMXoqfX57Y+OEAFdCkhmir7c1Rs61iX47XMlXKkKewIkxIpkhmnPLEwuonXESJszCjcI1SB4xaXViE51zc4/nROqF85o4j/7t68ntPyOUFwnweA88CzKruOCTqLXWGT/ce5gEu6tsvxsmybkj8SONIPEHArdOSblqvTmdi/uZ8Ie9KA== 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=eHS28mIWTpLDBdxBKQHMC8i2TLY/+VTjWtqoEmhSPRU=; b=IbkHq7BfobddcTlHXGVM/i+yMmYSr+nP+td3bEIQh4g0LsSFetF5m+R5X0sL4uuxgAc1LYHz9RG5/MHZHmUILDVeUD3rH4Vh45/PfV4L1r+BUNDrxl8JPxJSva9pDd/4EbJbkdHbam40O6cSChny2GF9wzab6QG4g7c03QUwztBcxmTSOuth86hT11rIXlPWbi1ihoZqTgOl+jAX4H7D9naxWHqXd9uHpR2PrMjKAsyjfDA6Uir3kiLooFa0qvlxfwzZYJK/hLHjp5riG00Irf9eUTsIHISZZTSTCuFV2vZ4t/D+AhRo0pe1I+rDwni72tR/PbxPlsv564h3XdyeHw== 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 SEYPR06MB6311.apcprd06.prod.outlook.com (2603:1096:101:13a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28; Fri, 21 Jul 2023 09:47:48 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:48 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Kunihiko Hayashi , Masami Hiramatsu Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 21/22] thermal/drivers/uniphier: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:40 +0800 Message-Id: <20230721094641.77189-21-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SEYPR06MB6311:EE_ X-MS-Office365-Filtering-Correlation-Id: dbaeeaca-81d0-4696-f6ba-08db89cf8ab0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b9hKown3F6RSZNmgshSHLy5Z0ABtWj82TsNLfB+Coyz/d5NzSDIEAUlXJs1bIYPhustjlkrVPlWPOSAwUW5gnjxjaIIotLASkhCbV7HetWmLo66Fx/nf/OBtm5BTGNiwL9t2MwDoj8j3Pfab4ZhabL36Rt3BAIn35S0lMY/rjIHZdIEz1OCAs2OZX/ctL+Tdno0IJK8tPv7DclYYqlLCpSgyZT/6QZJ+lBJ1mpF7sTP1DPolerGpvYSs0O78ps9X0eQUlYrfKxHu2EnuakHZvA9SWYfU4EdMElCeMqP46x3OUFdX1OMAvKOsQl5iud+rifiqxIFR07fgjn8oWvrFwJba6agVQuQOtx+J2+n1Y913kBVkQdwb07zzipLIR7/0s3ueOrvH6ghRtLuIunQOtAdX3kQpxbOY72JBaM3F3/H6z3QdSmziqYnhjB5kIGGnY7C4pqqng0RMZPGqZvVcbzMPvlQj2/1bNl1DhNWeYdBuV3ErPOlu+HACWlGvVwxBjxCWRvstpaFfOAIubssl+PBX2tEnWWT15POOjD1nVqFl6G3pwmUiSg8NKqpMCfM7u37i6uoZ84MydNnKXYPLvvj3VXcUsHJdkfnZr5xYMNKvdEoOBIJZsdi2AEYZBFPm 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)(396003)(376002)(346002)(136003)(366004)(39860400002)(451199021)(54906003)(52116002)(6486002)(6666004)(478600001)(110136005)(6512007)(186003)(6506007)(1076003)(26005)(2906002)(41300700001)(316002)(4326008)(7416002)(5660300002)(66476007)(8676002)(2616005)(66946007)(8936002)(66556008)(38100700002)(38350700002)(36756003)(86362001)(66574015)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?OXfhg35g/oSt9Jrywn4q/pMCFgp7?= =?utf-8?q?KcvPNbyxc0rQUCKV5PBcKMwQ5WoOUowQUqJr7iDuPWiSJBOUcT3A4nD0Ut3kfFeJl?= =?utf-8?q?Huew9mv2ANPVOgbZlYZ868WYqnAYF6suAZIu3w8cyU4OUExBoZZtFYmiHvc4PMj8X?= =?utf-8?q?ApPJtFAB7rzxeNEExDk3eDvLERD1xos6zoyfP0PsQLtPAe8SD5GQTXfsb1hBCdgJ5?=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utf-8?q?uznD6H7fwHCg2la9eLQ0Jq90SIVHXht8UBXmfJxvQwEbM1RWC4uO/VD5Q7baQ2RYA?= =?utf-8?q?k6xYhAq7rLjb3LYlINP/AfMIoau6I5MtQhKRsg3xNbAi8EEGUkb9XmDboyTBcQvfr?= =?utf-8?q?HMlhf5o3Q9KIxSSvBOhp5pOQVBuo+wgoNvA7Vf02ZwSB831QMTxyCSK2TO5BnCVVo?= =?utf-8?q?Qydf3/L5ufbTUE8Zj1Vatlu8atzvnRj6Hf/TRRp73OlA9NNNGfW35XOSEhSbVxtS3?= =?utf-8?q?YfvvLC4ysvYV4wbFAe4GX6pOXJ7aZuMe0OqpyMoIxj7tFaI9JMbaJbya188il14vM?= =?utf-8?q?SFSbOs63eMjNmKNJHOotjbcb21vt1zP4hg9PtPuLrboHzg/HcDE+JtMSqlzbNCO2j?= =?utf-8?q?NFZrL4/fO5K5gaWGoxomc0i1Kjq8A+RjZUXOG8YC9XwfAUlzGTE0xYlvN6nNfJpNM?= =?utf-8?q?y5a5nwN48TYE?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: dbaeeaca-81d0-4696-f6ba-08db89cf8ab0 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:48.2912 (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: Bh0wLh0RJiWX4xyqZblVpaFfaJMAYdj7hRaUOEBc/6amhXXzRY1vE5rhyDct3LmUaTNDQz7J0bT+8Kn1D2Ro/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6311 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li --- drivers/thermal/uniphier_thermal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_thermal.c index aef6119cc004..34d8eb2138d3 100644 --- a/drivers/thermal/uniphier_thermal.c +++ b/drivers/thermal/uniphier_thermal.c @@ -278,9 +278,9 @@ static int uniphier_tm_probe(struct platform_device *pdev) return ret; } - ret = devm_request_threaded_irq(dev, irq, uniphier_tm_alarm_irq, - uniphier_tm_alarm_irq_thread, - 0, "thermal", tdev); + ret = devm_request_threaded_irq_probe(dev, irq, uniphier_tm_alarm_irq, + uniphier_tm_alarm_irq_thread, + 0, "thermal", tdev, NULL); if (ret) return ret; From patchwork Fri Jul 21 09:46:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 705168 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 43437C001DE for ; Fri, 21 Jul 2023 09:51:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231818AbjGUJvJ (ORCPT ); Fri, 21 Jul 2023 05:51:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231976AbjGUJu3 (ORCPT ); Fri, 21 Jul 2023 05:50:29 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2102.outbound.protection.outlook.com [40.107.215.102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0683A4480; Fri, 21 Jul 2023 02:49:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i1X9y9FcNNu/kjf/1setfIQ3zY07e2hMPNQhzMkbjMRBjs9PWUpvLAa1O6mN0PH3m3sDtyulsterfmTjx7eIDtXhL2ONqGardJaX/i124yCWr26/tXGc7jyL5PARLU8DsK7ctHUt1AQ8tbTYfOXt4k47wDeI+FosnPSRY3R6PX31O2SJlQtKcvQ7ljWvrAMjgApwJNzT6SNpEkN4W2AcwkISC5uuBMxtpyT+TJC7A+MpF+7HOIj9chrSVXUEl/NzSj7Vldj/id8zmnIqUNndD1yuLHqFHjXU8AiWitOFDtE1UuujRxMIq4VkVxWkJmAe+pQPSOMYLKFCaw21qjvdsg== 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=fIbTe94tJb+c7Hut//D6DIRJqgxdHnLzwdkufWRqizI=; b=OxLzCYm9O98vAmE18D4z3fGsPw2CghRbp5nI9lzxB34ffyoUbkTZG2oR59/PLvwm/0s53ullYaTrMwNNRP1E3/pVsZFdOSiA3fg61yfMkRZiTs8GWXZLzHiNPQ9+QGbwHirBHZqWT2vuRSqkiXwmuFMoZBrPg5K+DYNk7pY6va6X4hY7MgW+M9is60/t2490nmEyy+Bd2kw6uBAxWN/sR6msQdAdNaqH0ilS0YKEpUQPhIAvlcMldnJBtyZxNyYR0MbIcIzp9T9N5WOtPBJv2Ytc3fLUidnjtJfjuHT6pcy/ZmA7D0VLuv3iPEo6eVs/IFuarHCrX4Pf97rAimeXpA== 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=fIbTe94tJb+c7Hut//D6DIRJqgxdHnLzwdkufWRqizI=; b=YfLqnjU7d0ZgjnPx6Goh2df6H0perLUo5GqPhjXYBeRZwTP5SwtaTd80O9ttxW9miD489ghMngkpoipGYRvdwplxONFyaS2AWT24xNfSDdwY3xTxalTeRWgrNy3a45pMKiPR3A3INGOu2+pJe0zXJU+Zj1lC+3y3l5ySFzUoJojssEqdiQ8l5NfKqZGcYEJn7Mb+DUC1F1ZRizIsEYbZUwLeMK8Y/DPSY5r6YLk/NEoRtuzC7LcwPwlMjNn96AhlFKELmGDZ//qDqu8UvCOx9RQ037G0TSXebYNWiULAaSgKufQ54aTRRcgGFVmsoOv52qYtm9f6seYmDnmy4nBT5w== 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 SEYPR06MB6311.apcprd06.prod.outlook.com (2603:1096:101:13a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28; Fri, 21 Jul 2023 09:47:51 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:51 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 22/22] thermal/drivers/imx: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:41 +0800 Message-Id: <20230721094641.77189-22-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SEYPR06MB6311:EE_ X-MS-Office365-Filtering-Correlation-Id: 8e42cdd8-88c2-4e7d-1846-08db89cf8c90 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fWDUlaltgJhgCnQKW/leisz7mhcwSFLJqiRPwHMzPdZ5GiWwdZEPzAQ6J48RJ6tKro9ie9UINTgmR4JQiZ6hQDboQ4IIS+nHs8SPah/eavS587oin/YnhCmDWLD6K4CE3X9NPAerVJR6qAaD98F0Zn+mit8iMCgiv6sPT41LtTLHm+UXXcXfG80AmUcZoa8j6fShetkB9A9exzDRNlszjDZwoEh7Gp6vpq1lJnaubW+UZSbB/7ph9+dpRWmcXiF/xoLSdSQA5sFY0KGrygLbSUYT8pic2VlelWXqdZsQaYH159SXJN43MmND+tMYQc5/2fSH47OjjgLY+c1k74+dIQ172A9IS4bXATzwqsUguCHtQvpWHjzKhM93cM+RE1pUVCtGoq/ovsAjC5xu+2zjYgUJ+QXOYiNUsytBweq77vSQ+LsmXy6BKF3ZF/Bo7BSzXde3DPwCg+gYfvHe3+SVwniPQ1HfY4m/K26ADmr2MxivARD7aUTjTaYtnhrESiIC/u2IItLtlLk6t6JYIJbOaDMc8y6eDUvI3wO6kcTrmBHQrBO2b/HRKL5rzuc2kYrB1de/3tryZbYPUigR6aQ6hgcJ531hIZlQFxC+Pn7Nw1Ge4kJXL6TrNtpYOnrLLtK9 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)(396003)(376002)(346002)(136003)(366004)(39860400002)(451199021)(54906003)(52116002)(6486002)(6666004)(478600001)(110136005)(6512007)(186003)(6506007)(1076003)(26005)(2906002)(41300700001)(316002)(4326008)(7416002)(5660300002)(66476007)(8676002)(2616005)(66946007)(8936002)(66556008)(38100700002)(38350700002)(36756003)(86362001)(66574015)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?j/lit1x+XffgJMhwl/844lV+xZkp?= =?utf-8?q?vM7jGGRION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NzoI7uUYLCioOEwbfJfqMAOB9GMOtk?= =?utf-8?q?xoGuxuXB9C7wEZ5T19Xb48sL1UobVtukvENezN6L8HcZ9J+MG2ATpYVP4AruhKYb7?= =?utf-8?q?pVhvZRujbZZfzQt/cuMP2RVCNtOT7F69jyAVBRURvYlnihZu2S/Zsx0RBzoxhAVbv?= =?utf-8?q?UtkkjMuR83Uj9TUf/jZaxGAV7+GZrco97BLzMvWjoE1ZkfCeHvaCoKghin9ZvvWaK?= =?utf-8?q?hzOZWdvyLwgCjP70VtYeEP8EKFyo3qlZQqOy/DjzYHKM1RP38Z3jvS5Unf/qWZZpC?= =?utf-8?q?GF3AyTRgzeNQ6imHlNCSsrnC5DsuTNDpbIKnul+Q5OvYyQXxfgACwVs9BKUe8Sjdc?= =?utf-8?q?QXbJwaK+ksxxdj/9nHmNv+3j6HblVkNBaow33+6Bv49Evl2bu4m8SPqBTVcthhCxR?= =?utf-8?q?bINLAjEdNmCQcLBOBmZ4b/niRHYoehT+XmdhU+8PeFyEzcFb/C8F5aQmvq//stIGg?= =?utf-8?q?zKQ+tvjdwTuftQVl4f1VsFe97x5Fv767/N9VRQSD8HlFnpNnIUiL67omqwLgDfi7T?= =?utf-8?q?uMn6f7hDvlDWAtco1t0tUJRgi2P/Z+a5FHeSql7jagxK3lfd+I4ZGtAkwAKsSUyVB?= =?utf-8?q?DiWsnScTSB40?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8e42cdd8-88c2-4e7d-1846-08db89cf8c90 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:51.4455 (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: P+mqNAlShJxMX1ySgcwgYiTsVmWdSj4jbn3SSliafoG+HmcsCinI20aXBLVnIoTQT4k7d9ZtwwJ0cNlbj08KWA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6311 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_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 2000 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 convert to use devm_request*_irq_probe() API, 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. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li --- drivers/thermal/imx_thermal.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index a94ec0a0c9dd..3131a09f9906 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -746,13 +746,12 @@ static int imx_thermal_probe(struct platform_device *pdev) if (ret) goto thermal_zone_unregister; - ret = devm_request_threaded_irq(&pdev->dev, data->irq, - imx_thermal_alarm_irq, imx_thermal_alarm_irq_thread, - 0, "imx_thermal", data); - if (ret < 0) { - dev_err(&pdev->dev, "failed to request alarm irq: %d\n", ret); + ret = devm_request_threaded_irq_probe(&pdev->dev, data->irq, + imx_thermal_alarm_irq, + imx_thermal_alarm_irq_thread, + 0, "imx_thermal", data, "alarm"); + if (ret < 0) goto thermal_zone_unregister; - } pm_runtime_put(data->dev);