From patchwork Fri Jul 21 09:46:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 705169 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EA90C0015E for ; Fri, 21 Jul 2023 09:50:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232003AbjGUJus (ORCPT ); Fri, 21 Jul 2023 05:50:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231942AbjGUJuT (ORCPT ); Fri, 21 Jul 2023 05:50:19 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2095.outbound.protection.outlook.com [40.107.215.95]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02C1A4222; Fri, 21 Jul 2023 02:49:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cqaINiKihsksGuzffqa/5orRhMAzGaDuCXo47dXRyUF7JnuXx0kWbbyILUWhOlkt5RknTiBgLapi/5QzTPIpKd/ob8L4yg8SNlbZYEk96dGKuezweUOEo6Tr6h+Zx4SbIzSWMI3SduqgkRvlkXzHwfSrQ5WQJb8WyvkA6i+IOaCMnDr82gzgzswwYWdD3/WAyClH4HQFVG6GH6FTpZubyUKwt1CtF2aRP/xSOkl6SemP1Hs/TIh1US9+biC8Vi9LztCOSo+6oMTU8QEXsTxDjWPdGgsRM3E7hiuoDMtHo6vsDIlYruSWpF4hcwtvdbDl50eGCNLdoNss0LGYrVfgaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LKc+TavFd7Ci1xyoSggA9UVGFRc6ndR0B+ijlcDKBLQ=; b=YklT5ULoEoc3vlSR05cN7cSYJcSuYqbBYf6V+XSdKogjK6qiufiEQGBDGjYMCrU0oSud4gfux3xLIND6UwtqPBv5sPEnz04Y1JErG6NyW+gwZoWAPwLgz1yx6pXDt2ffeg8Zgnk55QXW0HtVyENMUMaLuMY2yYPIpSEbzroPitpSoLvVOFDrG7boOO7vhbjbFUmTJqjHDak4re/oyW0I235Xaa1fzB/h+5ZWl5LH2Lxnpmpw4f5s3A1QFFjlN4GusgRx/IXTKXe9R7OboHKzIfuwrFGrx+WktXm9w2iv1Srbcdc7HL+46ut94IOfuMpnukJkz3jzIJfO0tPmfk16Ig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LKc+TavFd7Ci1xyoSggA9UVGFRc6ndR0B+ijlcDKBLQ=; b=S4UIcSfipj0LXdlHupYKxylrjpB/8UItARa6GgK9KzKrW+72yqxQ8pmDqAzDszam70srLQt8WrGujiaKpJv1Lu6XcfEscXbIRorvNtxop5s3oeKEkUEOrlQ8r9TQ8zdiu8JTyv65yd6UdFHUB4F8r2lgwLstfRUhSa4iBVAd/vJduzL0su0S8J34NYc/8S7qo2FlIbQwHS6iVRc0IUGH3VZucXuWcEcLYT3gfg9Gp9+sNJPZihiTW1+hWG00JYw6k8qOEqnPDkAYjVh+mIh0CNWEUSyncrXPDKQav9F2Oih1edv9GVrI5AT6HoGNMaS+5NpkyLX2C2ZwALjXCjYyww== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:37 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:37 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 17/22] thermal/drivers/intel/bxt_pmic: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:36 +0800 Message-Id: <20230721094641.77189-17-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: ffaa159d-3b1a-48ea-d30f-08db89cf8403 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +PGmhYBPSC8kHw55zlzS4NYAsJLkhO6VmXZTcB+vfVDtSNGJcPY7C3YiIeEytVjsk6Gu6sxINH8XBldrCGlfj+Xjeb7tiaZQMH75KonUFkxqSOt8b9ojBo/TUKWdXLkelSCiZTIVfTyhFvs7mQ7LcKSo5wuqeDPPZq7Mw3LWKuC1y3NCdbodTRh5eZH+coB/j0CnDsgCfUELPJmnYMWGi2F2gKW1rJvCIBAclMJg0ArgUEt6b5GIjlDsbIO4yh3xD8FKHh31HJI3VIRpaPUK8EGlh2aoH2cbU3XnXyg2EVgG2fdlbX8SkRWIR6mDjhLLDRUkxboveMXlTkMrGj6q5cOK9+qb4G+NrbKCmHsXdx9NlRrdmzmNDOaybXwtKAV0iQtNdPjEKP8I5GV9jCbm+7tTSVARnyusHVhcCLyAVplebPlK8mfsbQcjJsvk18t6y53BUlESwLBmct3suJuPIU7vLzSKx2eDjAdj4XI+l9lgMxwa/twOeDa7puG/pUm+wlL9olU8nD4J048Hn2+ta8jZQ4Me+N5EyHIJP9ZuCf8c7FqgFPdX9VRfQb0KkpT9fKM5+p/oB4lElvVMGkT97QksBCLQZZYlGgbbrbHixJV2yvKe+TrVuIfYAm8/OCDT X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEZPR06MB5269.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(7416002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?5TI2xB5HjnMMaKFG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tec0wvKn70/?= =?utf-8?q?AiWiloxfc3eBK9Yv7rZ8WRFFjM5aIZTHXarW7n8pxdgwUnyaPlj893vMgtvN7rpzJ?= =?utf-8?q?UCWnQP7eS1c9fu8QpwU7F7K1r53gjiw1jxrOt5ggUH9Wbi1bg88bcbukRoWIAz51/?= =?utf-8?q?kEkU5IHiFsvUz6otQlZXV/0c5xnjABNxpGd8cfewMQ2XFBg4yUVY6Lq7Z2ulZI4xl?= =?utf-8?q?ZJuBDo3SXcShMLJyjTRXCQuYlXA3en8fpRbUeDc6MbSVC8FH0cY0GF26jY6+qyxpp?= =?utf-8?q?NmbZ1YkpBo9VGMDR4hs0mYZJsASdWNH3RbxLLZma18ofG6x7gJC8gKu6WrUiZRVee?= =?utf-8?q?gijyVwg7UdwyrXtBlTHG9ias5Uda8PROEBCev4NyRtt8cQH1DsqxByFopGLYXa2Ro?= =?utf-8?q?VgS/YFu6JcayX+mTw/+a6ZpvfZgOKd7Ax4xm3gHATsLAc4aLK/DyB+2/QfGa2aAay?= =?utf-8?q?4lGOZc0AIp2AWTiqc0K/QVhGv/gjfibVLOuIW8VVvkIXQjTCxb2yG5PLOsH9316/w?= =?utf-8?q?xg7QtFxsk1DxWLahHVHs2OhH0QBur17ylIdYgsUgIsEQUgDnMtxwzSlYYx+Io7yks?= =?utf-8?q?Fi3M1CVwEvBAGaPM59pKpiibkmOq9u3T/DEmzzhnizgyY5AtdaRhNHjPq2JSWgvg+?= =?utf-8?q?MaLDNLoZ+M84?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ffaa159d-3b1a-48ea-d30f-08db89cf8403 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:37.1054 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cHAJRwKDLNhJZYqTT9f1rEEeDQ2U3uoNf1gmtYLHNdqZKI/8Y7DmyvXjizsWw/EQn7ohcc4n/XWYTC7HeTWDqg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_irq method. Most drivers only request one interrupt resource, and these error messages are basically the same. If error messages are printed everywhere, more than 2000 lines of code can be saved by removing the msg in the driver. And tglx point out that: If we actually look at the call sites of devm_request_threaded_irq() then the vast majority of them print more or less lousy error messages. A quick grep/sed/awk/sort/uniq revealed 519 messages total (there are probably more) 352 unique messages 323 unique messages after lower casing Those 323 are mostly just variants of the same patterns with slight modifications in formatting and information provided. 186 of these messages do not deliver any useful information, e.g. "no irq", " The most useful one of all is: "could request wakeup irq: %d" So there is certainly an argument to be made that this particular function should print a well formatted and informative error message. It's not a general allocator like kmalloc(). It's specialized and in the vast majority of cases failing to request the interrupt causes the device probe to fail. So having proper and consistent information why the device cannot be used _is_ useful. So convert to use devm_request*_irq_probe() API, which ensure that all error handling branches print error information. In this way, when this function fails, the upper-layer functions can directly return an error code without missing debugging information. Otherwise, the error message will be printed redundantly or missing. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li --- drivers/thermal/intel/intel_bxt_pmic_thermal.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/intel/intel_bxt_pmic_thermal.c b/drivers/thermal/intel/intel_bxt_pmic_thermal.c index 6312c6ba081f..1bf3e6bf8052 100644 --- a/drivers/thermal/intel/intel_bxt_pmic_thermal.c +++ b/drivers/thermal/intel/intel_bxt_pmic_thermal.c @@ -241,14 +241,11 @@ static int pmic_thermal_probe(struct platform_device *pdev) return virq; } - ret = devm_request_threaded_irq(&pdev->dev, virq, - NULL, pmic_thermal_irq_handler, - IRQF_ONESHOT, "pmic_thermal", pdev); - - if (ret) { - dev_err(dev, "request irq(%d) failed: %d\n", virq, ret); + ret = devm_request_threaded_irq_probe(&pdev->dev, virq, NULL, + pmic_thermal_irq_handler, IRQF_ONESHOT, + "pmic_thermal", pdev, NULL); + if (ret) return ret; - } pmic_irq_count++; }