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: 13321731 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-Chun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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;