From patchwork Fri Jul 21 09:46:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13321743 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 DFB32C0015E for ; Fri, 21 Jul 2023 09:50:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231670AbjGUJuE (ORCPT ); Fri, 21 Jul 2023 05:50:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231822AbjGUJti (ORCPT ); Fri, 21 Jul 2023 05:49:38 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2103.outbound.protection.outlook.com [40.107.215.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A2C13C1D; Fri, 21 Jul 2023 02:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XaSvtVA8WOU9YZTnb9NU4Cbw3W78DOV1+OdVlVuZ0ky6WIAy3TLk+36ijwKLToONA4hF9G9BAoHte2S0TzVeSDLk4wzJah5vF2bEZ1Wf350WQeV52m1o01ALJQZSM904JEZ1+/qvVRdIGqn3tSl46/h/RK3VUlesGbAN31gCamJpNA+rySUIcvoutmE12PWc1fSx+tYetiSBDJSEqB7BKLLKXSoO46AGnPXqp7oNwMpzJVQZsCRfHsTkuj08rxvnNbekZ08qsSQLxLwqxHklGqfRNjgHcnPjbltO9xkU9yShI9mvrZ2+GsK4pfv8eyDNoh7pQIzU8rkKt1KCa1V8zg== 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=uDVGgpitxTT4QdqfnkpzTt8ouLLBgOS6RWAujk0isLI=; b=C5CbYOSjPBsoBhb4e0e39IyZEGIU/Yvo6a9Sk/fqxi5X42XJwQHmkFkA9jcFTDFne2X+WGtLEMhC3j21cAZwzsk26Z8XCL/tli4AyrefuVn/crvfYvq63MhOSqlVHiyu+9AWK8vMQVpSv16GQohdNTI3thmsX9gIe7M/YsPjEjHFT2hxiVSouIg4dvV8enWS/di3Keo9Smk2KFiU2ExMJjiFz5HkignF1ItiQfEprpx7NHZYQKoIfVoO0sMP+itTtdsMgaDbHXAzncz9cDLMe1XjDc+vcNzuZFai/NBp/p6iTAf17YVKvYkAWFE2OlhPD5KJsqF7XENfYoJqhga0Hw== 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=uDVGgpitxTT4QdqfnkpzTt8ouLLBgOS6RWAujk0isLI=; b=WMNetiS9o/NWbhoqQeem0ItQ5BWoNQOPMaAH9bY2v7qyIKjUsw7PprP8f1DnMf7LUEhg1T3ltH4Z+9P4f6WAf9UnCZgesms7U7EwMN0nx5+UVIPPn3TP3h9zIvQlNPm6qe4WVgSB7/5YKWMmu5pFwJ7he3q+rb+6tc8wWiGI4HfUYzNNOVxi0B1a65/CLyifTRlN1kGdE2wwAQPlPiQpf7EvEi3S/KOz5E1wxuzCwzsFBl2PWS77kTlnBx7Mtbu91uKmK0l/2FbJTEjWaDChTEBh3vZ+Lpw6x30fwGjWugvC9EG1l+4jTVWkuZHDLYwiPRV9HEoggcnZXRL8loF61w== 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 SEYPR06MB6311.apcprd06.prod.outlook.com (2603:1096:101:13a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28; Fri, 21 Jul 2023 09:47:45 +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:45 +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 , Dmitry Baryshkov , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 20/22] thermal: qcom-spmi-adc-tm5: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:39 +0800 Message-Id: <20230721094641.77189-20-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_|SEYPR06MB6311:EE_ X-MS-Office365-Filtering-Correlation-Id: 8dac6673-6c6f-4d9c-f323-08db89cf8935 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: srgO8q0mpqgKBoKgZ+JcioeFAfus8MhZERhiFSAF9zqjDEXLhewOFSxvd11NCi+wWLIHSNkeAV1kq9DoElEzO0co2NewFuAuzJkvtc9gO4aZb/qYdKbmqBOAyGhZgUrAj2XvVhBuwDeMAmoJwehkYVM69LBjewtkAM6F3GDz6eyMrgR7P9Y46ZNjBtim2YNnH1+pOA5NRW37LpRiF/v+lR3Vw/wQDjCVANzJam77RxqSv88la1cTSN/XSXRU+JxlIzCVBFEek9inJLS+EpiyszWraug1j8SwDBo9oLVJ/fCaSSMTcKSEvDJNsmlCRaHL1wJQDyXFzTjn8h5QBT9l9jR/2EOzIMnPyunzkmmBewkVi3e/LYYzhWKr2HQg+69MXBf1umSfHvJ6zmWswu/LX4i29lWRIW2fpXVif1ypckQA4xxlkniIdTVV1cHBek2FH97FRFRRC85CzjLkcpvbUSpj2YeHVdweF+D5P6QXaihNpgcPF8GErsQdOvLPtN1rp6jqZ0RMgWVDvUyU5GPL0PExUBggCmHi436x3g5U9wEzYnGKlfG6bq47rmPKv4mSRtODiNQDrCQqxNkXuaFIMOfZxwloWMnORwpw21Ik/zTuSSLLM1Er4eZbabwKTjCk 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)(376002)(346002)(136003)(366004)(39860400002)(451199021)(54906003)(52116002)(6486002)(6666004)(478600001)(110136005)(6512007)(186003)(6506007)(1076003)(26005)(2906002)(41300700001)(316002)(4326008)(7416002)(5660300002)(66476007)(8676002)(2616005)(66946007)(8936002)(66556008)(38100700002)(38350700002)(36756003)(86362001)(66574015)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData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YCy18Gw6Oy805ciEzuTBQMeur6F2fc+n+a3b2yDR37c7AuwdZMw0ExBr0ARvLe4?= =?utf-8?q?IOOq+LJvJjgb024YWxyIlWm6YFysVP/CKXh4q/N0q2M9L/ZS+1j5+NDh882kXho6e?= =?utf-8?q?mUvbfKGtDCCL5HRQ0SQGeLToMcy/mxjDozMcve/fNfFpPgHOIOVhub/KVyNjcr+TJ?= =?utf-8?q?isF2VWwbNsmnjpTmJuqIYHm2EtMAzHfb3bqDzhGHEaJ/sC/hSSzswkuS8dCgoLF8o?= =?utf-8?q?Ms83JfWGjqF44GAJ0m4SxCishU1pwg9uOkD/Afsuq4E/RCKk9q0RLatk56TLQrD2z?= =?utf-8?q?6NP+5cJGC/LVw8FHT2GrdueS0YN6pOgGFTpmuKUXW4UCQeDwgvM62As4iytZf45US?= =?utf-8?q?wA1Xci1qaMC63dBsroRbDREX8y549io9bNdcWnx2/d9w9R+LOTauUuXMoJ4CNq//f?= =?utf-8?q?DEotF1ORmASKAZdDFzFUUaU7FnEQklsAsRbdfiLvM5bA1+LI+eR1DHwZSfxtG1Db2?= =?utf-8?q?WwQCi3M8y0B+i0dQd4t47bJdygeTJRE6sc/Xy4rP5utb+X40RR82zYEchFjEHaeXu?= =?utf-8?q?FIiVd5gTWVI+6GYkiLAWKdj46BYTyCvwm+KVfA0CGvWBUiKR3TOp4okoKZDcdGEov?= =?utf-8?q?Ffd7MlnXdXi4RluSyCyunEZ2958zb97nccCtyxLszP2fL/7uWxgNUo+vLQfADWszf?= =?utf-8?q?FQ9CWUtDYigZ?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8dac6673-6c6f-4d9c-f323-08db89cf8935 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:45.7886 (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: bln0xofjKsrV1z3kn7cqGyKU6+dlyIcvr24REKgnsOO169NSSeYnIuf3p119QYN7cZ423FF/o/ubVHa3XgOsfQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6311 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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: Dmitry Baryshkov --- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c index 5ddc39b2be32..90d46dc60806 100644 --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c @@ -1044,8 +1044,9 @@ static int adc_tm5_probe(struct platform_device *pdev) return ret; } - return devm_request_threaded_irq(dev, irq, NULL, adc_tm->data->isr, - IRQF_ONESHOT, adc_tm->data->irq_name, adc_tm); + return devm_request_threaded_irq_probe(dev, irq, NULL, adc_tm->data->isr, + IRQF_ONESHOT, adc_tm->data->irq_name, + adc_tm, NULL); } static const struct of_device_id adc_tm5_match_table[] = {