From patchwork Fri Jul 21 09:46:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13321776 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B53E3C0015E for ; Fri, 21 Jul 2023 09:50:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231955AbjGUJt7 (ORCPT ); Fri, 21 Jul 2023 05:49:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231962AbjGUJtY (ORCPT ); Fri, 21 Jul 2023 05:49:24 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2119.outbound.protection.outlook.com [40.107.215.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A30FB3C15; Fri, 21 Jul 2023 02:48:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T2Bu2rAg8A/6NkmmK9oioxIYDuaiRclYMdhO4opH+NweLRn65QlEcVkrr0dLedcH7b9iVTTgtAcEs2vchZE3TLBBFqEcu8AaEpRM8Ji9y1y34sGIn1jZQkmqyDXFfrTSm3H+nj4BOXTkws8lCnmmtwCKPEI5pvAHJhpcJDIm/HZ2BBnDbRw9nGdQ3n1H9GkN3WRmoE0daxjgFZdR+vD1tHw3+OcndLUc1FUSX7lGjG9tlADtwcri3d40I94OfUEJXDelyzckvQk/fUs542eaJUp2rHnakDww5pGCYLFyUyQCTW9Mm65D5GKBAuS+2Rk8ae92uIkVql9rPjHgshRnAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=izFgSNRGswVrvbWqupaMcttliD0G0cUdm7n6fKfxdI8=; b=ND5iQn/zWgbaLBRfWYdwaIVt9yVZIvCqjCcc3yOfKh8DwMHk8dp64ImRWiNTy3uB1+0x1A4i3fGAjM2SDBkD/3hoFxeLQmFGiLNw35er2oEvWipyOwaVzR7+tPPdICBNTnX6lZ88SJ1+/+4gpm3WpM7w63FuNjKKaUiOI7CZjf7Gy2LOhlF8HvstLoq3hCS70NVac2u/5kFYS+TKw65wmmqwWuh+BPNC4FgwZN9X/XUhzNj/MUsDqSMjlXN+sRHgSQ7MxHhphTn7z9odeByPYBU4d7tWgTqjUMyET13qe+jNz7+9m3+WmgPr+Q1yOTC0hJFkFIQAcZaa4dC+DqMZ7Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=izFgSNRGswVrvbWqupaMcttliD0G0cUdm7n6fKfxdI8=; b=K6dNsgHZpXs6I4Z4Pgto0mACUwSiRC7eLCZgLc5JR6J6BPOxGZpluVePxi61HVcQG9yYEXadFNEFnSnf/SjqRvfzSnOlOztS1G37UEzi0r+wGrnA7XlRfoCDSi/YKSniwM+0otsYcx5z1qaC4ZIKz1Gii8D9zglSf7Tiodbu0Hb2xU8woSzH0exjVvy0MxxLkSo5LXtHJekMRVMBQ0JxBb1skR5qpCrNahnbGKWvXRcltCFSPCB8mJZpVeQzOXiEsRjCOcuS0AKzVJKMuTTOcSb352fUVKEWdCMNqgZbmAVxzTJ4Cr4KNV3qGlUCyxoPy0NGb6atCUB21zv+a697yA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:22 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:22 +0000 From: Yangtao Li To: Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 11/22] thermal/drivers/exynos: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:30 +0800 Message-Id: <20230721094641.77189-11-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 0357db02-0714-443d-f01a-08db89cf7b79 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: emk92A8G4Bu7gMFUnbodr9nLJUxYzuUwkYSvPoVRUKZRVSUrF7RFdvZg8w4VWtU9malvJcGTc+ept5A63CmlN7yA+9WxgptNquq9B0gEKfXsk0/usS6Wkr6ND9aQXCi1l0suMzQEbuXNsZ2OARQzTApcr+SmDBA1WRkb//kv90u1IYyow3S680DuiaG4jWPY56B2fyHG0bmAoeWUQIlgKOpUxgFH5lsJuUjctNascUnptddBVXvjQ7mi6o9qq4d/tzEqXvijCqcm0H8a+IfPxMY6h4t0v1Bj/A1PeqBRqmSwk2qX7YZ47LretDO7m4lXR8O/URiFgjRj0m+fhqkIjW++iozjIORjF4ChIjUWt1/3GO6GYBP0KFjNDUhcx9RRp6WquHaci7WgPPtvg+tMVLqRSSR5Nub8hgr8x5Mor9vkpc0vhgHCZhPULdage/UO2dr7F6NSLCyMeIHmU+V+3J+7z1zpvbxSgh5BMSTPEt9ITnlS4pA1uccBROC+UD2iNMnZ6015WfjAo+ij2G167rb9kSUC1bDpsTnyuca3OIUAIeH4qV3czn3pvSpUmrpv6F1xaz2q64F9FM7cnEyVMTj6UmqhkAnt/gHUKaZhtcjO8mQwW652Vq2LlyQ2+Wuc X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(6666004)(7416002);DIR:OUT;SFP:1102; X-MS-Exchange-Anti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?utf-8?q?UIBHSicRxZJ3GUjzsbFVJv2zVbUNjnHDCm/eLnBbdjPP8l2tUEmj5eMRFzqKC2D4n?= =?utf-8?q?Bdw5EkxCTKuf0l/AJhoOnxXo58rwCS/nQBP8bqX+hgX/riv3xxMDWbjxXnscKWuym?= =?utf-8?q?7ZmQtifD8cauN/pvpJM/kcYipX2Fm1Y9M8gTsNY+U6LvMKjCCjzfcqjJ3E/YnLmaA?= =?utf-8?q?0rtAGP8zf0p9nFy7BX5wb7PHOmEplGyy23eek7AYP0KprZn7YyivUBJWMuo/wGfaP?= =?utf-8?q?DQR+lUDhqxHpgciZhCESHVRniLJhRC5QkusGzwULfpcUJ5LSzRcaMG8WbuwxpYVuP?= =?utf-8?q?uOa95OjyuFar3XplHhfecwSJ3FgEFqrytoRkqBQ9AgTD57rTGtc6te5JrEScc1qYS?= =?utf-8?q?7h++zFQP0U74ReFoC8IN8gSrftVG5nUtLTub16PdRUGJSGPXly21fvX4o+t+fSAOB?= =?utf-8?q?9ONL+HKRrYf5GVey2XUgB3AOQIVC01tGYOTQ0TiThKIYpEV0rPC5nz8+xW9WxMwSH?= =?utf-8?q?PMTm9Qy4DbDtDTqT1UrNsx07bHFe0WXTl86NkDZK3eb6IuevAiARjTrjbAc/JGQzn?= =?utf-8?q?tfcimeTLRGYKEVKgDeDVUKoPPARQCkCOaQbmANFhpgGi4Bcai6iancTo+GSLUexkn?= =?utf-8?q?7uoIADKN65AvKXYnXBpsORi5MAOYIBIkR0OVIMCtLqSZ2j1z391R5s8UZTiT03c79?= =?utf-8?q?R8FBMDKFEre4?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0357db02-0714-443d-f01a-08db89cf7b79 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:22.7518 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5EVO4XBOLeE6hIhifWu7A/5dRljc5ycb2D+y3S65tEwJfgHbAjtkuZ+Kskou6Pv4lbiYeUo8SBO+S753utvyBg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_irq method. Most drivers only request one interrupt resource, and these error messages are basically the same. If error messages are printed everywhere, more than 2000 lines of code can be saved by removing the msg in the driver. And tglx point out that: If we actually look at the call sites of devm_request_threaded_irq() then the vast majority of them print more or less lousy error messages. A quick grep/sed/awk/sort/uniq revealed 519 messages total (there are probably more) 352 unique messages 323 unique messages after lower casing Those 323 are mostly just variants of the same patterns with slight modifications in formatting and information provided. 186 of these messages do not deliver any useful information, e.g. "no irq", " The most useful one of all is: "could request wakeup irq: %d" So there is certainly an argument to be made that this particular function should print a well formatted and informative error message. It's not a general allocator like kmalloc(). It's specialized and in the vast majority of cases failing to request the interrupt causes the device probe to fail. So having proper and consistent information why the device cannot be used _is_ useful. So convert to use devm_request*_irq_probe() API, which ensure that all error handling branches print error information. In this way, when this function fails, the upper-layer functions can directly return an error code without missing debugging information. Otherwise, the error message will be printed redundantly or missing. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li Reviewed-by: Krzysztof Kozlowski --- drivers/thermal/samsung/exynos_tmu.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 45e5c840d130..697d2fbdb1bf 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -1100,12 +1100,11 @@ static int exynos_tmu_probe(struct platform_device *pdev) goto err_sclk; } - ret = devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq, - IRQF_TRIGGER_RISING | IRQF_SHARED, dev_name(&pdev->dev), data); - if (ret) { - dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq); + ret = devm_request_irq_probe(&pdev->dev, data->irq, exynos_tmu_irq, + IRQF_TRIGGER_RISING | IRQF_SHARED, + dev_name(&pdev->dev), data, NULL); + if (ret) goto err_sclk; - } exynos_tmu_control(pdev, true); return 0;