Message ID | 20230710095926.15614-5-frank.li@vivo.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4912755vqx; Mon, 10 Jul 2023 03:07:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlG55f5slhHL3UibeCSMdu3cEbgWIT3k3//k0wtR00PIn2ajJ3KgqA5MwpjrDjgJRT40XXlA X-Received: by 2002:a17:907:9045:b0:991:c9da:70da with SMTP id az5-20020a170907904500b00991c9da70damr11370796ejc.61.1688983634498; Mon, 10 Jul 2023 03:07:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688983634; cv=pass; d=google.com; s=arc-20160816; b=eZdaU2I121Hm2/HQSc7jtNb7fHvd/dwOdFa+TjFyu/shDiCQO9LXktFvrAVf98lRl0 mURC/p5gWBMOVQImZtUOCFmYWo8iBjwyVwQxYeV60/606skbnm/IXKDShtQjrs3ag83W c8yAyrMFQ7TJIOq7kaMxERIkZIK1jS24a+X/nSO3upsYFDQmaW3uE1cBodii+tRKJ6Uc uYPjlmi0HadY9e1hJkXlh155nif2SreTkv4VZ7LGYa+AyWu/VeAzRbBZE50Rq9FiGWOV /Ej4tDAFXwOt5OUC0Ktx7qfoqWHebLfEVJwWxxOCpnHd0TVqm5AbjDuurmH1339FF1D4 nVPQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=s1Hj3E6IG7zyG8szMhWXzr8YNPdDsgk2wzcCR+rFIBw=; fh=xXd2o7xkJXVVdn15F8yCImK8oYCvSK7F4JD9mgT5ex0=; b=O6wV6jgEpwBleKR2IyCQvxtZHr2eUj5/ZfG2Hwf8IBOzhf0/sC8v/u68cKgzKJfHrl NpK1LheVX87KOn5btXknf1AHqSAehYXeqKNPUvTPZZqnQfnXDV3jxnv4YVxZfQwsf20j 7tCxeNS9Lpq+IqSF56uOR3QN/tY7fUNb6iZ/Ah51E9FOvMpd2E3fFgHa591jVC5Xq59K SuU19qVFmqTEiUnkgvo8fA+YiQXiPrjy4ejgO8+IT1hyIDGr1gVpG2AG0dWPMPzLTTLO IGEehj03ldOiFCdkZ67bjZia4Gp0TvIoFK5jYJ9fAExoHNTqnJHYvRbzGAcLUkaoBOAC jtdA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b="G/FZpuu7"; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m22-20020a17090679d600b009930c032387si3971461ejo.921.2023.07.10.03.06.50; Mon, 10 Jul 2023 03:07:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b="G/FZpuu7"; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231685AbjGJKCQ (ORCPT <rfc822;ybw1215001957@gmail.com> + 99 others); Mon, 10 Jul 2023 06:02:16 -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 S232650AbjGJKBu (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 10 Jul 2023 06:01:50 -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 3258A1FF9; Mon, 10 Jul 2023 03:00:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RdQJlTPCm5RPKWhGimlSoyNApw2ykcu1sblHHSFP1fWiOnyblNmJS5ufA6+xPIXGapgnTi8DL9PIMiSo/pspdzmYEe+fkGbXKc89fc1YXT+74JcnyH5BhrextoxlEz8gYZ9x7JMDFt3be6SMlzr+BoSH7/uSN784jgUBDlFLxVCADZIeesakOBSIh1oOZdNBmk+3RI+LjQqBAvevD1IlRO/up6MOZ+qRV5Vayq7I3IUpx9Zpbyzb3PfESuJTIZJuuqk6+4SNg/8OicxKkUR7QkEbprDw4aSRVxrHD9IHAThGtOJIESXiOxVq0AfGqhu3NaRVyiJ3wKgJqPio/oSQqw== 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=s1Hj3E6IG7zyG8szMhWXzr8YNPdDsgk2wzcCR+rFIBw=; b=fZ8QW75IkyVcHwdNSo98YUB8RsnOtBEyHbeo0zQ6HwPt6sxm+/jdrUahBwgeETZaug34/0cuc+03drNHKkHf8en7DQw9+ypuZRIbAdiRkV+JGX0ZtRXTKyKUI/n9jZjj+q7XVHA9CRU+fHaGkHJErJ5OXKub6GBUh1mmCYavc9Nh4uC54B9xEs5cwCViwzc/z5iSBAOYnaYsMm32kCKD49fVQc9xr7dAMFFzT6ltxSSjh/w90vYVT61gzfaCL9O14uy6hhnXXG+suB0XRbqSNK89lgbf7cUXYDkb+kvACO6BTrDmXa0Yr+S+nmvz9wTrt268d8cNUNWvqvkxshG5NQ== 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=s1Hj3E6IG7zyG8szMhWXzr8YNPdDsgk2wzcCR+rFIBw=; b=G/FZpuu7p2k52nGzYZoE8R9SWMD7B/GluQFwhKfKdVkyZV3R/HpN8tpsyV9r/72yYVeXGHQ+fOPE1WzpnCclymlMOLH77JhnL+hBv8EbCe9V9JfS7klDEfMejm8HVVi1YjpW1WCJdofSAOT0mXNueqHGudvcEzonBZRrCu6NwtvabBxO+mcNSZLDQEl+kBZsIOn7niAalQAjqOCEBKLaPVyf5clmtWd2imzi6pVRcubyQ9tDSIXmkHFQYR68KhiiLqXDVAqETrA9684Fmn9JerfrAbTrhBVTrPvdzsz+haLVMh0HqWLmxueAmWhhrxjhNbr6BC1VlGu8Bnn6/sN5aw== 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:50 +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:50 +0000 From: Yangtao Li <frank.li@vivo.com> To: "Rafael J. Wysocki" <rafael@kernel.org>, Daniel Lezcano <daniel.lezcano@linaro.org>, Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>, Thierry Reding <thierry.reding@gmail.com>, Jonathan Hunter <jonathanh@nvidia.com> Cc: Yangtao Li <frank.li@vivo.com>, Thomas Gleixner <tglx@linutronix.de>, Krzysztof Kozlowski <krzk@kernel.org>, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>, Jonathan Cameron <Jonathan.Cameron@Huawei.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 05/21] thermal/drivers/tegra: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:09 +0800 Message-Id: <20230710095926.15614-5-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> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: f0f2d4b8-600b-4955-a69c-08db812c6699 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BfInYk8hT9Mjqvc5dwfZtA0Vs9wI5MX8qXTCcE2Rn0EFqHChUuI4+W5PxcGferBrcOioI2qYOMUbTum7QULK7hE8ilPVNgoXBvKiSckfJ5Hftx9fTdCNDws8tR0APO92r3u8CSG/b0oRDHrjdk+JpOLsIXyziNlyxcWj82zWnmMv4zsqy6BRYt5Yr8UATmzkxjz5nPUhREBs67TgwDk6RDGrfJkso1f20gV7lscduucpv8avs6+gQoBNrfjwLUQKQz+wI67NuAvpkhdYffZWPkY0pS5k9deD0i/jYFP6qqc2LaoOvLT9G3BfoBME0B3B6lOPnRC+eNLQ8DTpAG2XefaX4Vrc9pY379sLgCG+VrcFG/be/r0cND+BIkrzJvXlesUfXTjtCcW2YoGvOwG3rbyJ3SaVQM3bgAILhX7qTbhHUrweUUHdNMSwibTY6qB3qv1HsCD7Y3sZ9XlLeY8/e7XQrpPzeFOzomtlUQiGQ7l0FwcZGYVYHmmQ40fr+opiFQki8jjO8qSBTQa+jqCh54HjNtI74KHmKDuslpMC+297in9O5E1yVFfm+jBHIRQUULX578COxN8azLrT+zoF+Yl1uZkA2itW+miK+lYIjCUgUAf+juQs+0V+2RHlhvZh 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?+vuOITZrF2u3VCeF2uTTNxMtdeEX?= =?utf-8?q?UGpf6oezNT5bskzsNBiVHTCt3Fk+1NgH4Usft5oFC2xbGbj9qhu966ahTQ5J3JMMI?= =?utf-8?q?8PJKEwVnDzjnKe9Lq67orU4zPUC2KvMmLau4kyPO5qKz//X1BVe+utzuMu3jSZWlI?= =?utf-8?q?JGwX4Ko8hBb/7VzMvNBC+UQQmC+VZTV9f2S8I8Q9nzYIfn9LaPswhjMyM0UAafOof?= =?utf-8?q?knC9OpWC6DYJYeAfwtgDmEpYZ2e3WWc5Zh0gFfdbZD3gzgcqCx4uZbxtjhkOjzn//?= =?utf-8?q?AjD6U/OReEiGkSdimX88YDh7YyXivVk5SGg5ew9X8D8MR2OR/rMUdWtsydMDDxCer?= =?utf-8?q?fsd+bszm3+YhEx+1pe095uVs7DABiwYK2pB0u1N9jCQaD5khrAnh0rMTQhRvyddeo?= =?utf-8?q?besRRnSxvGFvPjlwp4uM4pmzeFq5aDDF+gdRiIxvxvubJ/pZkFkFWfNUfngBke3wL?= =?utf-8?q?t4GBepRdcXyMU87t+qJduRXzHC/jCiZobshTayKrjR68yb5Pa7OZPa8AfFkoB5RtD?= =?utf-8?q?MrAAPvQCZ8Lt9/URY2biRo+P9+LgvduXWaWpIwk6bVS0EQKSLOrcEcpEDQHEKf8ME?= =?utf-8?q?EqERdG9DGjI6661MuFLy355lsFbp+FBsaHh4SfSCvbKAPSrbxsXgspQp+vWA764yz?= =?utf-8?q?HJlgQEruUaOZdl+hmZIPbSGovizpF4hsFHgNCTD8dznyX/HodmU/l1+2fHeJJLjn7?= =?utf-8?q?TX4Mrantuklg3CX3lezDHNYXYKk2hRYhhiX5MVzGvoMHTJL9//sZc9frH8HslP2Zg?= =?utf-8?q?Ga1npLB2lv+8yTmtFE82pTOb/JKQTYbxurKfXjDAeTr9l3rXb0rSLlu5o7lQrmofe?= =?utf-8?q?YT+12a16K/yCwsUhufnGMLpYnrCxgTyHsvsNq7aIl49lZUCHQlAf4IsRKdWcjs/PK?= =?utf-8?q?y2Jy3242oZJo4fViKnzRzoDw3jYO9WU/shTMUbx9WtmfdpURWosZ3BXaOcmO5EWrs?= =?utf-8?q?e2MawTUIruI6rn/dFxJvl0TUPixmUN4HJ2QSkuG3alaI9L61VEvnKAWgMgUVc0E/O?= =?utf-8?q?BxxqyiHRBHPcNQmnn5YfHeOIUG5oIROilQtmdXqL4IniNYgn1iDKPmpxFwIfUWwAr?= =?utf-8?q?9hN1pD6jzNkEp8+9Wqzueb8grW3S6zyDmvq9ZCkFEEyGE1sbLjNsLd0a63q72+2de?= =?utf-8?q?JKONHN+74ADRNr/47XveyBTtPAnJZ08Mm6s/0044UmPsmzEsVNOINwb8RwmyMTjz5?= =?utf-8?q?5zVvEwSYLDytkj9UnCFnFbBjPCdN4Q2+njaDCq968qhaCaR3cW0cScpnH8zZmmDUo?= =?utf-8?q?HFMehhHel7XOGPrLSmjvf/l401W0J7MEWWmyRqFo5oW/2qIjwtRgV6lEIP9EveYrJ?= =?utf-8?q?rsRyrYIO0lm1msnpREwFDO5xx5DGivusgum4T3xh0KEYrsdS7LW61Y/gUIHmU/NxM?= =?utf-8?q?38irIJQO2d2fEmQd4RIP8lyeoYKPHD2Q5HV7nNuRRRykDGNulKgBUUvQ1PfAExfx5?= =?utf-8?q?irNP8yvdebpuYizx4ceNlReVXDeTIcD117Ek3aNSYkz0d2Y3vk5nkJZ/P7ERpyBvB?= =?utf-8?q?nPfOI7slpPC0?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f0f2d4b8-600b-4955-a69c-08db812c6699 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:50.4269 (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: PvGobHM7xebvcbytp1JBQdKds+MxSgga8P9xZO3iFa0q4GePfYMh0sybv7lXNFOvy55lw58Rflif/4RTNC45qA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771027703689997594 X-GMAIL-MSGID: 1771027703689997594 |
Series |
[v4,01/21] genirq/devres: Add devm_request_threaded_irq_probe() and devm_request_irq_probe()
|
|
Commit Message
李扬韬
July 10, 2023, 9:59 a.m. UTC
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 <tglx@linutronix.de>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/thermal/tegra/soctherm.c | 38 ++++++++++++-------------
drivers/thermal/tegra/tegra30-tsensor.c | 9 +++---
2 files changed, 22 insertions(+), 25 deletions(-)
Comments
On Mon, Jul 10, 2023 at 05:59:09PM +0800, Yangtao Li wrote: > 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. Do we really need to keep repeating this same commit message for each and everyone of these commits? It's already in the cover letter and presumably on the patch that introduces the new helper, so surely we can come up with a denser version for individual subsystem patches. Other than that this looks good: Acked-by: Thierry Reding <treding@nvidia.com>
On 10/07/2023 15:16, Thierry Reding wrote: > On Mon, Jul 10, 2023 at 05:59:09PM +0800, Yangtao Li wrote: >> 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. > > Do we really need to keep repeating this same commit message for each > and everyone of these commits? It's already in the cover letter and > presumably on the patch that introduces the new helper, so surely we can > come up with a denser version for individual subsystem patches. Yeah, this is way too long to put in every commit doing the same but for different drivers. Best regards, Krzysztof
diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c index ea66cba09e56..3d144377d90a 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -1993,29 +1993,27 @@ static int soctherm_interrupts_init(struct platform_device *pdev, return 0; } - ret = devm_request_threaded_irq(&pdev->dev, - tegra->thermal_irq, - soctherm_thermal_isr, - soctherm_thermal_isr_thread, - IRQF_ONESHOT, - dev_name(&pdev->dev), - tegra); - if (ret < 0) { - dev_err(&pdev->dev, "request_irq 'thermal_irq' failed.\n"); + ret = devm_request_threaded_irq_probe(&pdev->dev, + tegra->thermal_irq, + soctherm_thermal_isr, + soctherm_thermal_isr_thread, + IRQF_ONESHOT, + dev_name(&pdev->dev), + tegra, + "thermal_irq"); + if (ret < 0) return ret; - } - ret = devm_request_threaded_irq(&pdev->dev, - tegra->edp_irq, - soctherm_edp_isr, - soctherm_edp_isr_thread, - IRQF_ONESHOT, - "soctherm_edp", - tegra); - if (ret < 0) { - dev_err(&pdev->dev, "request_irq 'edp_irq' failed.\n"); + ret = devm_request_threaded_irq_probe(&pdev->dev, + tegra->edp_irq, + soctherm_edp_isr, + soctherm_edp_isr_thread, + IRQF_ONESHOT, + "soctherm_edp", + tegra, + "edp_irq"); + if (ret < 0) return ret; - } return 0; } diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegra/tegra30-tsensor.c index c243e9d76d3c..dd4c2deba93a 100644 --- a/drivers/thermal/tegra/tegra30-tsensor.c +++ b/drivers/thermal/tegra/tegra30-tsensor.c @@ -593,12 +593,11 @@ static int tegra_tsensor_probe(struct platform_device *pdev) return err; } - err = devm_request_threaded_irq(&pdev->dev, irq, NULL, - tegra_tsensor_isr, IRQF_ONESHOT, - "tegra_tsensor", ts); + err = devm_request_threaded_irq_probe(&pdev->dev, irq, NULL, + tegra_tsensor_isr, IRQF_ONESHOT, + "tegra_tsensor", ts, NULL); if (err) - return dev_err_probe(&pdev->dev, err, - "failed to request interrupt\n"); + return err; return 0; }