From patchwork Mon Jul 10 09:59:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 701770 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 35E14EB64D9 for ; Mon, 10 Jul 2023 10:02:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231625AbjGJKCb (ORCPT ); Mon, 10 Jul 2023 06:02:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230116AbjGJKCC (ORCPT ); Mon, 10 Jul 2023 06:02:02 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2133.outbound.protection.outlook.com [40.107.255.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8114B269E; Mon, 10 Jul 2023 03:00:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lKsLFwy8HMtGOUtAagGO/r4Uae6z/ey9WL9StJg2x+fXyl+lf1a8HNX/a0ZRmD784oYEXHWG39rM4RqyYQHUUGp6/89j6FQAWlXBHY3cIDRuc7fK4mXoMi7PXdCKcmJ1g8mFJPyogqc1FUNh79sP1UelbEsi76k36YRZBJMdqYh+0VhQ4N0wQRyGjpbYGbV+Mi1SZGSuMv2dBUx95jffm5TKZzlyebWfl5j8ka6kKmz3NuIfrV5qF1KFC7gFdLs+SSBPnlEW5zu7t2Js9K6IrZa+iXMcGnR2ZqMetR77mBz3bbvgiOOFQJXKPisLZ+4Qd5GRh17fPbS+dHcjREGTeg== 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=D248ne9Yy+xz5Qu0zwOr53AYR//erHJNT+poSLKgvBs=; b=UwJa7KF4yxDrWpjJRln7eQX53V7DoVU3eFsGI1E7Jvjfkef6c+pxHEq/Om/UTqXZY/b2WdNcP8Rhjujcs00jTdF2iYXNYvMkG3q/9jItUNWKYKQOTNPdjce0w/gVnst/tlRoAU/VLH2BCN7p4+aVL7csYuJ06S6wJ2ygWATbHNI2cmjiAVpzaq3PzFs5NxRUVQxcxR5FKK/88YJ1XXmhf6k3wFnEncCRN2dXa16kSmdZFawHdGZWFNkFrllDbtyZXqq6ySOno7i0miOA1/GLbbV9GLfZtsUwNrsfDrWnPdSuGXwkIOcd8Sj0jQk1aNIsUAE66hQbZpPoA7WC5eG/iQ== 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=D248ne9Yy+xz5Qu0zwOr53AYR//erHJNT+poSLKgvBs=; b=lcMpkALHr8YFEgiMRhkhiSLp7BqPXlQBuG39sFHS/25FB3bqbDqQuPV+jLsDw/8tFJKARQnRZ7N/AOlK0Qqp/j7lfa1x/8KtyBP77xG6TCuBZ5VELQP+ALoPoTly9bF6cY6vXqnggp942r3YGMwgCP7SEjCGIVPp92fHLW1372gjDqmBYMunXkRTupxu60B8Nf3OQvvSQqX/Fxrsp/7QbkHpQ/uJab3gil5iAwDCJX9KRS/CbwJv+puQOSQY4VJNEqcAuku3QlM+LTfNTTtHgEJrd5hOw4GFCP+nV6lR94xQo6nV+/KOL8XvQ9GJq+hJ94rEGbBXkEU8iVKW/bEgeQ== 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 TYZPR06MB6096.apcprd06.prod.outlook.com (2603:1096:400:33e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Mon, 10 Jul 2023 09:59:53 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c%5]) with mapi id 15.20.6565.028; Mon, 10 Jul 2023 09:59:53 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Andy Gross , Bjorn Andersson , Konrad Dybcio , Thara Gopinath 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-arm-msm@vger.kernel.org Subject: [PATCH v4 06/21] thermal/drivers/db8500: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:10 +0800 Message-Id: <20230710095926.15614-6-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230710095926.15614-1-frank.li@vivo.com> References: <20230710095926.15614-1-frank.li@vivo.com> X-ClientProxiedBy: SG2PR01CA0167.apcprd01.prod.exchangelabs.com (2603:1096:4:28::23) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TYZPR06MB6096:EE_ X-MS-Office365-Filtering-Correlation-Id: 67f6c439-3648-43f0-53f9-08db812c6863 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sPQa1Sk0D1aV1Fb8cpaCmgb57zgBG7MYKVaBW3/G3j7g3nEViwv9lbBZHYI8gwyHtDUF17Cj12d5c+WWWOWNP2GTGyJTkKXnXwOmBIolN+3gvny0a4DhKeGkni08pM/u5C0OncBACN+4GyVndZL3j//YbIc5y8UlM87cauMePNnCBfFsy9lw8MQwUfXd0nzxsbkC9MFbqwmC8n5hRB/qUkztSNjV5jLNjcjBhmaHSFxtfGep+rmQAnC2B9aPJeQOKf8l+JeEDXREKnHrcMZ1Z9pNVF69AjnF+gPmGw/Gj8ivBvPFH8O5d9Txp8NDuKeBfzsW0wvPrPY1OidWH3qdisBFwthsL5JUcMJnzWmGXsp/h580bSbw4mHF5MewFnUUAjV8hNJBgPdCyXOh19yig8YvheE6KfrZFaiia7rOAxKs2EM9FvQ4642w/UmYNCpa4Mu+tkZh7IFS0W8b2iqY0AS+K3Ev7+bvfvokowToIGxS9TN41aDh8QlUexYsHPO7F3zdbM8Ti41F+S/bzz+rEldxOWllhrbjrMIYKNbWy66wb/gE3EpIRAicbhCrld4b5mboqkkg7aOsL1Y2S0Jv+BDRHEDgaZo0/xfrZ/1I5gJHocGkPX6yIupVxolqA9RF X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEZPR06MB5269.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(376002)(39850400004)(366004)(136003)(346002)(396003)(451199021)(186003)(6506007)(1076003)(2616005)(6512007)(26005)(66574015)(83380400001)(41300700001)(4326008)(66476007)(2906002)(66556008)(316002)(7416002)(5660300002)(8936002)(8676002)(478600001)(66946007)(6486002)(52116002)(6666004)(110136005)(54906003)(36756003)(38350700002)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-Anti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DrR/vVl3DvV0qgdxb96xP/OrK?= =?utf-8?q?INuvqDLWGWfcAoD3WbFfaNpGqLdLW8IFaEZZlCSr263HMq3UQvmYuvXpLY9Rcr9qV?= =?utf-8?q?8zIR/FzuZbnjWzGu+fK/ftKVBU0ZJCIHg+1io1MaNqssSEB+sQ7MCO9CdWOm0NWBP?= =?utf-8?q?eYNEPysTZlNBrsBhSjpLvzFHayw/RwlXwPb+SAHW5RtPlamfpPpldTuVcLy1CPQBh?= =?utf-8?q?V2Ru5+4ciF+7G9zjudJtEM908svij1bYgZR1zlISVDd/vYwUvoaQNvLyZjUPVVW7P?= =?utf-8?q?RLI+rsPZAfPtMHk7xganKo4qhICJIaELQf7HVbPIk04C8YH2yVjT2a+bZiv6/816F?= =?utf-8?q?hpZ+fG/FD02lzcvCNL16uce4ZrJPqGklmGbk4EUnZVGW+mKWnEijqP1r7NE5xA50G?= =?utf-8?q?mgqVLBEuIvcxbmBNu6uLuhFBDgzsAYvz00U48ZNoT0ojORLjCGLiEXJRkEuZiF1wQ?= =?utf-8?q?+g1AM9UtTOqWH31Xm/ZvRB6HAFvAG8OO6TSx09TZ2bTAVWOHmEFb5Fl5PUKp7Lg8O?= =?utf-8?q?6WN3sLldCphb1Mk+YSaGpSJ2kkdtCdAe/YCjvNy/kHy+haa3HsfhlP9Mw4kFej5oL?= =?utf-8?q?93MTYQxV5eKCAxPMOUhVexf0pV7oCcXv/aoHmpL1ArIOzP5YqTahYA+14iqNfwo4z?= =?utf-8?q?JwY895u1k5auMVg+vfSC4H51GPXdcmrQVv9tMaCPOVmPVhh+7Z7b8RO0RAdlI3YOA?= =?utf-8?q?6aafgO0G+hBV?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67f6c439-3648-43f0-53f9-08db812c6863 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 09:59:53.4279 (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: pT2TwrcOwz5e1A/qRP5pDLNXJJUD9p4gqWstf9j5a+2XGtysEkZEgUKzK/ml7vRl/7mOepRs6ovppxUxCDFFxw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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 ++++++---------- drivers/thermal/qcom/lmh.c | 7 +++---- 2 files changed, 9 insertions(+), 14 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); 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 Mon Jul 10 09:59:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 701769 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 89B7BEB64DA for ; Mon, 10 Jul 2023 10:02:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232858AbjGJKCw (ORCPT ); Mon, 10 Jul 2023 06:02:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232922AbjGJKCK (ORCPT ); Mon, 10 Jul 2023 06:02:10 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2116.outbound.protection.outlook.com [40.107.255.116]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82F242716; Mon, 10 Jul 2023 03:00:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l9UOekh70PjWwE84uhkavOTKNAcMPNZcuFQ444I2ry/5O1deGl3O2qfAwThHETb7GI4xQdjrFK4QbcQ9hE9B7SoafIB7KrNnVJsCP0YJPWR9vg/oVsebSGHMji/+A7FZsV3jzhILs2JeLuSds808ADUFli44Gc9KgEl8MXbyx7fPCiqryLOyLfoCVW6JLLlPA0OJoDIR+ckPowQKpKM4GPiRrlP0YK+n5ILwCt5klD9UFbsuARnbfVxKZFxEz33qt5KC7JywGIfG64Nb0xMiLOQpf7l1roz4gqQXe++GT5dN9xyBpIAMt3TNrR1suH4p4b/IJfKW/ACwd5WZC/I/zw== 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=uHojIhWiIchKie5prnQ0Ii6NtBQrjHSYpApVgve/ZX0=; b=ZJhpuzbmOPWIhFTlzyqSnM0SFWqydqwVDZA22I7TcXyF+KH0pvAE/8tCaNqfI3PR+MnmoQy4IhVpnTm0clhykMGa5GHmN7C8R1Oaf4G1lYvmEL1NwuKZPv90fMtaew7fdZb9DKMrooseyGCZIsQC2RR4jQxkNhnb7Efrd4gvJffO3INKtES2NiSp9oDkM+XlHB18KnxpWouOk2/vyWjMgX8ju0gp199Cwvb9KOMqDHLwg2vA9UlZIuWqMoMN/0GComkMZDJymtcSTPX5NOI9jlZIGZ7dt5CEdOy9r1GwC4JVCYhVRtc+ECEBYAQq6OBRsFa9v+mhfMiesULrpHqrNA== 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=uHojIhWiIchKie5prnQ0Ii6NtBQrjHSYpApVgve/ZX0=; b=AWoZdthE0HasAo4m1BnyepY5KsmRzZ47py0WH8UctJCjefBXHoaNB6+Z+ZhPPZh4MQTzlTlwLafRTWsbmrQs/dJtZMsQcLUDHy4SHS3PWsT1aaU8Y0f5Pm3P2dvDScSLGA9PmcvOb2MiG+PQ9Qrrcis49DhAtZtNCKcWoxTosS9ftBUNNinHT6YIJPGOdyCLnPdJiDOgBvJPs33sOLASBb7elLqXijOctUTa6tmbeXWM02bBLHILYZJUnlZCokG+/hYopoXfT+KMvIyky5JnQZZMYVH2f3bwBZmks6CqjqB1YiDb1m6kOjwfWcv12eicYEp1ysQL6/MWP50eTQyXRA== 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 TYZPR06MB6096.apcprd06.prod.outlook.com (2603:1096:400:33e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Mon, 10 Jul 2023 09:59:56 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c%5]) with mapi id 15.20.6565.028; Mon, 10 Jul 2023 09:59:56 +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 , linux-renesas-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 07/21] thermal/drivers/rcar: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:11 +0800 Message-Id: <20230710095926.15614-7-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230710095926.15614-1-frank.li@vivo.com> References: <20230710095926.15614-1-frank.li@vivo.com> X-ClientProxiedBy: SG2PR01CA0167.apcprd01.prod.exchangelabs.com (2603:1096:4:28::23) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TYZPR06MB6096:EE_ X-MS-Office365-Filtering-Correlation-Id: 04e312a8-b6fd-41f6-697f-08db812c69f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YFkrTWieUWAi4Md00nGOX9B7it/08X1CH1GI+iBrjqkTn2jGPXZm6cG7yaR0p0D5N58fzg4z3jWFDdNsQMehDasRrUTDYZGlaWdWnBbjBNMHxmwkL27+Exdl3+6CyBfNphE6vn+1zy69z/xhlUdFVRrWgx8ZxxSVF7pfmNDdG736u8yIIOp7RwMyV3ji6U+Sonj8d/BVdlxeoUDkFapJLzYGRw45Q+EuXKLjm0q22hAT7Lr+G3Caj8iBsdQh6TcTJP6ZYNRYtNpSDGfuUY8yhSjCXea0mM/8kxPQuPGNXPdy02+n3UVOzizVDW3vTxcSueBsqKaPYaJCCRz1cwJ/5BbGID54AG0RMbOcyGiPWXrCSWaE0mHXAuY2ahn27pmbnTEZn/y4/kfJTBwX+vDQb0zZIGsezpwUzQqXxFCdarvaJxgJL+QWpcx8H8krThj80kPHRn5368mmZ74TkpXwE7jKLFX7BSfjrLHuFLrpv0dn0wMH/OdToJQXTRwUNNBqLVOj+2UhjuUeRt50rCikJHZY46LxvM8RkJxiiFqSxTOvsVYk+TCBiDM/ReLVpKPsVlcgW5mMz2Dia6O1AqMmsckF+EU5E1GwOV2Lajfq6/lmYQCUQpDBfovowcWMH8xj X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEZPR06MB5269.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(376002)(39850400004)(366004)(136003)(346002)(396003)(451199021)(186003)(6506007)(1076003)(2616005)(6512007)(26005)(66574015)(83380400001)(41300700001)(4326008)(66476007)(2906002)(66556008)(316002)(7416002)(5660300002)(8936002)(8676002)(478600001)(66946007)(6486002)(52116002)(6666004)(110136005)(54906003)(36756003)(38350700002)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-Anti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mv8RmIpIR2LXK0k3ud/us/ZJ3?= =?utf-8?q?m45PsexxRLAb815Yso3AgM3U60hKSRko8OpzDrGIs9tUHJ6zvIC8A36PyPK+tp1Q5?= =?utf-8?q?7KHBvq3ZKQzJzmlTranF0joP9aw+x9lXFEkGYsnkvnIR9VVrFDwZbJw1y+2p7cDst?= =?utf-8?q?C9J8qkJ3dLxCTfu8dO4uXqIiYMyCTDXNItLzk3sL1B63rxrxs0kTtTUPjEE5n9law?= =?utf-8?q?wNvuJ91Q3kLN1uT//y/GqqQ6Q2ttLm8sQWp8kxw9ryhqcwn1Inggh3/e23CdHp7d9?= =?utf-8?q?GPcDQnjr5i1VshYubb1nJX1NH3fbimTKsQPVN//9XI+JBeEJy06kfN5+Ln2kWUl59?= =?utf-8?q?OSheNGsxRHgo5K7dVt2qos4zpRbvEPq6D6TLZL7YJvib6+sDVSVX4mmXp/bHoY+0/?= =?utf-8?q?z0fgz220UFzDrC2pHE8EDnxFpKZjAhIjEKJj2R0vBS7BoFPS7V9COivMknSONiBut?= =?utf-8?q?lB6fpE1GSU37T1JjMAxfrlpU3X5hvAomgQv9TLktEMwfP6BYf4pszViCTR+/qt7iQ?= =?utf-8?q?myFk+E0y888h/m8xdWXqIILErqOOEA4XyVfaKC337B5ePATSOdp3vD+G/11eQNia2?= =?utf-8?q?h8ixGNrqtVd2uMCZocqCfQUHe3Zf0Az54z+lwH25Z/mCdrCNBU4c7FrZFc0yiIvht?= =?utf-8?q?29+SAp6WAgKd?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04e312a8-b6fd-41f6-697f-08db812c69f1 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 09:59:56.0434 (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: 4DaDiWgAIj0OpWnp5pmRMI2545Ji9XN6T8mjhdbZ0GkGqeJ6TwyMKWiKShsBViejSyQ/dZw7CQ+um/FGYxB95A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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/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 Mon Jul 10 09:59:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 701768 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 EBE57C001DC for ; Mon, 10 Jul 2023 10:03:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230163AbjGJKDJ (ORCPT ); Mon, 10 Jul 2023 06:03:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231886AbjGJKC3 (ORCPT ); Mon, 10 Jul 2023 06:02:29 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2093.outbound.protection.outlook.com [40.107.255.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57C2F2D40; Mon, 10 Jul 2023 03:00:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YRhCOsyAYjehsYJaK/IRHm02oBue935lJ5+SlrI1061hsbLmpnDGcE+1CMNWgt9TtQ1rOkvkfhwrP3HcS8cd64+6QGdb2JNK39IchxFo8CEO7krnRHHzT92RGGtqWZidtLenFyaD9Gb4lVRFF3Ro2SVoPLyg3KjGHz3ggHlYd9CLdzQ8J8Yxmt1Twk1HskCeEKVj6HoxBk/8m2pB5WTrR5sk6bP/TU9J19xhMIqjXXPd/kILdTg6g3IKGc3diDKE7ee+MiYOyAlTo/64FzoKfJywaTBObNe3HnI++Ml/zq3L2MMj5y9f1Qlc8qOxXikHgiG9DkkD5f/VmQig/WleWg== 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=kxUuQrEXdZw6IlOKbCkrCo57TBzdecPai0pabWeYUwc=; b=dQdHd47kGd02lE/4I3qJc0l2QPFT+AWK0oXQtsWNLRVt4k74oJlOEVHpUr9wmRCEdNIpFDslLbHaAbODxsibAbUniaMHmW+c4nP1RNoFOY6cjEr3TWoeUGIZvSvWCRakubI17oEK+QPspxhZ+gpOnH3qPHQHCxxLSigrpKghyncI4SL68iXPmAZGHFOUY4fHlJg4NzO6n+/3lYVX+44WmwFxhaVgYHKYa3NGozQImIJPxDGZewYZH48xtF4c8ebAlpUwNiTmpNjs7atYl/PbBXGOSM6Jq0inmgbcIrhDQ1umIadQ2iDRLOuivrTI4D2Lfnkwd4T23VZ5RXqfjwHG7g== 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=kxUuQrEXdZw6IlOKbCkrCo57TBzdecPai0pabWeYUwc=; b=NGuRIn7waVLhpRgej+F7sx0o9/p1qQIifo6oDyT+TY5/tPPkbGIXKNiQ8nfmiKu4cgN8rkUIfouAZDYcCqZ8st0e4ZcltTVsscKPxNDvskNyGDVS2HxnysYZHOwtG0i3oksEdHqxhvSON//YjV2NvU8F1m8aLRRGSoZC6EwYOSEI6Ywd5Dm77IdDbpbrqTp/8Jg1+O7aJC46/IyYCc1NcUQScNxbDrzLL3zwFSEakk2FXh/C16t9k7gP2ccK0ULEsXOnJ50OorwLo6YRlZchpeuqYtZD84k63lg60DxyghVujffredArPGlKUyRuQY0prckie5AFnohNP6ca62G8NQ== 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 TYZPR06MB6096.apcprd06.prod.outlook.com (2603:1096:400:33e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Mon, 10 Jul 2023 09:59:59 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c%5]) with mapi id 15.20.6565.028; Mon, 10 Jul 2023 09:59:59 +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 , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 08/21] thermal/drivers/qcom/temp-alarm: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:12 +0800 Message-Id: <20230710095926.15614-8-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230710095926.15614-1-frank.li@vivo.com> References: <20230710095926.15614-1-frank.li@vivo.com> X-ClientProxiedBy: SG2PR01CA0167.apcprd01.prod.exchangelabs.com (2603:1096:4:28::23) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TYZPR06MB6096:EE_ X-MS-Office365-Filtering-Correlation-Id: 04b33123-4244-4636-db36-08db812c6bbf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xKe63/FvUfXKdd14k2yPcUgM9Hz5VGoFRKPVmfcXruometSWUMjfXSS9kD0z2jGhQtbqXM1I4Nn0FjKi1ssKdBpzj+/XGYf7EHclxheP+gnzGthldQ0o8Zp2yNWEcyRu4J9kPYo9w93AX2A6Sl3tRWDnM5LFhv4Maa95TgKnjabxTFkdqjRb3Cz9L7pBLZfhffqSGYljjY8czURsgfhEtsb1c36uElnwj10//N91TxF+uANuZiCbUEtYc5nZ0VgMF+shFc6Ux5Jb1m8zmXnjAKM650dRGXgBjr7ql5rrrs+A3o1upE7T4qJoqnxeu8MYNhxckLTIj/aSeEypR5bk9dUDrnzyFoM+2gD2026IsJbfeCMtZhROCqsmEG2Fg9qthPds9RrkxJd/XDahbAP3LDiSFtPEJ0gSJ7dt/YW0zSCUlAWX4ynLns3W6T70ZBJ3IkP2iIFnp6+lh1EqvQj3vWoIRZScctl3KGKuVwdl9affccnyn9kutjaN/mo9KT0eq5Hlh3XgprzdjsrVBLz+J2+BvRCuPn0urezhIO0wIZwH9965k1PKnHuq1vXSzdqaxv5zjc3PFW2kmNJZnL6ZDni0/ifw+nWVINLhE/nGMzSgjFroDVdfKv3ydB0McCcz X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEZPR06MB5269.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(376002)(39850400004)(366004)(136003)(346002)(396003)(451199021)(186003)(6506007)(1076003)(2616005)(6512007)(26005)(66574015)(83380400001)(41300700001)(4326008)(66476007)(2906002)(66556008)(316002)(7416002)(5660300002)(8936002)(8676002)(478600001)(66946007)(6486002)(52116002)(6666004)(110136005)(54906003)(36756003)(38350700002)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?nzhzb6z9Cz1HU3nJdHDxz9sqmuv6?= =?utf-8?q?p38On/b1KCNpDQSBZFuXWh82yYIDfoSR9ceffSlI9Xs/lS1a+b0SzdKJXujcYYwrD?= =?utf-8?q?AuHXjQ85aMne4BDGmZmc83a8bzRGvJ698Er02Ln7kvx5BkjDXjXFt0mRaUHg5dy0n?= =?utf-8?q?XqX/ftdZ3RulvI9w8j9YX0tCcv95OZNSbG8dbG7ZmmfTuQWGzb8LZCkjSnrmkTjx/?= =?utf-8?q?SeaFejNNY6o612HNWy6IFICSLC69HozCvYrA2ITLb8OcefXFLZHncehTRaeGe3gDT?= =?utf-8?q?D06fdJqCpABPkl/zdM3Lwojp7PCAyyq032EMpHsLdIyBAAyBkZlrLgir5AW+ivLa9?= =?utf-8?q?6+iIYjtojM/wtcDlnnlu11Roh7rTpg8xAetFTr7TTuH+Pd1j6Qd+hiMFGC6Ie1OIN?= =?utf-8?q?UlA99UgmQy6uPfu8FL+RHpPsgzCb+5cOy9e9UA6NOqB1uYM155iesrSmlmO8/+bg0?= =?utf-8?q?lWdONuxYA1yEliTUb1NdjsS5KO9gT8NWgG6sCvACK+7NVbJN9SDihoK+mNOUyicsA?= =?utf-8?q?/zdMs2+7VSjfW53mQ1YzzFcNp2otjizh008i7+pTSx5/KxMvD+q4P6H8757m2hQgz?= =?utf-8?q?ZdVUHnJCas+5IDPQnkLwpuChO8WS9j8Bwvi3n6aEtyp7BzBZyIZ2p0GC5wYqC0SW8?= =?utf-8?q?uZLJ9rdHyhAHGqcS5tEfmscTeqxdL7804ROuTYF5FPpgN1NWkFSdrjzjuG+Kkr1rC?= =?utf-8?q?XEGCTq1eqXzXCE8/ImqHFOZunkeTtuu9OpbsU0vkdY4YVEZe/EGQX5XwkfIfUh3pW?= =?utf-8?q?kgxyBZNnbQxwXgZTbToH58dRMTLurUQxGnzp+jDN/MpzyNGesv8f4vAxngwtnndCL?= =?utf-8?q?mUxE6eB8BsZ74sdDKy7tSC73Z+apL/YRdmGNuM/UE/skrC29Ws4xEu+SCw4K83Srl?= =?utf-8?q?vtohUNFxcYId+FpvjFxtYJ+6G3I63DBYQPmBfPmbS3HTwvgukJULc0EYzMg9OKipb?= =?utf-8?q?nKb9akDfkdba+TUCbQN69D5gwv0WJPOWbRBTf6/MkWqX+g1iuSlE4/JKKa1shqQyz?= =?utf-8?q?IQETe6yDum+HHM/JOe08063ICV0WlbDgqHrIDxmO1280rZ4CR05NXdoxvfXKNn3R3?= =?utf-8?q?WxcB6lMMEqH5g6uSWo9buoqsm8uaFEemEIFvSrnKtacKpd6eG9v1X5BvTeY+gMOLz?= =?utf-8?q?q/dI6EmIFs7Cz0+vVlfgwCVAPtZO7Nh0J133ClCAmAsfNK+cIWIbqbb+9TrO26w2w?= =?utf-8?q?/xQ3LnGegbjThO5ZDoG0fxdAx/FFL2tlwbK7xlURMSfy1lXVY74GMYWDSEBbho7z3?= =?utf-8?q?WgYaZXbVliTy73PMW6nlAz95Y6Uohgv4dMSAleFq7P2rrNJKIIFMVC45xDruzHGuX?= =?utf-8?q?vO+vPXm6tg4bdrVPd/WuF+7DLMRIEfhmTX1JFHCoPpV0Xx1KYSV8YZ33jz1lF4wTa?= =?utf-8?q?eMffctZWa6N6Ij1auAcQ3TtwCAC96KNr0mR11j6Fz4bEXuk6IdGqdo/PJs5RalZL3?= =?utf-8?q?5wGH+bBRsls/bghyxzeuDQVO5d9eJisGjRCZNU4W0F1L+14YoGfNFReQgTf8L7F7/?= =?utf-8?q?BQGq4B73d62G?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04b33123-4244-4636-db36-08db812c6bbf X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 09:59:59.0680 (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: n6chmFM/9jW1OzGNIug6clFahD9HbdDgoYtbOpw5J7lAOwvQV+m0J2RL/0tk/8a7TNSDwr2nmHbQFdI/Mi/Fyg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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/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 Mon Jul 10 09:59:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 701767 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 B832CEB64D9 for ; Mon, 10 Jul 2023 10:03:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231663AbjGJKDM (ORCPT ); Mon, 10 Jul 2023 06:03:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230057AbjGJKCt (ORCPT ); Mon, 10 Jul 2023 06:02:49 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2116.outbound.protection.outlook.com [40.107.255.116]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B48052D70; Mon, 10 Jul 2023 03:00:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mZGNGbLWAdsfJQzEsJKK1I+Vv+k99KwfgVRZX637+54ukTIlYM6b0GQIvlfsv/H2+joh67yKUCBVyPsvurBy7/xVcItESOx0m3ExqZCkvPDE1eJTlIs/UhwYFehBnxNfB5jF4DrpC0gqlZAm99JLnFB2qo7GMDmIRScNlrXka5j3dBduDy6RMf2HkHag8fG7ztDqjYZIx9LYzAZ5pYdMAsKjpAB+Vep+MqsAk0T+R4Y0Q+uJr8GcMAmLHeHxFtyPujdovnYcqGNEHGXVNEwkH/V4W7wpbmAvWQgaR/ExIett2VHwi+WuOWpJHBZzI8zqhEO6iC1e9Eru6v+CTQEJlQ== 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=xb6eS0PaxW2FdVEkfZYti3txNl0ppvMkAmkHrLIDlqA=; b=LgfdDn5cI+msfQqApRLJj5QW1t9BCckMraX0NJUJ8Rmw1WIcU3kkGYUhcbAZWmDvDXhbS5qBxrWqqKzPrzbTTg1lxXWft1HHgsTLKTYJ/5SS1iS5MTmEG6PNoZzCN/BjywGvGg/gRliQUxe036qfck8W2E1bbj1LB63a4pbeA8Ndnog3yU7wOl/etoXSKcoHpZ2zV1babTeU1mpAwPIxETI4Zp2Ks7ICoUI0+HpNEES9UctrTb13cQv1ngScRqVHjRNeB+2MRnaC0d82b0ovcikA2ufH4X4hSTix4ZiBTktKBP+kvtFz5T1TUUma1gytv73ecOro5dz03GQZRkDshw== 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=xb6eS0PaxW2FdVEkfZYti3txNl0ppvMkAmkHrLIDlqA=; b=opyC4pOFN0xYgdK1N432pz/vgL41tqm+YfRyTu1h/EiP8/ovtJMrLSrkvbMPh+AfUTDgQFmDuJAGUF25gXlGaWa6SuWUpqCMAzqpGgaUfKYYBkWKhAFcqdaq5SwfOgIiA85rBuEktMwKVGwxs2Ul50yifVPGOZ/Zf2dyLqbR+DNCyZwR+VuLsZ0Vhu1opRuSD86CL2lO82jTgYKtvid5xNNRUxVyE97TESZQ7E1cgj/sJHkCUTEsNRCCGJfBtCJVIjfb+zIX6F5t3KCmfpY805hrBIKHOIyMyRNuv4mbCFVxHmGuR5fmf4UeSXpfknjLN6b08LCdSwRRkqK0cdZ8GA== 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 TYZPR06MB6096.apcprd06.prod.outlook.com (2603:1096:400:33e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Mon, 10 Jul 2023 10:00:04 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c%5]) with mapi id 15.20.6565.028; Mon, 10 Jul 2023 10:00:04 +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 v4 10/21] thermal/drivers/exynos: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:14 +0800 Message-Id: <20230710095926.15614-10-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230710095926.15614-1-frank.li@vivo.com> References: <20230710095926.15614-1-frank.li@vivo.com> X-ClientProxiedBy: SG2PR01CA0167.apcprd01.prod.exchangelabs.com (2603:1096:4:28::23) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TYZPR06MB6096:EE_ X-MS-Office365-Filtering-Correlation-Id: 9411cbf1-5cb1-4660-c7c5-08db812c6eff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ojWhGgu/i/UdOo/v3OHWeSi0yBG7NH/nwMhWW6J8kyMTx4VqLOUH82MQRWjWg2Wxdwbh9XXYLorQY9fpjLVmvfWBV7Hh74Z5ApH7px//0XxAmilMPeRMhoSiMtFtuVGCwfcIjuYxSmZQn56mb962hRL/B4FZL24If94AT0/giu/kiYm4qgxWNswdn73XstTVKjAEr43QpWfXZpyWWxAdPMU71noF71LYUCZtHZiuPezdfGg910gAoTOonJ8CNNlZxmnDj8po2cvLOWJL5A/gh2mrH5PjlZEgfrGviBxcvU5NkNX1+HnpcrhRSoLboO3P/mSuQk9BAnH8YvExaWFQCYKNpmPclHLRtlm5Rs9Pb4JBJ87mr+rfHB2ePJxxF7fLzyxW5qsfdnj35hKE38CuZbW1UIy4YuhMEeYAn2iLNsDEBmJlajQvrec0uT8aqz1DEmaJ+e+vURjSdZ/DLS1S22fdN9caxhVszGvNRsOO0XtovFDGMxCuGufcgZi6NOLBXR//jY9nLGuZhOBQ4X1ZkTWdYKhj1dh5MJW7llBkNedIS7XfnoPhyJ2ThKH8Z4u51uHeXKCBBtSWBaNiNJagqEe7rrJcyTdybq1G6co1GEsKA6gNBlDtORtsbKUOuakJ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEZPR06MB5269.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(376002)(39850400004)(366004)(136003)(346002)(396003)(451199021)(186003)(6506007)(1076003)(2616005)(6512007)(26005)(66574015)(83380400001)(41300700001)(4326008)(66476007)(2906002)(66556008)(316002)(7416002)(5660300002)(8936002)(8676002)(478600001)(66946007)(6486002)(52116002)(6666004)(110136005)(54906003)(36756003)(38350700002)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?8WVukFZYsleFzLNR+xbe4U3EK9Ls?= =?utf-8?q?3YmGAllVAmIE0MFNK6/DX+wSEvXcCRQwe0U76Rl480/MRiNHoE4/KfN9VZlLftB0c?= =?utf-8?q?h/IkZ2KbaUMNnAYQriIlIKGo1DOqC02WAsRHOJSVUceQa1nefRwE862BxEvpG8eBL?= =?utf-8?q?s+HkonYuEG6A/COEK/K73OzreSeQ6J2XhsNE+A0ZwMaA9Hm/E/24JEB9kSepHv3Mc?= =?utf-8?q?X163D+3et50P17kan/QBbSEbaRYmbW9ErRnHZIL7E1CNmqJMS6P0fhd3fAvy3SDKn?= =?utf-8?q?TiaYPAfUe34xVj6fuanB4lidElF5AcjsjhT00WkDwACNu3Tw1P7A+dTXkW0TxcRaJ?= =?utf-8?q?deMyIbnjUgIVoEFH0NbZl3aO5KTSTEwNRBwhykcDU7/by6TZNe8XJxrO9UOkbr/MU?= =?utf-8?q?E0gAx9xLhr6FzFxnKp0KtcI0bRbxnVguDKJE2UA9aPsh91Ye87cA0vCHDr5rHYXJy?= =?utf-8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gF1mAGbj+UBeMpsM+0iNMGfBath2vILsehVW1mJsA0NCr8drSn6uo1izhFpl4?= =?utf-8?q?yPdT1tlUblW2gbb/Pj+sqCXpC9y4tJhhY8NZjHIkyQJ25O+QBuviK0h2W9dCbMCJ1?= =?utf-8?q?XcqioHX/bV2+zUKmNnkhAnG1XnA7rW9/9kKFwmovGzfB2g6/m3cVJ9d9YrmZVcVf0?= =?utf-8?q?qOZo8A0qDnKS?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9411cbf1-5cb1-4660-c7c5-08db812c6eff X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:04.5437 (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: HtZIFT9FjTuz1y0tN42XEqIf72iw7ZbFN77Ay9ejNF0wWbxMy383uezFuZJD5Ah4Xk5YTn0voQa79Fop0O4o3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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/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 Mon Jul 10 09:59:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 701766 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 7A88AC001B0 for ; Mon, 10 Jul 2023 10:03:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232124AbjGJKDN (ORCPT ); Mon, 10 Jul 2023 06:03:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231521AbjGJKCx (ORCPT ); Mon, 10 Jul 2023 06:02:53 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2133.outbound.protection.outlook.com [40.107.255.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A36C1FEB; Mon, 10 Jul 2023 03:00:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XTUlB+KOaU6nAxL3Q7ST1tNsy6uQJ/eCBLlfwQdO6zFBpz/3PcOxgmQvKx8SCAN+X5WCZQXrYYqrXxA+xCRFsJTEOyZhCU5WJSRK/u9SDoxhsKVymxAPK25G87vdhunuh3Yvs8M6ReCu2f3f1DrMP83rd3Wau/mrF0LBWbHFCPUNVvYdUTxvIjrWuc6lLNvf2rCPmrinPXiFZEzi5HxoZnaKq6y9PZXRwYahtaXPweGJA3YmJFUTzwL9/t3EsrMj7ryOmdyjgGTe9CFEQy7UKFn5DqwUSLGcsbWhWb8JyD6UL+2NkQUMtqn5wNK4fJ/TsU+Biy79yR53eLX3B95CRw== 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=f/Y+IYV5b8ZmuaTorAO7hsd8tpWaVdkZ+BMEJ54HFrY=; b=YdewkdBVk9QI+bnQvStWkjUKsuwsmAYrFNqmKyQp6suaJxahVbV1G4bHRqDQr2nrXIkEMDQMYOUBGIb+65n4oncQDWD5K17ilxsdtpAWltcBy0mCPXeix+DI5yt+Rkz7apKXUVhrM24KrDH1fRZI67OyptoORjqQ28XYgp8xa7MbXuesj+LOfbD72d8066/e7EoDfO4WUebdHuYbiCLO78F9cUrqgRW5GThWrMK4KBNfDnh6y+pEcss34FJjSRHVUtG5lbXQmXUWdul86INFAR8h92faB0A0IreUYkM9/Aj3dCxM8sg+pp8Anrl9LzT+7jxEEfd+m9AtQgwJgqTrGg== 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=f/Y+IYV5b8ZmuaTorAO7hsd8tpWaVdkZ+BMEJ54HFrY=; b=KAowNc7ontg9jtKraywT4Qx8uL4vEscTt9WGtGs6eugThiV9EBESDLnqScbpi4Cy3kygGYdpc7U9TbGgWJ44cMlOdIvzLq01vzCMCao0miYkg4mc/oKt2A6C25mRyxlBacd3dc8bePxWpm/u5RpoCc9sDB43IpL4GvEtNbVWQpAlJV5LEqa4LC423ALhwbTbn36j/UzN0vtwt6Q4qoCW+uduenM0LyUCMgyRz/WyHs7yPLIWDbbrvLqR/j3mw2ibDNvLD2CkOZK7/rXVsDoSef5WZMk8cAYb5jptmemrXEw3OswFGuFYIjTl+kJRIQ+veqPPvybUJFIJJICCPJZTsQ== 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 TYZPR06MB6096.apcprd06.prod.outlook.com (2603:1096:400:33e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Mon, 10 Jul 2023 10:00:10 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c%5]) with mapi id 15.20.6565.028; Mon, 10 Jul 2023 10:00:10 +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 v4 12/21] thermal/drivers/rockchip: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:16 +0800 Message-Id: <20230710095926.15614-12-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230710095926.15614-1-frank.li@vivo.com> References: <20230710095926.15614-1-frank.li@vivo.com> X-ClientProxiedBy: SG2PR01CA0167.apcprd01.prod.exchangelabs.com (2603:1096:4:28::23) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TYZPR06MB6096:EE_ X-MS-Office365-Filtering-Correlation-Id: 633470ad-3920-4b21-3d2d-08db812c7249 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AxE+qo6Fg3zfBmsOnSXDefqXP//DrHiHSMXN+jUtncgcpYK+QXi9nZAyPhlY/5/SnxsYF6g4GspaA2iqccN8hczagfx/J3OtZzUs4nZeRTYHTmbE75VvGd54axDHLjgyrj0/9M0JaOZ/3U/5RtDd6ZQv1MrJo7HEha/mPwXLdjNtWLjIS9+wPNBgHXKF0quN300KWdC0ugpYQnIMG2tZM3SsDAp6T7Zq6TOaMAfgtbl5YOqa00zHPvKrdzksfGLm18v333+B0hMU3vonm9uF8q8O4VClc+gvncffO3al5aUrKB/4hb5BoxCJw6aVwiGOuKe18dj8l5bOTZNogo8vRjCH44LDpbuEbORZ/ZS0rCS5u+Sm8MWgtfkTq7i/KGnzDJwUKN9k2ae1OAAAeEMjsO38z3GxgyWIVYkhy+4oj5qHNir3mCO56/hOBt0dr/BL8cqmhOG+GTV4Q/Uk6XwiYnSq8UcQG7bea+7MYWiuK/BoPpB3GJYIGTSQLtgmS9gqz/9CLF8rpeuqRO27x0t74j3dnqq7XYAQJvbt20rYHXBmHksKYjrN6plUMMlMr/v+3aSSE0x2uvtMLZMXnQ2OUzarfKASf+l5xfiMc1APNEKtJ9KBv9b7HoWk9iTz1AXe X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEZPR06MB5269.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(376002)(39850400004)(366004)(136003)(346002)(396003)(451199021)(186003)(6506007)(1076003)(2616005)(6512007)(26005)(66574015)(83380400001)(41300700001)(4326008)(66476007)(2906002)(66556008)(316002)(7416002)(5660300002)(8936002)(8676002)(478600001)(66946007)(6486002)(52116002)(110136005)(54906003)(36756003)(38350700002)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?62fcY2i6jTjS26FAibYj0WM/a2L1?= =?utf-8?q?XC+mW15Z2TzCAf0Ly2qVpIlQ8c5+qJTdHnaFaVNoO7p9iMomz659oogtfLui9NY35?= =?utf-8?q?vv+eC7muKu0h4IhOkGANidoH+M57CbnyTOIaUH0oMMr09VZYdznisCGursmexvrEB?= =?utf-8?q?avA9qQ+04QPaVEyHJ60ehQW6xt/jNOcSTXVpABQGt5URT4kSxAEX2+LSfbwEzNW40?= =?utf-8?q?3aR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q?YmpVnBf/1u6iqnQ7AJz/hMVCJlyFaS24HBWb/v6OhaYpHITM+iZzRRmhKQ6B9KWBD?= =?utf-8?q?YO0vMb6Lyft29gQGw9GUgWdRjNMPGojTrmfWR0xQXWof7t/Uw7pkPNBeFaEOE2UI3?= =?utf-8?q?W02Ja76QTthoovtyPWfTF9/mD/5PyZd5lvj+PGtwvf79F4r4Yw/N3QZft8dcJOgxz?= =?utf-8?q?TYpm8X0LxWdan8YX+GxcB8ioeQlEBJtKaD5ywCMcZ9Kh73orpp+FSb/7PLqHAkElJ?= =?utf-8?q?SMsS1yq+8cV0NdLPkPMqjSnonyPERQilJXobd4K8XKodyrP2zBp0knZehZ0n1hB1l?= =?utf-8?q?jzF70iLxTb9dmMAibdiSbfxhMMjL73HAmxwRPhpSwVHu7uImR4BCqmoJBLX+xxD7v?= =?utf-8?q?hsjY+SUwZEoSJPNaWf2JmyPXFys7sYcBkTzUf23L2mSom9wU1zNPMzMwG1f+9IGQd?= =?utf-8?q?Zlw9lSz/Uvjk?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 633470ad-3920-4b21-3d2d-08db812c7249 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:10.0319 (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: WAmOEJ3SLbBPjUXaxIe+KT7JjVT73TctnaZE0BVZMhnWt/zXYGNzx01cyrsLANTyPQshsirp1CPCBdxuUUvBBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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/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 Mon Jul 10 09:59:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 701764 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 C3325EB64DA for ; Mon, 10 Jul 2023 10:04:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233034AbjGJKEV (ORCPT ); Mon, 10 Jul 2023 06:04:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233175AbjGJKDE (ORCPT ); Mon, 10 Jul 2023 06:03:04 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2116.outbound.protection.outlook.com [40.107.255.116]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0914A30ED; Mon, 10 Jul 2023 03:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kmg3uoddLgH2HqJ4Lq9wtmkTHazEPeYHk0yc60f7Zq8+YLQIbKTH1DGIwyie3W182vXBcd7FQ3F6rrLHXE1yirmTn7R++qhRPf5FeyzKVMkIezDZX7VRwLBY4SEi1AxCOkqiRoMkfVJNHdedJiWtBA+JTKs/X94K/6csnoPkmKPgbrOal6+6I4aV0c/uhLFmzHFc8xpjbtTMOqUkO71A84mUnj2FROlsTcvojAGGPrRoyHx76f9J+oEnWFU2gbtFCDWbb3RIkC+HXbQDUQyCfx2RoEutIAI6VsWtXHbMKKHVzt3KBqMu00h6W/vnVSGflQ55TuQPrx47bVw5V6X+kg== 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=z2bNiGiAU1XFsAzb166a8FEiVMJJWw+3IBnh7N4SJ7M=; b=j3DVgwAHwNEaKMtwybnIJCQ3vVFTXCoKlCW/ElXB08pUg0+roeiJRnG26cuHnrjDBgO09FcAvLRzNfgjBuQvrJfDsACi5WScnjdveLL31xcCVfdgwRR47D0g97xTaguy0Xr07d26aICULr+JTl+3vt9fH9Xk8cp90zoPgyhZ06eqz9xDangnXsqXfVvfZHvqx4sWnnyGLyMgrleEyNs72mwBJ60+ndg3QDsKv10yD+zwj/0UtQctE/QhuGQK42NMBP8XdjYDw55/pu/rujiNgJdrQxk0sZthYKXdKel3t+HWyTWsEKLGrgdh8PJJi5al3cudI0nFd6zikQ2QATIiug== 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=z2bNiGiAU1XFsAzb166a8FEiVMJJWw+3IBnh7N4SJ7M=; b=OTivwJYdrPsPuKlTbRSi7SdXPMYC56kvgKem8+V7MKZFNoNjz4PnKglGg1C5XXACLz1g32ufLpTf1aiBGp4DDw/u3q80N9gmnW+26UZnYzwpwOdEVR91UsQjCFGKQW/9fyTdzV69kgyp6ztYb8SImIBWTTnY022TYv6FvUOwTfv3HB1BRaXmjSbQ1zOTC0EzZqOJpvp2yiK0+aVCQbIeHeDIlLviRx/c3tuECalcQX7B/RL+YLAAyDF7jCB2rRhhhN3jfsnFhbY0p4U+Nz6kGhVu/NGUUmss3IgDSlMPz908u7/pxO8MGmW6MkSJZt+zAz5aP3CM1gM7SShsY1TkgA== 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 TYZPR06MB6096.apcprd06.prod.outlook.com (2603:1096:400:33e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Mon, 10 Jul 2023 10:00:13 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c%5]) with mapi id 15.20.6565.028; Mon, 10 Jul 2023 10:00:13 +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 , linux-renesas-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 13/21] drivers/thermal/rcar_gen3_thermal: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:17 +0800 Message-Id: <20230710095926.15614-13-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230710095926.15614-1-frank.li@vivo.com> References: <20230710095926.15614-1-frank.li@vivo.com> X-ClientProxiedBy: SG2PR01CA0167.apcprd01.prod.exchangelabs.com (2603:1096:4:28::23) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TYZPR06MB6096:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f49ba53-00f4-41dd-a016-08db812c73e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FGFxXNSk8r927CST4YDqi6bWtLMal84kHb1QTmR3jv+iCCQ7r09Qx11XFZOmL1vXy/+l0yIQbWBil1C/ZiES0QLoIx1XcgkVeErhbeHF7RUikL89bxEH+jd15Cars6rLcbXRYt5pIAcq7KNyX5fdB/CEWKOOhQe/hJuuttdQWLdfi9nNIjC6UO+Gr+Po7OY5Jx0nSvU1o8GBkEwwEjizejuHOM/VjkH59evPuAGctmeOxWt/oieLFDOsa4zzzQKg6FQ0/2DGSsD9dNHGkuP/jSd8qWm7LST6AvLxujD1ylam9SacWH1VV7i10jLKdP+J959lvfUZM6QE4kIhlFRiZrhpkNBM8wauF2UVVmGxxKaQ2aFlrEKVEqfyppQG8un6eCDzXEXd//AV+yGlVNZ54aexK5TwowRGhTLj+ZIGelDuHRrBf2rQgOwzldvUosHCq44asUBt2BlpBAahkXpB7+/2HlwQgT/+GNZzIVPrcx/HFJK2VdRqTFczgmvLoPstbPS0+xiA6AaD+n3NtoTVvN0rmQdFmlv467nxLlDEVzI6yChrhzhqgR16RMGCSJy/1qSYG8WfnSpy8fLicj+XnlRpZOPnTh4BPWAZjliicVGOF39mVCUVyGOmmmOrxUTM X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEZPR06MB5269.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(376002)(39850400004)(366004)(136003)(346002)(396003)(451199021)(186003)(6506007)(1076003)(2616005)(6512007)(26005)(66574015)(83380400001)(41300700001)(4326008)(66476007)(2906002)(66556008)(316002)(7416002)(5660300002)(8936002)(8676002)(478600001)(66946007)(6486002)(52116002)(110136005)(54906003)(36756003)(38350700002)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-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nqomPdqdxZ323BwhANf18qIT2LEO1Nw9?= =?utf-8?q?Ns2nu2aaR1e7XL6NOyrIF1y9CsPVaY6W7maQPf3sDWGngNWxAooseuJkyN807DbE7?= =?utf-8?q?9EuIDrdyTm8YDy+r3xnbmp1TU/QuMjT3mMJ9+nZmTJD2ois0HgB6qzpBUh4Fdqto+?= =?utf-8?q?6fV6D/eNu2+B8ly8lVqYnY83mt5G7K9u3Jg/ONEgi5AmxKMZpIzeU2w2lff8oJ0OR?= =?utf-8?q?Q7AodKaEivOt9/4Q4P5oJDrHqNdYX5W5RQMdXg8vHHP1TD829yGTSlykaHU4JmoFd?= =?utf-8?q?is8hIQznz4VjdmXW3IpsEpr2YJ24r19hYspXOJL4F8XQrBBOkA3O45UD5+r0vYHzG?= =?utf-8?q?wHAL1rBjLP03qkkbSmaEWNZNyhm2Kd7iYk+ArK66ZHA32OHXy/Sr+61/6kw/fwFfZ?= =?utf-8?q?xYrexF6y7eMSYJRKEPpkB/Z8MEIR2dBvtHg2n3M1bgy5rahe1I9CH7nvBU7jzAxKT?= =?utf-8?q?fk3up8wuY4aVjwoTIY0w7hP50nmQ5FaxX9f3McGJIGlvCZdGgYyChLk01ryGkseZO?= =?utf-8?q?QfdK23J5VQNJ8ivX2g0C7plJSAauqgvKh8GBuPP6nCA3Z70wLinkf1+YE1ytuNxrn?= =?utf-8?q?oXvFmPUwjozwJ2XADsSFzpcpOPxZlbQgwFJsKg+fM36EMPk4D4yrC5iBUYJ2LDe8V?= =?utf-8?q?RCsP6H82JZHg?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f49ba53-00f4-41dd-a016-08db812c73e5 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:13.0849 (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: jK3OZip0T5XvRxstfX7oP9M7m0NVbAiRX95lgWxXkEemUO7bVjk69ESr9BmGMecugVDNL5KhHmlQyJC5G/2+ow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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/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 Mon Jul 10 09:59:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 701763 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 720A5EB64DC for ; Mon, 10 Jul 2023 10:04:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233135AbjGJKE1 (ORCPT ); Mon, 10 Jul 2023 06:04:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230319AbjGJKDJ (ORCPT ); Mon, 10 Jul 2023 06:03:09 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2093.outbound.protection.outlook.com [40.107.255.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2D1B35AC; Mon, 10 Jul 2023 03:01:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=amPxAuRZMv3ZtsVpx+myWp1/MLziZKjYJTfSXl5VNG+gt8/dBG/m+3SrQlTioCSswpka4a3T2oNdIe7qJK7iq3IrjtX+ghdvULNVuMxbIrr/BcI75lcbWUfl8jq5xjUMPtgtUKyMVsFh0qavwSrEZZNjuGLXoHN4JbwY6qedOpCHrWGtzIMGui+Nz0vz5Ev86hiw4nykTC98Igtc41e7DligfdNI9H0LebqmF0pWV3jf9miFhMT8vZnnsKeTaTSRvko5nL+frReiUmWX+adZTOwZubMQD/ETWSUw6qrGRGjwGysAeHGXQZQpPfBzcNKEXZw5a3u+b/qh6Y1Shanq9Q== 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=DBRoJauV/Iz36ttzdDJcffEnVR9Q6xznDu7sSg4GC0geuVPAM0ZEO5nwphZwb7jMBaLdfShohN2yQ3AqeY1Xrrk+hAW8zr6rK1qaWfeLHMp4yWhaaUB8OKqlbSNQ9L5DXzkRIY1ld7N+lrFVmcqcvgKIWtSgwK+mTMugkohlCWTwYiin0U2iyUdcgJIGV99sZsMO9zU8rGTnQS9gX0tWz1idczG9GqrHqxzTFKmZ3gQjKvbWIL8CsjiIpueuA4S6hxJRFU7fwzkQjN0p2ASSQafDmMi0nr0SPNSE+76ANzKQmV+gxijda6WSdfojYuEZi3qhaqV7ZxSrL7OsxgwyRg== 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=C3T3PJZpJN/zn5aiM8lnacNMd6abAXvlnGkLKkUO62KUrwB3bisy+Pqs1f8cgLWL3XQvHsW2Ny8wZgDZ7xOYZUDkJm9wPTtGmanWbTTbFfW2H5Aaa3eYv2apxK2bHKyII1nQAuaTItIVFMNM7IefVWC+237lDmM3xM1h1UO0PYIWqLU3srYRXyP70ocJnm/NSicAjg0FF8rqmxHf58BdFrkZuHLgEkasRLv5VwJDsGChFMAvoaqv+emR3it+MUM3hG29aet56M4s/0I64xelAo36OoJm2pcTu7jzSzg5hFrGgCXClrPfqPJWoyOeAoQUmVWo9GtM0hq/otIDnTItWQ== 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 TYZPR06MB6096.apcprd06.prod.outlook.com (2603:1096:400:33e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Mon, 10 Jul 2023 10:00:18 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c%5]) with mapi id 15.20.6565.028; Mon, 10 Jul 2023 10:00:18 +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 v4 15/21] thermal: max77620: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:19 +0800 Message-Id: <20230710095926.15614-15-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230710095926.15614-1-frank.li@vivo.com> References: <20230710095926.15614-1-frank.li@vivo.com> X-ClientProxiedBy: SG2PR01CA0167.apcprd01.prod.exchangelabs.com (2603:1096:4:28::23) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TYZPR06MB6096:EE_ X-MS-Office365-Filtering-Correlation-Id: 23dcfbf2-5a46-4162-c532-08db812c773f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a8I1eu3K6KqQGqmD41urPvcBoQ9wIEltkQJe39hNYOKrZo6Q7CTUbobRoDrZ8GE21MNs6lieQy8X5D2BFylHSIC+MRWVEl/UvubD9RJKCDgtngJvRU3tC0tPfr34AAPO+fiWg/zoHcyoHt9+2MhGLVK987CzWcCTqBX6Uujt2b2FOQrpB6z0DT6O0owe3/vv5Ja29uoD4tekgmPHUtMHAE31qQ/WFfy7FwxZ0xHcgl2+z17pjAK8Newql+Ro/T49MzvVnqAkpvx9fK2cMZdPAbT6m/89qFBP6pmtM41F9R85hBbgMZRAJWP+5s5MrmY9r045n707bskp9+YSstr9yI8WeW7LlQJjn4FS5m3Pc2v3gM8VAgo8CZDeEU2833s+3NzPxpPBuPPO9kvsfnLVriPXJ0qFrjmWdUt7QFnpkgW1LuhSM8xQyedgtWF+YO9+rWW2LROTNwape2GfnLtr4x56aP8ELekZdybdmA9nIR6gtAM0wqRIEfPd5ei2RYq+A6q5JFV04Mte0R3y+5Te7Lqjn7a3I8Ca1pU6J9TXjARqZJ5lLwmIAofH+Vbc2heyVN84Iy7uP24ATaOvA4Gy/ihF14YNS/thC0mdc+9CnHGgqYe6nY4CgyRH1bl6ffIO X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEZPR06MB5269.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(376002)(39850400004)(366004)(136003)(346002)(396003)(451199021)(186003)(6506007)(1076003)(2616005)(6512007)(26005)(66574015)(83380400001)(41300700001)(4326008)(66476007)(2906002)(66556008)(316002)(7416002)(5660300002)(8936002)(8676002)(478600001)(66946007)(6486002)(52116002)(110136005)(54906003)(36756003)(38350700002)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?x6AayyocolREbQuhAymO2S2zBeCG?= =?utf-8?q?XPiNGxoK5jTyc5oGDk1r3PW5xoUjCvp/2UEtnFatVM0aWFdOrOgUgZZpvhZxPwEt/?= =?utf-8?q?f3neYkgX0rCi4loOg2s45HbYWD52jcUffobI4ZPQIhq79xouTzLMAcTFTbl14nty6?= =?utf-8?q?3+hs8NSMFNjUQ8H/Wq1ApqADbSJ9ZmRMpziApBMJa1LNe7PokuQzWKsD/jmwmsWJp?= =?utf-8?q?51E7KzjbsQX1T6XaAj38oz4ci6h3geBbQOUt5TJ3jsY/L1Lemg5eKE/t5dpI9IsFl?= =?utf-8?q?DZPGV4oHHrr4RxFvVmDtFT8whZovJGpWWNqumTpRXTVTUa9ELIlikO1bXddYLCFOx?= =?utf-8?q?VsTexeStYRrbQnMXQOlp5H9q96eieJbR4H++HSkJUhKleu5eICNEnkSeMAKuR6KTG?= =?utf-8?q?SUTABh9xGGyYIY26G/6oRQHsDEH97H4oKrUlj2UdDMxerdS20DlvAbPEPvvcKwqZK?= =?utf-8?q?ux82bvE2olCi/YjmU7UV98MTvYdXJS7rLSjKVJ3j7FBMnQukumV3qI81KBjIFMqsN?= =?utf-8?q?8vJsS8YOnzSBN5C5ndSZcedA17JScQGdRXnMFtuBXU1BohEdHCImA5V8Vik91RRqM?= =?utf-8?q?rJn1Q5arGwjYqMHtgEDIIOnv1AIdWzFrinED5zWtgvdjyr4VVe75zbPUe1NALZ2mD?= =?utf-8?q?c0J5uLdIHf98PKgpOQtOUrcOnCq/kkWbTZ8ZZNAGEk7hjsxVc5dW8wVHuR+iEsWPj?= =?utf-8?q?EaTOw/gaRqdDt8V0yEniix8iSYs41vlO5kKy4y1y6+rgikTbXN0dUieANbO2aXeF5?= =?utf-8?q?bMN/K5TmwjGAZlrhkORhFsWImsJmsArcNadi4tVByKwiBhrrhv97hnfhy51S/GUYA?= =?utf-8?q?1ZS81g4QrImt6SMolTNcV5TjlityQYMLYz8OnbKnOW05YC5LmtpaEM5+vESc1JeE1?= =?utf-8?q?2QvB0WLrA0s1mNHA0MU/z7SiplBQWLL+b5e3JwgMgNwq/hwH26qykpn1gQb3QPh+n?= =?utf-8?q?7yTJeKTi9F/EOU4mZ7RNBROHT4bgB5vzcxirlUrlwT9OEcK/q9pq4xeK96DbWtVhD?= =?utf-8?q?g3Z7lSYo+S82Tgyzz5FtgwoRMUhA1EGqWsM2qbVLibyGOxF3Nw7DtyE5R4wNQPdP3?= =?utf-8?q?UAWyCGvjpIrxy9xL5c+JhSYVoVQhoFc3VTsnDle07z8Tspa0em0nPff628p46o0Ui?= =?utf-8?q?jY1dDVkBc8Heaxjr5bXGi0mD0eto04EKegAqJrs8JlnU0bFfEfoWR0cmYlrTgwLWf?= =?utf-8?q?CPeLPpbD7m3VJmW6DFsuP2Z4n2QGHB4DogDpg8AsBoTShM9dCvNJkPBVNAr6aAWyh?= =?utf-8?q?K6YxODDjfaQ4r22Q+R4K/KfuP0/OgjL+GBjU5PPqemWwYKrJuxksOmbT5WYOKeeHP?= =?utf-8?q?HEQgITUZKpIYAq42RIx36fNfxw695z453BHFBDPr+en0adN0o9TytCsMwRqYf+SXl?= =?utf-8?q?gIeatkTk+SJIq580W3UnI9xdrAfkAktPMSr1dfHwbgp88YhcUvT9U4BRP0K2I45pj?= =?utf-8?q?AH623spXZp81yMJOmeR2ojWPQFA7bOWe4SD/AGI79CeU2dQ2yfF6En7we+HkuoQY/?= =?utf-8?q?upNDKuwobVzH?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23dcfbf2-5a46-4162-c532-08db812c773f X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:18.3848 (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: TIXbOWjlJ80Dk9egs0TsY20W0ZLJOCSnGrwM2b2dbMgpToCpwsOKQoOSBWFUTCDCOQRl2GyZ0t++LOnNKVXiAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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 Mon Jul 10 09:59:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 701761 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 0F058EB64DC for ; Mon, 10 Jul 2023 10:05:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230237AbjGJKFN (ORCPT ); Mon, 10 Jul 2023 06:05:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230129AbjGJKEZ (ORCPT ); Mon, 10 Jul 2023 06:04:25 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2133.outbound.protection.outlook.com [40.107.255.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEE12FA; Mon, 10 Jul 2023 03:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YDi8f4fhqBQmLo/w1erRj4h0KDlAtdnSYVvIxrxqzZptmLOvVw0oCGfXqxRJT2yMWLHiCk6wFbGmZPHwv+jGf+i4uRzAIBpkOnshebHP7jC1j2C/L2Upo9EjR8nXmfABFuPbSMc9mY2p34D0/6/n5qKPibxngIHOta95yf7Jb1Fh/lBPXuPUaqSl+kKwmjwc3fYidJfbLEcsnAhxrJ2RtJ1OFhhk6l0a4dqjBq9iA1RYZ8cOnsKeGoXfZt5YxfzJhoeXv7MCEJxb+x0iSu1b6Ebcth3IWCmrJYymTzX7X22P/axAke0hBUY3lxFAJI5Ywi4hbbRENZvTzJZse4/9Vw== 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=jbdgUc597raW8lebj/wdUJpRl7kmq9zg7nrHuiE6i8l/UcLXbrdnlcLBxenKen/FrBPMG0E4yGM8PNVS5D6ISW9oZmr06JoZiz3hVgM3nk4gZwjWSP6jsVeKZZtOg8ChQ3oOlbcP7IgLL6YtxI5kfjz6dA/KogeSC5eylREB7cMYyYPOhJaG/LPqlgDlowfJmK9Ztu8g8rN9swqepz5FDRD2r6GnqLa+9VReUc5plE2jJpm6i4Ucc27hwV1ng+1G+EX2myWesICHHo4ayN2nuchAF3L2cHG6jcSNJPhjzkzczHa5pJCIuMkuKjvQ+UDb24D3ACI50jgQB4us0vkD+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=q+TzYuEeTgIKdnKfQ77B8vedEfB0P2/z7sQrh3Z4zJE=; b=kiD7/uXVMCofQRZRkRX6QdEPamF9JqMfA1ZKeGZh2ReH/s0XEXen5Alpbwi069HZrEmwGNKJ9pGCt81SoCGON/onmU/S5TA1kfGCmYbK2KGEOPeiFbdvooV/Sx3bDYqPNUsGX2yvxDCtFJwB24CYdOS2g1SS6GJpjEKYDenspndmt3yI6g2wlPzz1v4OORXOFrtxc6zjgd5dV+JliHaw37Xpp3aRduUbp3LHgu7aJD9F2It79VEBvZyEpNmzLoGOhTDeiTdWGhov8z7g3Y+nngSEflq3m1K98v/ryph0xSu8DaWpP1upSvOH0FPEWSD3FIWr2sf7ovdMOyFaZJm3yQ== 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 TYZPR06MB6096.apcprd06.prod.outlook.com (2603:1096:400:33e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Mon, 10 Jul 2023 10:00:24 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c%5]) with mapi id 15.20.6565.028; Mon, 10 Jul 2023 10:00:24 +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 v4 17/21] thermal/drivers/stm: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:21 +0800 Message-Id: <20230710095926.15614-17-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230710095926.15614-1-frank.li@vivo.com> References: <20230710095926.15614-1-frank.li@vivo.com> X-ClientProxiedBy: SG2PR01CA0167.apcprd01.prod.exchangelabs.com (2603:1096:4:28::23) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TYZPR06MB6096:EE_ X-MS-Office365-Filtering-Correlation-Id: 50708932-a9ee-43cd-aeba-08db812c7a9e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6lRSknbGh8PmoS3Xny7ElGcMj4BkXGR6wUlGvJFyeGElbaP0+MxuEZVysx+sIgC0Tl9LrAnn2bMHfKSvqYIxDoURVajnmY2KoOUu8mNxcaTe6hgvKy8LG/2RvIx+Ei+wpuYcbTmdhy52anUfS1gVT62LKb397GM9JtBxQzNBIl8O/5rMgvCwUJGkFyn4GUM2+3+qirkqZBdciwPO/9qp4wA4iblD9VoC/DtGU7h/naSkfSnAPCbydxH6EZQLfSlpzIv95QdxsDe73yYndvCXRnWYJYf73D8bdPFtemKacq6w72ysCwpQrnrB5DrOtubIY7pBYN+cNogfEPYvMjilqyjTpcLf0ZG3MMDETrsPKvhGUByvkhDTSVEmK3SvOjJVdFqHOKUAvC+PteSwv0Jq2lkICtH3e6fF+WSCQbbbM4N3PF7/8G3vrtC9kMCen6nHg8F6S/xvlGU+BsAS1yoaqiae+E9CkZ/DPWYsjMtfpYDhIMi3R3T4szfHevmV3nln9xsaDhPJnbqROzyNpRfwnLnrZKPZxsqAqiNxMMAy4sBMScKEqmV1tDcs3DEusA9L2+bd3lCd1ubWgI8H8oNj2HcroyGBUaicMB2it75vLPcGOlzFmKDSI8WhyHH5okEb X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEZPR06MB5269.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(376002)(39850400004)(366004)(136003)(346002)(396003)(451199021)(186003)(6506007)(1076003)(2616005)(6512007)(26005)(66574015)(83380400001)(41300700001)(4326008)(66476007)(2906002)(66556008)(316002)(7416002)(5660300002)(8936002)(8676002)(478600001)(66946007)(6486002)(52116002)(6666004)(110136005)(54906003)(36756003)(38350700002)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?uY16imdcqOG8IwNJ2rMKw+AKLjtP?= =?utf-8?q?phfg0EAbDhbtkggYEEA1WR1q8kjiUbfDcYwQFp/m4w+RtVdhXJd9UEnxxY0umQSwe?= =?utf-8?q?fBu/z0d0jE7uNSdDfsclhQERuaDwZPL5HPvSpLKLAWsUjnIHAoUAECd9keG1+fh8K?= =?utf-8?q?7BHfrFnST4urU6gaAooFocZgbSUXKkZOc0LTsIp1TJ1Fr9K0G3EDNUxqdZ2W5dnfJ?= =?utf-8?q?mUEDhExcc98F7y600vXPngPYCZgurRLLi9khOwecHSB34RTg0x5d0syjvtmIQEP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XNlWrv8GV1Qj3Ft66laU3ycEfPlpufp5qrKhqvLNXnwe3FXkSTTbXOIw6wneOYfy?= =?utf-8?q?++Vv4C9ZxhT0zTibZm5vhgn/CCZqlbmnxOEYEh5KFylrQs/FZeMcoPsNqX/1RLLNq?= =?utf-8?q?6ZvuKshWmTUcgX3eE4qqFf3uJhOsIM64gfnVhKGRTUxpRMAQ9xU5eaYdYn92tiP0s?= =?utf-8?q?dsWUsiT+9vIMQ395z+ahF+ogCXwpdSeFKd0dDRCcI8joAN1cwy/eJFVAeX49f3L6T?= =?utf-8?q?cF09qrGhnzVXo1m3ir6oThlF1LqP+3rwh/n7ZDXyxm8nRodT7TX1GE8Y9c0G0iYNB?= =?utf-8?q?WUAm9EB9CgASRqZjSi/Q9KboMqp8SZ/9nucerFg1OO5LQYauhs/Hz9BvNHDcUObq5?= =?utf-8?q?J4Gix5p9THYE?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50708932-a9ee-43cd-aeba-08db812c7a9e X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:24.0271 (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: 1M+lcwzHaiTgRP3rY7KrlwAvwU2zQZYM1X5/3OtFwJJIsQ17TrI83qhdF9LdmNb0dN3MiDqEkIIGrxQYHuR+pw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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 Mon Jul 10 09:59:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 701765 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 C3814EB64DA for ; Mon, 10 Jul 2023 10:03:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231712AbjGJKDP (ORCPT ); Mon, 10 Jul 2023 06:03:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230215AbjGJKCy (ORCPT ); Mon, 10 Jul 2023 06:02:54 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2132.outbound.protection.outlook.com [40.107.255.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA8BF30C3; Mon, 10 Jul 2023 03:00:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ef7+ROMWTh0e4sr2VXfIANsLrTmgoxScVa5pBQfiVB+vWFS5IpjA2xDfJkImt2TnCspqG61HYHGW1DDn4W5ICisid/VcQ6QqFbDcAywqEthtYyUbvnsQmH3uALZzh4djeZ2/pMoA3vR7u7RaQT1VmAHvWO6+PzLmj99ONTCZZ5LCu43l86dpV5Y8yqk0rBK3mJaQwTsEVee4BpNMqbTTFnoi5e1ktCCVq8SOGIMzjia1S8D5YfkkEPbQN8g0vPsAjQjbF700O8SgSypmX1jezyqqBJctHiLvPLPZJuCZpgYLCsTg5Y/lewqLNhkG26TFcpYtLxKFwEccSdlOOV20Mg== 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=VsmcWgX7BL4IwTWY9lLTCwHJynqqmrmN/xhM/6pg+KY=; b=EC4uu/z6rWt8MuwCs/STner4iglHL9/tRIRoDJmin/CBOqBDK5/iZ0QlcdtEEaXJ2YuMVoL4lmip2/S95AIO8FCCdczTdSmYZwmLEAVUJ9vE4zQblLBPxpp/APR/6hhc3cl9DJ3FAhmR2X3theAZiYJ0iEHv3tbiVQY44B3QAVaJJz6t97UsX7RkaGpcRysvcaQxLMnbMW5d6u0tU14+PizqmuPZOlIagFDy+8TVLnLJqPtlgm6tWRsoz4qYvmoiQ5ODlH15RQieKBBoAyLhN9GpdakFARV/xNSxWHcmykZuChnUlsLiy/ivQEnwaQ7g4ROqwRFQX+gW0i2zGKKpSQ== 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=VsmcWgX7BL4IwTWY9lLTCwHJynqqmrmN/xhM/6pg+KY=; b=Npugu+Vxwt5SlIZiAtnGDJyCr6YDjxPvPnY8gUwJfbYh5y4CEeolzlQzseqYcvoIHk3RT4QvNeBZm7w/Lmrz+bRL3SmInu3NkGoQ3dKsqOtYJr9MyV5C/qVhqzYPSb4AagB/VdpKAag0JPtdq4EXNuh6hIo5/JcyeszBvRMkAQ8RQXmMeNmQ6tqtZn2WEjCg8/W1Tom8yaYQVC4jm/qfQIoFSf+oJ0iAFj5uf7J9Z3eYF97Z2q3uPd/EKqzg0hsKrydXjlc/NFnPo64LpnIXH8c8P4dmaO6L6uHClPxEwzczy7y5lu77lEFd+SR4zIBPvkmLEqlUYJx5qGTADJbQRw== 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 SI2PR06MB3963.apcprd06.prod.outlook.com (2603:1096:4:f2::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Mon, 10 Jul 2023 10:00:27 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c%5]) with mapi id 15.20.6565.028; Mon, 10 Jul 2023 10:00:27 +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 , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 18/21] thermal/drivers/qcom/tsens-v0_1: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:22 +0800 Message-Id: <20230710095926.15614-18-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230710095926.15614-1-frank.li@vivo.com> References: <20230710095926.15614-1-frank.li@vivo.com> X-ClientProxiedBy: SG2PR01CA0167.apcprd01.prod.exchangelabs.com (2603:1096:4:28::23) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SI2PR06MB3963:EE_ X-MS-Office365-Filtering-Correlation-Id: a200bffb-c02f-4319-be84-08db812c7c6a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Iby14uBnVuIKpNoO96hqE77e78s+OOILCK471xzopGgkhPAC/Vzi1NQgUEIr4itx9cBt4IwnnFgLfDEiSW/ezFR66XEYANTVqVF3IN8C0CPiEi7Yu/SCP06SQKzkTd7kO+qLGEdBo6FyErdCB2jXeKvTPZUSh9mv9pADL7xUBMPpZ5WAwS3M0XGgF+SGuegfjb3U0LHolExY6Uii1+au+t1rCyMJBPfLkRi7GjAr9SW6m6mgq0J8GuREakdgWY5MJTdAVVED94eoHmmXc/7dYwd82vMRH8B5xRJ20M6ljuMEq+x714k8uGwISzfCQDkGJefUA/yfsdFJyTLiI95TlVEuV8yFgaR0TkEMl93SPDdhR9lxC8ttfEkq483gEAit9RBbWAFTJ3tfRVcbqKltwzrIp+WZGF+P+xu/xaLeEtkHVXLGW10gII+9E5rfO9zyElkbciG1LmXD/oV/o7i5eA9EQCAs2dJib+EOsSs4AJesDpw2J4blAhszHVF7HcyYz7lOkRUuff0WvnDRMUQsHYvd3Rlv9AxbvX+2/dAQR2DSoBqbEzzmA0uxHdT/LGSGH+ODGfMDpPhDoi1npNi12QrejvLQ3aPvumGucS7ms+F8dT73i3jFhN+kXpHBHTTi 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)(346002)(396003)(39860400002)(366004)(376002)(136003)(451199021)(86362001)(38100700002)(38350700002)(36756003)(6666004)(6486002)(52116002)(110136005)(54906003)(6506007)(26005)(186003)(1076003)(6512007)(2616005)(7416002)(5660300002)(2906002)(66556008)(316002)(478600001)(66946007)(8936002)(66476007)(8676002)(66574015)(83380400001)(4326008)(41300700001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ZZWa4HVs4Xv57LBYf4bu34iGRoFh?= =?utf-8?q?CWnHXvCcHOaSdwiBRm54RddiRLrx/vmoOUuePt0eP820Z3Vv7Xeat61kX5GA8VIH5?= =?utf-8?q?M3PJmvibtbO/pmoKHHKjyQvfhdPM7yKnktYxq9iUmsFWs/IRDRlU+vdevXedkREaq?= =?utf-8?q?DZmi1TSEfsxJNYL0KcWBOwnMkRoYaPyx/z7+lZ5bME4DnSau+y6seo7EQLedgNbap?= =?utf-8?q?FhmDxi4PQcYyVPa0+IynsEiykkgnbnyMFiuLgWZRPd5E9EUYufF6gsvXs8ImKAmKY?= =?utf-8?q?AGFJbwtPJlyJERDvaj4J9qgP8kMz0NGXpWB6ptKRoVc/mXgVeal0MTBFLD1giFZtF?= =?utf-8?q?/aXZHmIRIxBPCogCIbebiiS0DkdX0R4JSV0LbbTnRUJh4TZ8RSZPXypcZ7rc+uBfu?= =?utf-8?q?5vR6Zz4iK0ii9jIW3Y1kMFwlmEEHlmy6KaN7IyyLsEfXghI91gx2zPihDKhfqSXLT?= =?utf-8?q?JEMAbxmw0i+78AZ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n4NR6hwMvU4lgYrfxNVMHZiS3hlGvtu9Og+4BxAGg3D2onueh?= =?utf-8?q?UwKsIcImymkABEYqIbwheBJybLMaXrPATAz/KLKmbtcJgX4knOUPaqveRE9ZdZn75?= =?utf-8?q?jX1I/hK43eqewS/+jU8O2FR1ioDT7IRozX+JtS28GDkPrGwq+J5/mCa7WypLSVggr?= =?utf-8?q?jFfMrW2Be+lC?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a200bffb-c02f-4319-be84-08db812c7c6a X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:27.0495 (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: WB6MutGmOVom+xucUq4Olbw6uTg9admGaKyHtx0tPgBtAfZ1jbm4BWJ1HZ/iSj7qWpV6Nm7uk/1BaUAckMT7CA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB3963 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/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 Mon Jul 10 09:59:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 701762 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 09D37EB64DA for ; Mon, 10 Jul 2023 10:04:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232574AbjGJKEu (ORCPT ); Mon, 10 Jul 2023 06:04:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232650AbjGJKDU (ORCPT ); Mon, 10 Jul 2023 06:03:20 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2110.outbound.protection.outlook.com [40.107.255.110]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C6CA3A89; Mon, 10 Jul 2023 03:01:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KAE2w8x3Gy4WHLvpmjKYRA/8atOxvGzsEshR5sQb8ltMJFG/TbcDmw/Oi7RCaa2XPSLcMdy0lDzcYnPVr6JdJn3HpISLLC/WNppb0xz0UzRkII+dRi/POHrRaLpKxSihWtwSRuw9nonZVicK7vRoalRkpMDAmhN+hb6R2I7wAaxN9F+1L7pqIqYWj9n5yHr3aD0TuXH+LGaZ0rgA8tAzHIb0AX7Jge+yQWWHh6iOSipOt9fi+wy0wxUkWMqTqZvzuX5cz0D5qnKYzZp2rFn0BS3wopeH+Pnt4BSE24HsL1RxzkCqj7iqr1e6X8fVA3Ppx+wcTW8OL1yCwp9ItZ4FUA== 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=YgzuHLhDny5qo3WJ46Z60KENYJOUM5a/kE9LLplpCN+it1aQuEC0mAWNI9bCowFfo0YI2tpLIpfW7UUN5bmAJbt+1VvtD54zHfNBNk/yTbmJ3zNaUxSYRmfoIntGQ8yPTPiBgF7PHX//GfyT0e1d715SdjxV914iJ4fLltexRcoFqa2n45qLDYZC0v/WnCFZUlRlPcejA/AqDzIczp4SgROUgMnq5eApL6Qmt0WBRGoH324IBnyMUJJiIaTuRo0yi6pu2oWHD6p0cdEwgo6NBMfeMdqX3qXl8X9Z0RcOBBsHVb6DHzjTYgnpsTLGlV73gn2rdTBEeanUcvvbXH8mPA== 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=XYzPUgGWsLIsbgQ8JU3nI5zGGZqlK2HwSdaopqrOyHPwy5L1ZiMadso3bfvNNcab9pr5ap46KSIo4FhkQoqJs842DwW4jTeQUxdG51jfJNpvov5wjqamfpftzyCOmvD44bNHFn0c7LSJYSss/BAWcaWfEYIwgQ4/suEJmDra2LimhtW1G1qvG6n9gPGaJ2jNWSx3A5raFHgsXUwyhccZ4OHwjmHN+ZsWVQICuptp7OlUI4PKhIIOodwviROa4hsgA5FdYPj/j1j1IL1ZMjAIEGj5oSbuRp8BdanAlAuZg2weaY1sKlZ4iwEb339zJBRE7Wy9k1QrZpcvqaM3D1/ssw== 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 SI2PR06MB3963.apcprd06.prod.outlook.com (2603:1096:4:f2::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Mon, 10 Jul 2023 10:00:36 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c%5]) with mapi id 15.20.6565.028; Mon, 10 Jul 2023 10:00:36 +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 v4 21/21] thermal/drivers/imx: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:25 +0800 Message-Id: <20230710095926.15614-21-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230710095926.15614-1-frank.li@vivo.com> References: <20230710095926.15614-1-frank.li@vivo.com> X-ClientProxiedBy: SG2PR01CA0167.apcprd01.prod.exchangelabs.com (2603:1096:4:28::23) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SI2PR06MB3963:EE_ X-MS-Office365-Filtering-Correlation-Id: 111c1420-0d5f-4fd1-d28d-08db812c8218 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aaFCJ0GRr6hEhIaAfDsPP/NeN8f0IPCndZLvjGyrzyX1+6U29QLUR1YJre3A2mS7jZn4h5xu0Yv3iCUoNIZAKEk0zWZYu1opBf1pRxUydcAWIpFRC1Zq7RgYdOkNo5zNx3VNc5bxe6zRrR+eeWVElUUPiyioMq0pRnEzMBn9+NAIIUq+1s2Na29msxR8B2MJ6/hnty8Yh+tcnpT8iqKgjhxKsWULhET9Vd85wPxDTdRa58pHM/jLGycgk92lw714SvxehZIitnBovYbhn2XoDH/hfVJw+lxsCj+Z2IMzNjNU1W34sEycP3LEyZnzzfDh2n7a1DP249mIqZ71ULS6/pHBLM2uiT8izUfcj9bzlYMia7V7HfY7sDLN81bwuiqul7neNT+KQuHMEr16UfDVP02ae6NdwpKmFNhNUGg1BkCDDiA9xRZxWoDtjxgbbWPxa13Ycz4gpSnpmzxldaBtgIlNwah/iVUbFobUTBsOqERUNIGZh2nDkbx4UtlT8W0AYYWhzWtdkL6YL+QiPeLGhrrOx4XGE6l0GB1fEuqQ+2Ltmu4oQnqowVFQ9/14/AaEbLz+YwWEs6d1+emT3gxY2t66v7M0HVsXclIVVfLQyDSSDExqr/AglnEYALKCNjVJ 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)(346002)(396003)(39860400002)(366004)(376002)(136003)(451199021)(86362001)(38100700002)(38350700002)(36756003)(6666004)(6486002)(52116002)(110136005)(54906003)(6506007)(26005)(186003)(1076003)(6512007)(2616005)(7416002)(5660300002)(2906002)(66556008)(316002)(478600001)(66946007)(8936002)(66476007)(8676002)(66574015)(83380400001)(4326008)(41300700001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?WJo4Lywmvhp/Gn0HlmJzU8pQtdTd?= =?utf-8?q?kPzt8SEEy00Y9p6uMAlGljFwyLUq/lr75zdqbbI/wI67vWjtDllPMia2idK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wdTZ?= =?utf-8?q?Uf99vpyY0GTW3Fe7oi00KAKBjUl5bRK3lmlQudoxbEGJC5z/KqHkLPuYs4nJ3XzM9?= =?utf-8?q?SJ1wi3YlxoPwtpBNK71fUtb/B0Zi+gGGAccp6Qk+2FQWf/OZbJ3VTPExe9XdCiPMi?= =?utf-8?q?vV1xErFe6aHiIITQeVegRtKr9lbOpRGWdTiWTlVoYsB4aWDXipnXfmlDJBReXQHUM?= =?utf-8?q?f7QNOc7Nt7D450EPu4hnenCJoj/lzHFJyZZNbO12cOR5bGi0OHjgEsm5Anmmj/H1v?= =?utf-8?q?TiKXikUDV/a1GYZJ+ihbznvL+ivS6Bua92TfkJ7lJ3h8SQGJR0hYm2Qpx5puqjvyr?= =?utf-8?q?TeuF3HOQcl2zDYEomOz5Fkupuv7CC31rrXWzKW4KMpYS6EMurk9fsGOtSE0Haj9jw?= =?utf-8?q?QXJxmEiDWmY/74R2sIPPR6ZW5BbyHmfmxu/PfsSjn777ZaesvPXvlPFCtSCK53JYd?= =?utf-8?q?PfFXrD+qVZbKGNAuteorR6Zy1ft63WhjBe+8oO+/edoOz63OO8JcMGXS3ll6LiNu1?= =?utf-8?q?pJ6yi7YSVQCTF6QTxrnQg5qgUGyZ9prqDmun/R8dyHUmDImY31ZApPCyDFAYxqB2b?= =?utf-8?q?gulsgs5FV8h3?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 111c1420-0d5f-4fd1-d28d-08db812c8218 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:36.6174 (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: +cGO7Kwv0BXLdlMBL/xtRPe55oefXmKqxUPwmDA94Aw9tttQH0I4Mw31/DauTr1HOWvRYh/awEi6YHVgzva/pA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB3963 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);