Message ID | 20230721094641.77189-4-frank.li@vivo.com |
---|---|
State | New |
Headers | show
Return-Path: <linux-pm-owner@vger.kernel.org> 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 75197C001DE for <linux-pm@archiver.kernel.org>; Fri, 21 Jul 2023 09:47:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230237AbjGUJrM (ORCPT <rfc822;linux-pm@archiver.kernel.org>); Fri, 21 Jul 2023 05:47:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231555AbjGUJrK (ORCPT <rfc822;linux-pm@vger.kernel.org>); Fri, 21 Jul 2023 05:47:10 -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 871D4270F; Fri, 21 Jul 2023 02:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kDXd/CPMirmrO+1y5VAH2c7LX0EU8LQnpp8FpQH3y9WwiHimci7yC0RbSqvnTuGIiFEhQSBvZLUQJSIVCgsXnfAScACyWDuRD4+pO+dteVkbFARD+BM+MMk9a6MuUj9t57K45qO7ec0kqhk5s4LO6DEpdQGqj6AJlsGYuz0B16Za4aKKz8HLMyfHjTR5XC1/T3LsnAdxDQxQ4grpfkmP5zh4SS7L/ZbOkM70LfFU6zhbuRaoo220LX+b6oriZ32aTODsrDMK3ijb5EYbBejQSMt/vPQyAbGA2J5JeFxB+cFe8+oZA8V9jEmB8UWaLmF6vn+jRC8/XdeO3ANQmIlRsA== 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=OjfxK/rG41MW8xIM0n4h07DdTRX37piixiXYncIAkj4=; b=Ne6nVZOisOBoZ1H7/Yag2haTWq5quNDobNRcL1NAGihZCdvsT10TcGvviGGYkQeHLJvJCBroDRWlWBdMNob6OT81vC0rscl7txGcIn4PaqyHCvkhtmHio4fv2jGpt5tDQqmr0bW/N/Oj1YN5LinOHsC5gO49OSICu3SJMD5hxyaXGdFEhuw01Wn9Z/2BFY3RfbcR+l2B61xZzChpCDPR2yg5EHK3N+qxqA38TBzK2xDsCWoQ3bujH4IZTijBfrWprjaS1dCMNM2+FlCOTgiCSRhzrbtfUNhRLR77Tmu05kllfFq4iPUAywoR3QXZ5f/pU+2moUqr7Lx9/0/0mbyezQ== 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=OjfxK/rG41MW8xIM0n4h07DdTRX37piixiXYncIAkj4=; b=e+8GAP9DxQENM00UXpAQWRd2hHCR5SqBmD+Iwc9E1ooecbqOKto43uVdUfAUsaVWzGJ+NuAl/1sJowUoWF0UrRifOckhp0yQr/1YR4LGVs+15fDGzvcG348evNFz8n12PS5J6Bhn9waG3EYBRrC8OqsQGzKb5WTLouWTt601J1smK3IMxM+o9i9d9U8m7yb5AgPnSzVn86JT9Fe9KeotI3Uv/RIRXMOB5KUn6GEylabPUiXoMX2wRZF31X1LEKuj/xPzyn2EYT/vPTcAyiWZn0JUjEfpNHvlpDZ/jWei+Fo3ux6fTO2YUivw6fb+5GHnPj8hL/foTcY7g1c88Tfdrw== 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:04 +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:04 +0000 From: Yangtao Li <frank.li@vivo.com> To: Markus Mayer <mmayer@broadcom.com>, Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>, "Rafael J. Wysocki" <rafael@kernel.org>, Daniel Lezcano <daniel.lezcano@linaro.org>, Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>, Florian Fainelli <florian.fainelli@broadcom.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-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 04/22] thermal/drivers/broadcom: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:23 +0800 Message-Id: <20230721094641.77189-4-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> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: 251298ff-5de7-4960-2ff5-08db89cf70af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: csWfH3CDlS4Q/rOIrUoJlYR/FVBebOJJXmnfcteUKGJDSOXklyrRmk46RVkT95zga50fuLc/4+v7k5L2/FVvTQQjnnO+jXFO/8CgjnbqNwmTzXOrzCDyDWk6J5GXtupBPbW0e9kqH7UHBBQ/TDVmaKM3htdIiZ9GTd6FTG78OjQXXJ2j/k8JHAWz/xpc2TsMefVwrXcRiSNwrgsPqJq53ATcgCqR1xmbHGeJ1g+nGCzLCIfRQC2YX4gwSeGljdvagMe+KIHXAGES4XUoLQyj0N9WhdY5eGUhUDx+28gTuU49pODQihOuLdbMDPlWRLVwnas2WSuFw5Pc/Ar4ZDiQGsrs6kAsbF+sSEKj4M8Xl12FUKLDqcD3tc+lHCSJfB54SFRww8P7XWHRpVUr/AkOEMPbKhiPkqiI7wF9PKL6keFaOZzo68IJN+7L9bgOn6Kz7jQZ62wt2vFI+Wy8uSWPKaD/oi9NdXyp8sr5vZdj9VtkdWe2ihvsY0YNAtuGPinlj+qY87BRxVtmNbufUJw7qD+4ViLGRuq/rsnJ0Lf96Ty6JnIP/MQBe5KQk9Pid4sfZ+XABTHEB6iArmlcWaI9Tanf1nfBbVMAucn/NWIPYIUbeONe+wMPEZCE5UVk3cLR X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(6666004)(7416002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?pcJz+DlOsLYTMO72BSk1oiS1D3YY?= =?utf-8?q?Z61GcCQs2Rd63SS749EOiia/vlYnBbAj/2mB+GVksLEhhmYYo+JHRlZPenSpWNQ+o?= =?utf-8?q?ey/PHiYrGrCE5T8ci7kzcuS/eToWpwVl0u3+UC9kz89s9gE/ROPZtxBULWiCfUKIG?= =?utf-8?q?CHr4V8SqXiGafzosm/ZefQtZ81KfkBfDFJ6UvG9WrrGFbvPQ/wfqzUqnskhI9jm7f?= =?utf-8?q?4/sR3D9JfLa/WeAiYe4PINsIBmmvKSEONkmOjGmalZ/65B5NF2POw6j1rk3sZBP4f?= =?utf-8?q?09KWNIIKuoDGPw+a6chhcoeo6eO0kQrCmx/lO0ah4aBXUwX/i1SI9jbtbdlOUtgKY?= =?utf-8?q?Cny6YYNrsBMCl0/+c+3eZ2Nkq3HCGUkAw+BxkZmS6q5Z/9ZDvL1ql45b3jaXRbbYV?= =?utf-8?q?wnSEl4R/svvConOMispxuvzvXCzEmBSq0FZEP8PTJspiDJ0QZSrgyrpycET56KzBq?= =?utf-8?q?SyUTY3CBx8E7YzzJv6YRA2V37G+exhVcLrGt3tvrg+OlSyHeusDbBNp1ziluOgGTX?= =?utf-8?q?WQ9AcDcFHYyeu+g1+5G7OKdSXdYPmlXG8RHXxvv0TlPEh5QdSJAArXd36ASUsK49x?= =?utf-8?q?uQljoDS2VDu1K4CV9rbPLfoiLRwZhpn0JMYwTCvht2A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4YhLBYdncHo8+CrujAL8fu?= =?utf-8?q?1EOa/9P5d/Bl?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 251298ff-5de7-4960-2ff5-08db89cf70af 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:04.6538 (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: TaILFn6eWtfhLoaQNiFFPimwnJpDkxzmQwFeY95M72/kvVNlMg30+EDAdO2nqaK2gxIVpSLc89Kz1oDPN+C3kQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 Precedence: bulk List-ID: <linux-pm.vger.kernel.org> X-Mailing-List: linux-pm@vger.kernel.org |
Series |
None
|
expand
|
diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index 72d1dbe60b8f..ea37e7ee688a 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -349,14 +349,12 @@ static int brcmstb_thermal_probe(struct platform_device *pdev) irq = platform_get_irq_optional(pdev, 0); if (irq >= 0) { - ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, - brcmstb_tmon_irq_thread, - IRQF_ONESHOT, - DRV_NAME, priv); - if (ret < 0) { - dev_err(&pdev->dev, "could not request IRQ: %d\n", ret); + ret = devm_request_threaded_irq_probe(&pdev->dev, irq, NULL, + brcmstb_tmon_irq_thread, + IRQF_ONESHOT, + DRV_NAME, priv, NULL); + if (ret < 0) return ret; - } } dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n");
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/broadcom/brcmstb_thermal.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)