From patchwork Mon Jul 10 09:59:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306662 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 8CFCAC001B0 for ; Mon, 10 Jul 2023 10:02:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232317AbjGJKCc (ORCPT ); Mon, 10 Jul 2023 06:02:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232819AbjGJKCE (ORCPT ); Mon, 10 Jul 2023 06:02:04 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2132.outbound.protection.outlook.com [40.107.255.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7304626B6; Mon, 10 Jul 2023 03:00:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jm0IbutqUg4meYIGi8puRNO4x71nRzYLZUW8esomc8A2vFj/JcXiOHANDLoPzEwuA3uYh53to3kqIz0J+vNS8mvuP6PWMX2lYodFSCETgIc8pQ9pfQKx7Jk2fc/DGQV3BGt+665mnfMuZt7oED8HKI3EEVawkQVgQ+YPao2jXzznafvBFPRv+AiTPkcGPoo+IZxoPyDlOjR2XqIZj9WmMPTsdBb2jqXmsrDTbVs9xpEMLYaTTx4wrl0jZBYlpOjMLcuhRBg1lrjwhM2huFoz/ZOzaB+ZK4fNk0Vv7mZZIOxoPqNgIV1DuDFRF+zDFl9Nmxt9rqgrUhOgLWQL+jb3nw== 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=yNQY+M8646iviKgkJhuurqleLIh9tBVfZXn3ABuGKro=; b=jJw9ob0jZoUjHFyZnu9y9LOmpjYWIVPsJC+AY3Lr/KQxVEgp8q4RpesPRBzY0btoY1XEmahoR1BKbTcKB6DBRLcYBy24VLVHymi9xjETO/pZzGCh13ii3SBjFVgV25t7tDo1Jz47wJEpg8mfOnEcBiHDLfFRiNaJD2gA/vGn7SUp03cEz7FLM0dFsnEdCUAZxicyXWariP6Int/V40fWlS8uH8kOjU1wFZ4QGsQnciPI76/SbHBCP7e0TzDbi0bCuKwKt5JjPbEgYv62HJxvGKNPv445fcCFlIZOOewMR+x/HzAXvkOlDjIzJgk/XuMK4EWmosKEF89Q8QJiSkkp9A== 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=yNQY+M8646iviKgkJhuurqleLIh9tBVfZXn3ABuGKro=; b=PAaa8LXn9+GuiIohtYbPgXfvEZpWH+scQ/FqQg0T3VYw/GpSslJMPY0CHt5/rXOHraR9ogCHXPaT9cEmrmP+oiIBgxIRiIjbADXQHcZzb8LJOGI2OyLRmVyLZmPZbTgUX1TO4O/HR6Pdvrpqp+Jj/PqomTwkl15pFoNjbJBvPWmdxefgM/opL482uu2+ULxgjmr4tLc336OQklozsO0b/j7g3CvAl480Vqrf66bwf+SK7lSaFT6jHN8VAc3twEWmiVf2nYo2kknw5Pf34HtDWLgYtNydrI50YaVlBHNSex+1C1Q+IwJuXMLk2JQD6SU3ZKYwk9jtMvvjS2tIcpQEpw== 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 SI2PR06MB3963.apcprd06.prod.outlook.com (2603:1096:4:f2::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:42 +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:42 +0000 From: Yangtao Li To: Vasily Khoruzhick , Yangtao Li , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland 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-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v4 02/21] thermal/drivers/sun8i: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:06 +0800 Message-Id: <20230710095926.15614-2-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> 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_|SI2PR06MB3963:EE_ X-MS-Office365-Filtering-Correlation-Id: 12e67ee2-d5be-4d2e-1e89-08db812c61a3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U9MgY98Xvf3bmpRH066PloCXVc/aTi4r1DIDk82Xt7EfBVeYKKCpSLam6k9GBL3Md48kGJF6quz/A7GqmPfANu7yRnQ0+apbsZcDCvlin8DFFAT9o4q/KvJsgL7hsodfnYLc9pn0aXl/cpTpgi0CvBM34yKTaXvGqq3604Kblp2WUPI4KZuDn/B5czlLNIFEOjTjuEH81Hcl9SFg7F/ze12SkQQKrPtQ2Lc8Tzd79ji0JbnWTLs/yCZktPMwBUyPScNJdxTc4kSf+nQ0N+H22tFY2RfNYhNnN9r/JQVzW0lCxqFBmA0HHDNLxab0fJNyumUA5qVp465HIDm9MRJh0JDUSP1hW4u1jOaCJuSz8neVhq79RPD0UeeGr3zKPozJ486QmI65kW2Gn/fxay7lDixRiSPj9kFLbdibWMKhzI3Ilg+qmnK7rCw41VT77swMzEdbzLax7FnEjqO7dyWqRjU/2srBxwq14zz0Hp6MuQV+XkDSHjPHUsiMNsfI8WkEl29gNSjLtibrsTBBB2m22WBZR8mZlml3bpR0wubDDT3OO+IaNIoK6ncLF7dL0bjqgItRLZFHizkwvhGXHGYrQ2WBcZWKFEBfhka+dqPMx4v3eVYcFHePTA+KuoYNBamr 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)(346002)(396003)(39860400002)(366004)(376002)(136003)(451199021)(86362001)(38100700002)(38350700002)(36756003)(6666004)(6486002)(52116002)(110136005)(54906003)(6506007)(26005)(186003)(1076003)(6512007)(2616005)(7416002)(5660300002)(2906002)(66556008)(316002)(478600001)(66946007)(8936002)(66476007)(8676002)(66574015)(83380400001)(4326008)(41300700001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?fL260ztZpO3RkPtmNeE//XQFTDvv?= =?utf-8?q?RpPFF4TjT0MHFBMrFyYpkGyswHou4vaNoRS6fussEUfvyxlcejBHToVbOZ8x8hemT?= =?utf-8?q?jEpem+oW77U6G/qUiFjO1Pw45aQHBKD1R6j321YLlzSZYpLuec/0TKFxmRkb8RgAj?= =?utf-8?q?txmmw/yeNkkxCH7tDZHI9UfJ5JU+1E9NJo/l8Os/Bj0wZ5j0oM3rlTeZMp41aWVId?= =?utf-8?q?/IqADociAw1Rm22QjJU7MXBTFNRx+sb4w56UG7MrKCfOGysLNuL61Wh1GfOE+hSSi?= =?utf-8?q?7HvR3z2090GwPl1KzX3XKauMaZDUbychbz8zveA2cTfvMtlZuLbrH8ssxYmevIhLa?= =?utf-8?q?yBdCXGR/O2C5uNRRfUhr3FIP8K49RASZSOzb+BAKThHSdWtfbV6KPmcBSi7+oPEHC?= =?utf-8?q?6xYnbknOR7jFuP+cN49VGjsYH1fYLiFiNh5gBuTV1zIwyt/AdDs2L/6lf4d9r/dtK?= =?utf-8?q?uiHeduOKH96h0tuh5Tor9frV8TcpowXaD93Rjgp4dr0b+dhOrzPax2qoSSlI0b3Zg?= =?utf-8?q?95FO6a0SsXHtVNtSvvWq/89Ltfm7K/NzNuwhSGyY7iaob8mZyksSSebqnG4sgOkrt?= =?utf-8?q?7jB0SCRTyyDqHPr2xHDxKENwjDMk8ClaEw2MXp9E4iGU4Q13g23n6lCXzb5+VK17B?= =?utf-8?q?fiuWkHhejih/gWp6m/g1751Sydy0u6ofqXtd40PdD+7P0l6RvPG2FPQ1S4NyhPLAT?= =?utf-8?q?N35Axwc4Tl4q/NnkQmhgO5Vmy65iygHfTZNLoK/89wZupzv0I9gJqIZzqrZ+STtJp?= =?utf-8?q?Kkzckh4U9pEFPNqjACIzzBUdBFpMT2q7oD4yehFviMsr5GtN/CIcy5jWexAXQbQU9?= =?utf-8?q?gheU378EAasN/Wo1UfsXBDwhtNBQElS0RkUwI2r2gg15zFKmqxsg87nWnlET63w5+?= =?utf-8?q?XquiRH5XJ1oqG325agX1W0aCGvVxt/JUc9sN0ABFukg7KM791A0mEmWTwRYPAzqEt?= =?utf-8?q?YQpIjwFJzqfa+B0BBnHeQku+2bMt7j5I+siCNRJ/WqbA3av5+iDNciF8xCUq4ywzT?= =?utf-8?q?PwFi4YUNYfpt9Yb0raem3WK/mk87bdnP6vcCTNnagpw7MBlLxwfJtNXIAgQCIaCF2?= =?utf-8?q?F0YQy55agF6EK9sLf3iGnTJ9kMEGrx9BDWe7ZWUvs0CYaIoZown5BkcTvVAonDelZ?= =?utf-8?q?fS06e9fDxjU3IhoDZFPQnAscdgqOaKfU7UcXKbcLL4n+ZqkuFLBpw9vu/+nayufff?= =?utf-8?q?7FEKmX1LSRQ8KZjaeDBXwjbjBofoAhuhf7kEhAQ/bmOFilBOjBWq5zflOCHJsYrha?= =?utf-8?q?tw5j+9LxGgtm6jfe0FvTYlMrFCdpu5xyYpfqvDkv9a4J1Ll6flf6UF7mu/IJEtVAO?= =?utf-8?q?Xv98J4eBXyxNc5XCe8edvOd2iC7ONYgdVsFvO6KSdsG0b1i6bp4zY0IFUjIl1ygSk?= =?utf-8?q?rvlONcZMzH55lhuO1X9oeCbJARTZSENhtq8K3rsww0fOa8+IRcgUbNSzAAnPRrn6Z?= =?utf-8?q?iMXrPguwVH/y11b7Cv202Hk5QXMTb3mi5DDop7WK6JSaFyhdeQLLM06WLnJwRgvnv?= =?utf-8?q?J3VmPFiMiUti?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12e67ee2-d5be-4d2e-1e89-08db812c61a3 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:42.0657 (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: nYpUdDD5ef3C27UvlB9hX7fo1lzj6lz64Q/8OWPM1nrWjeizx+hX9OfMsHDqAZRvl0+doGVH2z9s0V4/b5S/xw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB3963 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 Acked-by: Jernej Skrabec --- drivers/thermal/sun8i_thermal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index 195f3c5d0b38..a952804ff993 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -512,9 +512,9 @@ static int sun8i_ths_probe(struct platform_device *pdev) * registered yet, we deffer the registration of the interrupt to * the end. */ - ret = devm_request_threaded_irq(dev, irq, NULL, - sun8i_irq_thread, - IRQF_ONESHOT, "ths", tmdev); + ret = devm_request_threaded_irq_probe(dev, irq, NULL, + sun8i_irq_thread, + IRQF_ONESHOT, "ths", tmdev, NULL); if (ret) return ret; From patchwork Mon Jul 10 09:59:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306666 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 B7E9AC001DF for ; Mon, 10 Jul 2023 10:03:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231228AbjGJKDK (ORCPT ); Mon, 10 Jul 2023 06:03:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232140AbjGJKCa (ORCPT ); Mon, 10 Jul 2023 06:02:30 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2132.outbound.protection.outlook.com [40.107.255.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A34A02D48; Mon, 10 Jul 2023 03:00:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xe1CizoIC3zGG8UUHs/qu0Mk6M84VwvhR1euJPwQRxZ1i0xK4MJLhyEYVAOLcyGfwENHoloRdAWkr1+rRLHaIa9sS1Y0Xzspxm4DS8zyayaM4qoAttwX8RKZz50gawkalXE3duz0rFRQWdzLGPp6w8RB4EESpTbr4GpCSb93jfGJGiCE1xd/essmzvhygb89kg8zyBvu/jO5MqNDV+ZVuW5wesEMQZpN6zZh3DdRbEYLA6fYoP+whKjUUjHwwO9xWZ9kqzb0BAK48jgZ5A61RDNCetTlJ1zcpAqCT61WlaHH7CbX47PNVpsqujal4XQWBji9qVbt/v0nMUWlTaF5SQ== 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=f85Sj1Pf7S/hIg2p7O0a1eybgIjJgZrXjkRNBEWx7tE=; b=cwfftvOT4GFACIDHm5AB/vmXjbY92050hl1RLTMSDAFL7/mJQSljCSTW+Tw97XhyqLZ6n289rMVpooxxqXSRKrFvCeInYur3yZnYWtkCCqUfvjyhqT4GFB114IwND1kRGgd6bFwRrnV/TAHKHK3eSIkIjQi//cYUCXHjlV3GwKgjYR8skiPXv6GVotzaacw/FxTeIoi9GgZ1B4ZMbYvb58m7exP4Qoeg4q8fPjxumnE7CfGi+Kxb8ZSD1MzQHmGt1NnWxkwHTnBfC1ZSFMzzk1f7UqlvjdAJP5V9I2ZD7eqUzjVwQs+aG6u4E6JSSrtIyqVLJpMC23Lw5mHhI2TOtg== 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=f85Sj1Pf7S/hIg2p7O0a1eybgIjJgZrXjkRNBEWx7tE=; b=IqyVESDTbH2qB0d4Ut6esix+jGGnFkEVOWa2PGmK4PJEeL5EehA/OlAbKzDLZxmnUbCZS4yjMEQlXELe1UgEshEysqB0D8gs5Y2UNXZPsTztPKTdN2mE6ap5FfA5auHUKzh8oFQSpqjqQnTmeQ7ivTokMlkkMpl4mlo3lSBt6CGe4RYYMUC/b31gyq1gxWfnGtaKuNIfGUfaxolLoKiEvmHCLHU+p81biinRx4LhNxgbzGFH98OVjFCNa9HVMmtjQ9bPBY+aJUyLZv25j+5tYdJ92uO54MlzyaVPJOFM36UGmE2jh5t5sP2o0fOi+GOzyZdFNHt1pxMqpXfnMERAUQ== 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 SI2PR06MB3963.apcprd06.prod.outlook.com (2603:1096:4:f2::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:44 +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:44 +0000 From: Yangtao Li To: Miquel Raynal , "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 v4 03/21] thermal/drivers/armada: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:07 +0800 Message-Id: <20230710095926.15614-3-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> 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_|SI2PR06MB3963:EE_ X-MS-Office365-Filtering-Correlation-Id: 88995225-9557-4dd9-e69a-08db812c6322 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LRJdLopltKtt1ChKXDmD0czfr3mkNSL66HDEYNHZNXTCEQDRU0vNrGToZrGI0zKN1cZAe3mI/50k9sF2N0+aQXWmfhSu5Jh9xdU8d9qRvKrPojm6esHxX4sRLEVKT/LpHVQv0I8Zd8l/aEs/tk+AKBo3sYw4Cl9Ts9saLuxGLypVC+gDrQP+AM3qUzZsMRL4XxtoGEbNSzQHPOydvE3HhL3jxdnfJIWPQT9hFC0M/4+0s0n0WMarkgzmYEu4UnXqO2j0soy2R4BPo6A+LaFFLTStlTH1rsG00wTV5qMH/yyqvcjTfg+GyFbNNVRbUEbxGjCJYFbasAOE7EvO6MR6K3ajs/JS6DabxBIkKgCmu9LEg0D+4v/ZGrrpEyXNyarLy8uJAbtjbXRtTf6CJiT6kmYsKkotrcn6BYe1Bx6tFS2bQQglqbey/68tBuXjKtBaGiJq57y9EvJsVZvhU0GJEzxAuitv63lJBk2MyzdRorsGIl8ZxSCcAHDVOhtasPL42RvRwByn2zNRR87IY/53Q5xdaD6pRDTz8vCJEYuMRI6lrKonpjJ7alh8ebuT89+kuWFI8VhGTwBW3pMJegc4GBrHFDcaZpsr/ukOddIcQRHJIFj086ZCrrWPvGk0dwc9 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)(346002)(396003)(39860400002)(366004)(376002)(136003)(451199021)(86362001)(38100700002)(38350700002)(36756003)(6666004)(6486002)(52116002)(110136005)(54906003)(6506007)(26005)(186003)(1076003)(6512007)(2616005)(7416002)(5660300002)(2906002)(66556008)(316002)(478600001)(66946007)(8936002)(66476007)(8676002)(66574015)(83380400001)(4326008)(41300700001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?HjiTUnyIEozq4xruLGLdOK3K4P5y?= =?utf-8?q?XcXUSfel8hPPfxwf4hAKeMAG/UEfM3L/Z4S4OhM59kzy4oH7wVb+xorRUdhJapU2o?= =?utf-8?q?ZNU0tsj6KF5E5KHBGcHRtEgzG3K77nv2C9lYGigmpkGLl/MVJHCXQJj7jQ8M5LCZN?= =?utf-8?q?o2yGY9JfrP3sVG8LWOckrqy7VE6XLMD52P//loRKiWx7/iMfzgmSG+LBFx1MLAhd8?= =?utf-8?q?l4zwp+NiVCY8AccydKr+K/+fm2ixRhvETyldAjDLg3IXqnPQEt3BLBsqmutQKJhZm?= =?utf-8?q?TdehvqVMu79u87riiyZlprDy4729jtybIFeZdBOMegYccfyKx8cmzhXV70QE9hnU5?= =?utf-8?q?9/El6Ys8YK2SNoE3QHoM6F5yq5i2NFHS8qXenZRv/Ejk/jAj34rp88JeaDOmeTfNJ?= =?utf-8?q?qOqFr7SNdfbcLfbCByoLKwmLaEEndEuqOKz2iuOkrqkQqtJSIT0Driy541ReO90Ir?= =?utf-8?q?XLLnBsI3NONGh/XChp9/+pes5MHrcjfd0PPK1WXaSG7thYDjkdzf+DJmAJMdfvhyr?= =?utf-8?q?leXSWIXVPLu+YIF8/kMNq9LogUEjx8LuNQWj1JYY6skbvK69StRG+Kw7I28pfz8T5?= =?utf-8?q?X/xKfmLPVCA69ANEMvisWwKYjWtPOPakTdJvi0+v8SncR6haCsC8lWzwbIJ416YE5?= =?utf-8?q?8cWjqRmc/WbIqcVLhUFzGOUFrD/70+TERpXR6WAKxWBMqHGS/iGUBeUXpxQ/Jqs6z?= =?utf-8?q?y9phYItp5lyFXwThefNzM3GyiMtddm+69OSGDM6sG6LdZ9+SS46t1mHJPr1dvR1Kg?= =?utf-8?q?67m9LGmBVos1TnUB8uRBOKME/edeIXZ4Kc1Dru8VamSM6BLBvoHztpfB0BHK6460x?= =?utf-8?q?PjXCPuHIor7YqVutF70DwsnDmY80GKaaHWvMLf91ShB2KycfyvirvRRLQhMnPB+b9?= =?utf-8?q?/L0xgRxWeZXSHYOudiJcPYJczLLjVIZHChuPE66aU9I9dfM9oK2FnAHlBl0wVUbHS?= =?utf-8?q?s5jt8vx96N3X7UlDAFybULs7CZxupaJHtD8a/y4hhJcObbvxoUFssl/lT9XGlJvPu?= =?utf-8?q?fTZVK005j5HBR+cC766m3wTyVSZFcidLoFtyVF9tJIbLLdqRf1iBSZrGMpD+tsjfE?= =?utf-8?q?eA9ZBxusmPuo/lvcwm4jHE2+mEOs7cImf7CDZlS6387X+8XahL3cD5krNo3J2sdcr?= =?utf-8?q?2urYzudMxEdt+eVHRRfiilT4wSa9M324D3I0oPobH2P76m4jinkwQHiDgWSNNZVf0?= =?utf-8?q?GJOru3sx/6QeBAW6nWOZUOVnkatGQ9hR7/oZFcXpvAS6Se2k3Xjuxzi2iTA8aqH3w?= =?utf-8?q?erCRT6/+4wikB0XNauhfIWoSVUSNatOU5GNraG7NSUzPsR1v05XUGGwiHyqohPfXk?= =?utf-8?q?PiXgv3Bqc2W+ymXfe5velyk+6v+8EjHxoloKb8moj6AYY4EDd7XoAb5tHeYIkgFq7?= =?utf-8?q?Da0SWHS3bawOky3WwCggN779jZCzGXcySU+Kzxucr1W7yM9lQFF+rcDnqe56pMqfl?= =?utf-8?q?+30rFbtGcPyaP/L2Z62IUqlCHsEv95OLXnM659/5g6RxOwqJWnPbApqShO0LMUKAQ?= =?utf-8?q?7P3+Ss1hMNOj?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88995225-9557-4dd9-e69a-08db812c6322 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:44.6299 (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: WZABljUqseFgpI+MF83k/wjVo3yMI/9pUy60wOb3zKC8lz0LTRrJAD2Hz6MKU7hnxccZEJsPwiRrNaQztMDoYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB3963 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 Acked-by: Miquel Raynal --- drivers/thermal/armada_thermal.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index 9f6dc4fc9112..b7f549b6f825 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -913,15 +913,12 @@ static int armada_thermal_probe(struct platform_device *pdev) /* The overheat interrupt feature is not mandatory */ if (irq > 0) { - ret = devm_request_threaded_irq(&pdev->dev, irq, - armada_overheat_isr, - armada_overheat_isr_thread, - 0, NULL, priv); - if (ret) { - dev_err(&pdev->dev, "Cannot request threaded IRQ %d\n", - irq); + ret = devm_request_threaded_irq_probe(&pdev->dev, irq, + armada_overheat_isr, + armada_overheat_isr_thread, + 0, NULL, priv, NULL); + if (ret) return ret; - } } /* From patchwork Mon Jul 10 09:59:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306668 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 95684C001E0 for ; Mon, 10 Jul 2023 10:03:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229924AbjGJKDL (ORCPT ); Mon, 10 Jul 2023 06:03:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232223AbjGJKCd (ORCPT ); Mon, 10 Jul 2023 06:02:33 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2110.outbound.protection.outlook.com [40.107.255.110]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4F812D61; Mon, 10 Jul 2023 03:00:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Crca6cIId9y58+pJ4iq1u7EVJ0rElMwpujrRzI0C13XxovCIzvWe2k8/HgdbGozfMBIlwRR+hMbiLD7CqYsGkywqxt5GPZ60U1He+gY18B84XiaE/e73ptyej39dfWY1j371/wAA7hW3ln/SAOkP0j8Qn3pkiM0g/fuKn8TKIMYiNfljCrrEPiqZBsTEsOXm7zM84vi44BXMDtjoiBIwVcf+Uw8SQoPZc7pm9V6K4P+EQvH4vxwHvtYYw4lB3mty8GjamrXk5zOyogPXzf4EwtuJl1RGdQ/kxLE3/dU2IuKe3Px94yROXGrryeiFL7gRFGuzMjSAck6cppTM9D5HOA== 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=KgIpgiqVccgCBKuDFtnrayCZ7hr/Zb5PnA/Eht7dhvdcMi6SjDd/4FVeapp7GFPLmuOF7FkJK0pIEzzZw8RmF6yMZNDZFVvQK5iwujvSxxOo67dVG1ornlju25YdJviaEqNMOqTe5f2fOIu31uZD/ACXG45INWKFICQJ9AwR/2WI1mXQWH50gWl878gc12Dc8VuH7IsQxfY/A3m/LXoy6sGWkSnaRIZ9gsFS5tqSB+5wroxxHjjJwCD3p9T0eVbvGSH2v1ktveu0j+WRijLVoq0RgeIoXc9rpgtEM6KAixKHDDAW/ibWVQ0EqQ50WcEOFoY7y7eIMfIZ7WVyoMw0CA== 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=f6E9ur7IA0ODnj2UASej35lO8vu+OXRjH8MkbpnNTaEtp+PE7MutNPGr/1+NLDdOJ/0793kTR/GtsSeSnefUpzy5KSUjA3ZBSkUg949V0Lp9NgXbgJG2JMdb7lyyUE/B0QP0vfpQUUJCNrlgFYMG6Zentkgwg7UWisb0/5VQdXPC9FmUmAUehVcI5Qa/MFWAeTsEB2N2X4LuOFloTMemnWlZOGg+knQ+OwQ4TQRS5QYnjXviAfOJ5q8pScbExxmJCElkUsnMWRaMlw0AzPtA/RPRflNHnx8GlgCC3YZ+CtvTrOkymxGcMHhC4czXjv03228TKJwwutJ5usKAJwEZgw== 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 SI2PR06MB3963.apcprd06.prod.outlook.com (2603:1096:4:f2::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:47 +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:47 +0000 From: Yangtao Li To: Markus Mayer , Broadcom internal kernel review list , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Florian Fainelli 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-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 04/21] thermal/drivers/broadcom: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:08 +0800 Message-Id: <20230710095926.15614-4-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> 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_|SI2PR06MB3963:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a995e7e-a9f8-465f-2003-08db812c64d7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pUXLoIjvmuH91/Sq71eMjAJw0ggWLALZNbPz1hFfxckdK4RaXbaNquu2CpRRIC7zKiGHeaG47wH/1vK+HPMoSJTAcC+4NALCG5HWGH4RiAI8Q4dMOnjkErurH5mGpjGKjkAu02qnUhlTevAAvo7jYLJ95mKXFKS8QgrbTU5V8DxdsiI9tiYw69hfdpzt5oBm+YE8A3hAazXfc3zuIdbM4k2GUHHThZ5yxJ334gnepE+sctf5LZaChB1Hc1vri9Z/oTsUMZFlN2ILwvvVAT1k35oORy67LZZokSnIDyNKMV254SbbEUuM4cz/MZw8XahBJRxOq+OEbMxMWSyi6ctdcag+3VorTq1ydAgz5wW9OZug0jAtbC9Df/xY7YCeakiV635A5rO/fHUoCOONR11SKQHQ/2VrAzCSYUZTUZIo3+hMrn01xUMQxtAUlfW2vDRTYt7bGtG0iSb3MBwvKeFD023jOFyva4LfEqRRR5FSsLvdoRkpzF11Ytmc6IPsgj2FZxM/DZ7lqmKwxxOIpKKb8/6YkpMiPVej/jDhjQbQwTfVvgp0L0b4q8WIr1LMcsfT8I7+V5VM/RMCSRNJTOdvAj5U8I5lEE3XComVMSBl3zSfnr+aKIWWElhRY0dV/83W 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)(346002)(396003)(39860400002)(366004)(376002)(136003)(451199021)(86362001)(38100700002)(38350700002)(36756003)(6666004)(6486002)(52116002)(110136005)(54906003)(6506007)(26005)(186003)(1076003)(6512007)(2616005)(7416002)(5660300002)(2906002)(66556008)(316002)(478600001)(66946007)(8936002)(66476007)(8676002)(66574015)(83380400001)(4326008)(41300700001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?2uLH85CfpcD8HDvb6XoNRuOy4TMc?= =?utf-8?q?/NsTL3M5GX38SOOoQIY0wBcb2+p7DX8ZZiIkCOP6eEzMsGUeCWgT7NtjlFeGyfsvu?= =?utf-8?q?r9OCejyBhFG60HRi25ZpOzQYv6aO2Y6y1PeBsRo/bsGcuaDYfTDBW4HPO3EDOHfhZ?= =?utf-8?q?4opC15ttwYwZzwBTsMC0BifJn3UBJOgp0fDnataYqnbazNfqFky9qijvQ0ecIKqFj?= =?utf-8?q?gZ/nQDhortR5gV4jW9BdoKaKvWxSK3qzB9Fi9S7QCbgx7L8TBGTa3TbX9hgs4+Pe+?= =?utf-8?q?8/vAslSzbi2xUzM97i2z40hXIcHyzQmfdeitlMRrzDSiDpzc284PoBzJnZVYFsfDC?= =?utf-8?q?AvOsHyhbS2Pp2jIblIiVPY42VD3T+5afKS0GJOne5fX9Fs/zy45hZEaYzEbs4ohMJ?= =?utf-8?q?t9tPHYOsIBudBsUkrmaDdUQQX6VQDrOs/LvVwp56Z1HfyE8r8CpSR7lVu4mM8cLKd?= =?utf-8?q?gau2nJTnAXh742DMyioOXYX5kM7XVDQiKT/NR0Q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iRG4pW0aINv3oaxZxuwjI?= =?utf-8?q?2ZouOiV2QPuU1o5KEqhcM34s8hzSWtwQhA13YCWVkYxVE+fFNdpVl9jbJB4T2AVi9?= =?utf-8?q?QYB58osXguXntk6lEsqTxZCcuP/l6af8pWQaBzyo8vJ3a3upgk0SoMKj5Iw2oZUEP?= =?utf-8?q?pmGXgjhWy/wM?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a995e7e-a9f8-465f-2003-08db812c64d7 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:47.4727 (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: WWz7zJD5yp4APSKPpmF/Qqz+IB9EilyFUoQc8SMjVKVbpbb/0bgrEhr12CcdOiOKwqwxsJCN3o5KZvFyQBWu9w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB3963 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/broadcom/brcmstb_thermal.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) 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"); From patchwork Mon Jul 10 09:59:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306660 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 EC8E4EB64DC for ; Mon, 10 Jul 2023 10:02:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232925AbjGJKCK (ORCPT ); Mon, 10 Jul 2023 06:02:10 -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 ); 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 To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Thierry Reding , Jonathan Hunter 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-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> 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?knC9OpWC6DYJ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Dmvq9ZCkFEEyGE1sbLjNsLd0a63q72+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 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 Acked-by: Thierry Reding --- drivers/thermal/tegra/soctherm.c | 38 ++++++++++++------------- drivers/thermal/tegra/tegra30-tsensor.c | 9 +++--- 2 files changed, 22 insertions(+), 25 deletions(-) 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; } From patchwork Mon Jul 10 09:59:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306661 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 35E14EB64D9 for ; Mon, 10 Jul 2023 10:02:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231625AbjGJKCb (ORCPT ); Mon, 10 Jul 2023 06:02:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230116AbjGJKCC (ORCPT ); Mon, 10 Jul 2023 06:02:02 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2133.outbound.protection.outlook.com [40.107.255.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8114B269E; Mon, 10 Jul 2023 03:00:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lKsLFwy8HMtGOUtAagGO/r4Uae6z/ey9WL9StJg2x+fXyl+lf1a8HNX/a0ZRmD784oYEXHWG39rM4RqyYQHUUGp6/89j6FQAWlXBHY3cIDRuc7fK4mXoMi7PXdCKcmJ1g8mFJPyogqc1FUNh79sP1UelbEsi76k36YRZBJMdqYh+0VhQ4N0wQRyGjpbYGbV+Mi1SZGSuMv2dBUx95jffm5TKZzlyebWfl5j8ka6kKmz3NuIfrV5qF1KFC7gFdLs+SSBPnlEW5zu7t2Js9K6IrZa+iXMcGnR2ZqMetR77mBz3bbvgiOOFQJXKPisLZ+4Qd5GRh17fPbS+dHcjREGTeg== 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=D248ne9Yy+xz5Qu0zwOr53AYR//erHJNT+poSLKgvBs=; b=UwJa7KF4yxDrWpjJRln7eQX53V7DoVU3eFsGI1E7Jvjfkef6c+pxHEq/Om/UTqXZY/b2WdNcP8Rhjujcs00jTdF2iYXNYvMkG3q/9jItUNWKYKQOTNPdjce0w/gVnst/tlRoAU/VLH2BCN7p4+aVL7csYuJ06S6wJ2ygWATbHNI2cmjiAVpzaq3PzFs5NxRUVQxcxR5FKK/88YJ1XXmhf6k3wFnEncCRN2dXa16kSmdZFawHdGZWFNkFrllDbtyZXqq6ySOno7i0miOA1/GLbbV9GLfZtsUwNrsfDrWnPdSuGXwkIOcd8Sj0jQk1aNIsUAE66hQbZpPoA7WC5eG/iQ== 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=D248ne9Yy+xz5Qu0zwOr53AYR//erHJNT+poSLKgvBs=; b=lcMpkALHr8YFEgiMRhkhiSLp7BqPXlQBuG39sFHS/25FB3bqbDqQuPV+jLsDw/8tFJKARQnRZ7N/AOlK0Qqp/j7lfa1x/8KtyBP77xG6TCuBZ5VELQP+ALoPoTly9bF6cY6vXqnggp942r3YGMwgCP7SEjCGIVPp92fHLW1372gjDqmBYMunXkRTupxu60B8Nf3OQvvSQqX/Fxrsp/7QbkHpQ/uJab3gil5iAwDCJX9KRS/CbwJv+puQOSQY4VJNEqcAuku3QlM+LTfNTTtHgEJrd5hOw4GFCP+nV6lR94xQo6nV+/KOL8XvQ9GJq+hJ94rEGbBXkEU8iVKW/bEgeQ== 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:53 +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:53 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Andy Gross , Bjorn Andersson , Konrad Dybcio , Thara Gopinath 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, linux-arm-msm@vger.kernel.org Subject: [PATCH v4 06/21] thermal/drivers/db8500: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:10 +0800 Message-Id: <20230710095926.15614-6-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> 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: 67f6c439-3648-43f0-53f9-08db812c6863 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sPQa1Sk0D1aV1Fb8cpaCmgb57zgBG7MYKVaBW3/G3j7g3nEViwv9lbBZHYI8gwyHtDUF17Cj12d5c+WWWOWNP2GTGyJTkKXnXwOmBIolN+3gvny0a4DhKeGkni08pM/u5C0OncBACN+4GyVndZL3j//YbIc5y8UlM87cauMePNnCBfFsy9lw8MQwUfXd0nzxsbkC9MFbqwmC8n5hRB/qUkztSNjV5jLNjcjBhmaHSFxtfGep+rmQAnC2B9aPJeQOKf8l+JeEDXREKnHrcMZ1Z9pNVF69AjnF+gPmGw/Gj8ivBvPFH8O5d9Txp8NDuKeBfzsW0wvPrPY1OidWH3qdisBFwthsL5JUcMJnzWmGXsp/h580bSbw4mHF5MewFnUUAjV8hNJBgPdCyXOh19yig8YvheE6KfrZFaiia7rOAxKs2EM9FvQ4642w/UmYNCpa4Mu+tkZh7IFS0W8b2iqY0AS+K3Ev7+bvfvokowToIGxS9TN41aDh8QlUexYsHPO7F3zdbM8Ti41F+S/bzz+rEldxOWllhrbjrMIYKNbWy66wb/gE3EpIRAicbhCrld4b5mboqkkg7aOsL1Y2S0Jv+BDRHEDgaZo0/xfrZ/1I5gJHocGkPX6yIupVxolqA9RF 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?HKqK1yf6MSDteJQ+hxsNO0c2cyV7?= =?utf-8?q?iNdstxWQ2rkiNMh3WWDPOEqCu+rhz3/1iJ7cQHZXSCEKYeAf8JuNyZPfvYHvR3nA8?= =?utf-8?q?dQjfPg8ZzU66ReJuEncPY3OoPh4n8ekRLc0rV8Ct7vYVcD/6R9t8O0ttoxqOUjJLi?= =?utf-8?q?J+/gzIQNeQw8yoBU+oflSIZgJtb++giU5EbiISWTmnbJ/KbCFNJIndCodezYzZqM5?= =?utf-8?q?UJzMsKL1yPYZriZkaR3Yky8FH4Sq20ZSdQ6GlKoXdqEdG5ge/xJLVJAk76p+7ZoUW?=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6/816F?= =?utf-8?q?hpZ+fG/FD02lzcvCNL16uce4ZrJPqGklmGbk4EUnZVGW+mKWnEijqP1r7NE5xA50G?= =?utf-8?q?mgqVLBEuIvcxbmBNu6uLuhFBDgzsAYvz00U48ZNoT0ojORLjCGLiEXJRkEuZiF1wQ?= =?utf-8?q?+g1AM9UtTOqWH31Xm/ZvRB6HAFvAG8OO6TSx09TZ2bTAVWOHmEFb5Fl5PUKp7Lg8O?= =?utf-8?q?6WN3sLldCphb1Mk+YSaGpSJ2kkdtCdAe/YCjvNy/kHy+haa3HsfhlP9Mw4kFej5oL?= =?utf-8?q?93MTYQxV5eKCAxPMOUhVexf0pV7oCcXv/aoHmpL1ArIOzP5YqTahYA+14iqNfwo4z?= =?utf-8?q?JwY895u1k5auMVg+vfSC4H51GPXdcmrQVv9tMaCPOVmPVhh+7Z7b8RO0RAdlI3YOA?= =?utf-8?q?6aafgO0G+hBV?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67f6c439-3648-43f0-53f9-08db812c6863 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:53.4279 (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: pT2TwrcOwz5e1A/qRP5pDLNXJJUD9p4gqWstf9j5a+2XGtysEkZEgUKzK/ml7vRl/7mOepRs6ovppxUxCDFFxw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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/db8500_thermal.c | 16 ++++++---------- drivers/thermal/qcom/lmh.c | 7 +++---- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c index fca5c2c93bf9..0ef8fc2eb4a1 100644 --- a/drivers/thermal/db8500_thermal.c +++ b/drivers/thermal/db8500_thermal.c @@ -164,25 +164,21 @@ static int db8500_thermal_probe(struct platform_device *pdev) if (low_irq < 0) return low_irq; - ret = devm_request_threaded_irq(dev, low_irq, NULL, + ret = devm_request_threaded_irq_probe(dev, low_irq, NULL, prcmu_low_irq_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT, - "dbx500_temp_low", th); - if (ret < 0) { - dev_err(dev, "failed to allocate temp low irq\n"); + "dbx500_temp_low", th, "temp low"); + if (ret < 0) return ret; - } high_irq = platform_get_irq_byname(pdev, "IRQ_HOTMON_HIGH"); if (high_irq < 0) return high_irq; - ret = devm_request_threaded_irq(dev, high_irq, NULL, + ret = devm_request_threaded_irq_probe(dev, high_irq, NULL, prcmu_high_irq_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT, - "dbx500_temp_high", th); - if (ret < 0) { - dev_err(dev, "failed to allocate temp high irq\n"); + "dbx500_temp_high", th, "temp high"); + if (ret < 0) return ret; - } /* register of thermal sensor and get info from DT */ th->tz = devm_thermal_of_zone_register(dev, 0, th, &thdev_ops); diff --git a/drivers/thermal/qcom/lmh.c b/drivers/thermal/qcom/lmh.c index f6edb12ec004..48a14d7e8bf5 100644 --- a/drivers/thermal/qcom/lmh.c +++ b/drivers/thermal/qcom/lmh.c @@ -207,11 +207,10 @@ static int lmh_probe(struct platform_device *pdev) /* Disable the irq and let cpufreq enable it when ready to handle the interrupt */ irq_set_status_flags(lmh_data->irq, IRQ_NOAUTOEN); - ret = devm_request_irq(dev, lmh_data->irq, lmh_handle_irq, - IRQF_ONESHOT | IRQF_NO_SUSPEND, - "lmh-irq", lmh_data); + ret = devm_request_irq_probe(dev, lmh_data->irq, lmh_handle_irq, + IRQF_ONESHOT | IRQF_NO_SUSPEND, + "lmh-irq", lmh_data, NULL); if (ret) { - dev_err(dev, "Error %d registering irq %x\n", ret, lmh_data->irq); irq_domain_remove(lmh_data->domain); return ret; } From patchwork Mon Jul 10 09:59:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306663 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 89B7BEB64DA for ; Mon, 10 Jul 2023 10:02:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232858AbjGJKCw (ORCPT ); Mon, 10 Jul 2023 06:02:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232922AbjGJKCK (ORCPT ); Mon, 10 Jul 2023 06:02:10 -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 82F242716; Mon, 10 Jul 2023 03:00:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l9UOekh70PjWwE84uhkavOTKNAcMPNZcuFQ444I2ry/5O1deGl3O2qfAwThHETb7GI4xQdjrFK4QbcQ9hE9B7SoafIB7KrNnVJsCP0YJPWR9vg/oVsebSGHMji/+A7FZsV3jzhILs2JeLuSds808ADUFli44Gc9KgEl8MXbyx7fPCiqryLOyLfoCVW6JLLlPA0OJoDIR+ckPowQKpKM4GPiRrlP0YK+n5ILwCt5klD9UFbsuARnbfVxKZFxEz33qt5KC7JywGIfG64Nb0xMiLOQpf7l1roz4gqQXe++GT5dN9xyBpIAMt3TNrR1suH4p4b/IJfKW/ACwd5WZC/I/zw== 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=uHojIhWiIchKie5prnQ0Ii6NtBQrjHSYpApVgve/ZX0=; b=ZJhpuzbmOPWIhFTlzyqSnM0SFWqydqwVDZA22I7TcXyF+KH0pvAE/8tCaNqfI3PR+MnmoQy4IhVpnTm0clhykMGa5GHmN7C8R1Oaf4G1lYvmEL1NwuKZPv90fMtaew7fdZb9DKMrooseyGCZIsQC2RR4jQxkNhnb7Efrd4gvJffO3INKtES2NiSp9oDkM+XlHB18KnxpWouOk2/vyWjMgX8ju0gp199Cwvb9KOMqDHLwg2vA9UlZIuWqMoMN/0GComkMZDJymtcSTPX5NOI9jlZIGZ7dt5CEdOy9r1GwC4JVCYhVRtc+ECEBYAQq6OBRsFa9v+mhfMiesULrpHqrNA== 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=uHojIhWiIchKie5prnQ0Ii6NtBQrjHSYpApVgve/ZX0=; b=AWoZdthE0HasAo4m1BnyepY5KsmRzZ47py0WH8UctJCjefBXHoaNB6+Z+ZhPPZh4MQTzlTlwLafRTWsbmrQs/dJtZMsQcLUDHy4SHS3PWsT1aaU8Y0f5Pm3P2dvDScSLGA9PmcvOb2MiG+PQ9Qrrcis49DhAtZtNCKcWoxTosS9ftBUNNinHT6YIJPGOdyCLnPdJiDOgBvJPs33sOLASBb7elLqXijOctUTa6tmbeXWM02bBLHILYZJUnlZCokG+/hYopoXfT+KMvIyky5JnQZZMYVH2f3bwBZmks6CqjqB1YiDb1m6kOjwfWcv12eicYEp1ysQL6/MWP50eTQyXRA== 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:56 +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:56 +0000 From: Yangtao Li To: =?utf-8?q?Niklas_S=C3=B6derlund?= , "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-renesas-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 07/21] thermal/drivers/rcar: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:11 +0800 Message-Id: <20230710095926.15614-7-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> 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: 04e312a8-b6fd-41f6-697f-08db812c69f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YFkrTWieUWAi4Md00nGOX9B7it/08X1CH1GI+iBrjqkTn2jGPXZm6cG7yaR0p0D5N58fzg4z3jWFDdNsQMehDasRrUTDYZGlaWdWnBbjBNMHxmwkL27+Exdl3+6CyBfNphE6vn+1zy69z/xhlUdFVRrWgx8ZxxSVF7pfmNDdG736u8yIIOp7RwMyV3ji6U+Sonj8d/BVdlxeoUDkFapJLzYGRw45Q+EuXKLjm0q22hAT7Lr+G3Caj8iBsdQh6TcTJP6ZYNRYtNpSDGfuUY8yhSjCXea0mM/8kxPQuPGNXPdy02+n3UVOzizVDW3vTxcSueBsqKaPYaJCCRz1cwJ/5BbGID54AG0RMbOcyGiPWXrCSWaE0mHXAuY2ahn27pmbnTEZn/y4/kfJTBwX+vDQb0zZIGsezpwUzQqXxFCdarvaJxgJL+QWpcx8H8krThj80kPHRn5368mmZ74TkpXwE7jKLFX7BSfjrLHuFLrpv0dn0wMH/OdToJQXTRwUNNBqLVOj+2UhjuUeRt50rCikJHZY46LxvM8RkJxiiFqSxTOvsVYk+TCBiDM/ReLVpKPsVlcgW5mMz2Dia6O1AqMmsckF+EU5E1GwOV2Lajfq6/lmYQCUQpDBfovowcWMH8xj 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?TvInmcE4QzJtW481LWze7iZFES2+?= =?utf-8?q?TAigFDAuo74noWKtH1KvbPpZK5R+nKlfI5891e9aECmkzVMJnWKvU/dx33zJhMFzn?= =?utf-8?q?BGm2yjSsm3ZxdtkRSjE4tAYzXXke0FZm7sJQbBO9LxAnsGb59au2ypB1KB7gJpfoL?= =?utf-8?q?Ui5IZF29akrBUF9qqnLbN93RJWuvbw7GQexiyKjMJq8r1wyXs329lCLIF0yT7711S?= =?utf-8?q?qisQqD8ta64x/p5inFj7a3Z2iD7c9TgL+jXkKIo94Aj8BORkNWg3mORReHza14dq1?= =?utf-8?q?bLgJkhDDg01QAdxf+P1lgGoENldqlw6OIJZJGJ/H8nbwXWnW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Ln2kWUl59?= =?utf-8?q?OSheNGsxRHgo5K7dVt2qos4zpRbvEPq6D6TLZL7YJvib6+sDVSVX4mmXp/bHoY+0/?= =?utf-8?q?z0fgz220UFzDrC2pHE8EDnxFpKZjAhIjEKJj2R0vBS7BoFPS7V9COivMknSONiBut?= =?utf-8?q?lB6fpE1GSU37T1JjMAxfrlpU3X5hvAomgQv9TLktEMwfP6BYf4pszViCTR+/qt7iQ?= =?utf-8?q?myFk+E0y888h/m8xdWXqIILErqOOEA4XyVfaKC337B5ePATSOdp3vD+G/11eQNia2?= =?utf-8?q?h8ixGNrqtVd2uMCZocqCfQUHe3Zf0Az54z+lwH25Z/mCdrCNBU4c7FrZFc0yiIvht?= =?utf-8?q?29+SAp6WAgKd?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04e312a8-b6fd-41f6-697f-08db812c69f1 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:56.0434 (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: 4DaDiWgAIj0OpWnp5pmRMI2545Ji9XN6T8mjhdbZ0GkGqeJ6TwyMKWiKShsBViejSyQ/dZw7CQ+um/FGYxB95A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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: Geert Uytterhoeven --- drivers/thermal/rcar_thermal.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index b8571f7090aa..56f3983dcd5f 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -446,12 +446,10 @@ static int rcar_thermal_probe(struct platform_device *pdev) idle = 0; /* polling delay is not needed */ } - ret = devm_request_irq(dev, irq, rcar_thermal_irq, - IRQF_SHARED, dev_name(dev), common); - if (ret) { - dev_err(dev, "irq request failed\n "); + ret = devm_request_irq_probe(dev, irq, rcar_thermal_irq, + IRQF_SHARED, dev_name(dev), common, NULL); + if (ret) goto error_unregister; - } /* update ENR bits */ if (chip->irq_per_ch) From patchwork Mon Jul 10 09:59:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306665 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 EBE57C001DC for ; Mon, 10 Jul 2023 10:03:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230163AbjGJKDJ (ORCPT ); Mon, 10 Jul 2023 06:03:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231886AbjGJKC3 (ORCPT ); Mon, 10 Jul 2023 06:02:29 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2093.outbound.protection.outlook.com [40.107.255.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57C2F2D40; Mon, 10 Jul 2023 03:00:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YRhCOsyAYjehsYJaK/IRHm02oBue935lJ5+SlrI1061hsbLmpnDGcE+1CMNWgt9TtQ1rOkvkfhwrP3HcS8cd64+6QGdb2JNK39IchxFo8CEO7krnRHHzT92RGGtqWZidtLenFyaD9Gb4lVRFF3Ro2SVoPLyg3KjGHz3ggHlYd9CLdzQ8J8Yxmt1Twk1HskCeEKVj6HoxBk/8m2pB5WTrR5sk6bP/TU9J19xhMIqjXXPd/kILdTg6g3IKGc3diDKE7ee+MiYOyAlTo/64FzoKfJywaTBObNe3HnI++Ml/zq3L2MMj5y9f1Qlc8qOxXikHgiG9DkkD5f/VmQig/WleWg== 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=kxUuQrEXdZw6IlOKbCkrCo57TBzdecPai0pabWeYUwc=; b=dQdHd47kGd02lE/4I3qJc0l2QPFT+AWK0oXQtsWNLRVt4k74oJlOEVHpUr9wmRCEdNIpFDslLbHaAbODxsibAbUniaMHmW+c4nP1RNoFOY6cjEr3TWoeUGIZvSvWCRakubI17oEK+QPspxhZ+gpOnH3qPHQHCxxLSigrpKghyncI4SL68iXPmAZGHFOUY4fHlJg4NzO6n+/3lYVX+44WmwFxhaVgYHKYa3NGozQImIJPxDGZewYZH48xtF4c8ebAlpUwNiTmpNjs7atYl/PbBXGOSM6Jq0inmgbcIrhDQ1umIadQ2iDRLOuivrTI4D2Lfnkwd4T23VZ5RXqfjwHG7g== 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=kxUuQrEXdZw6IlOKbCkrCo57TBzdecPai0pabWeYUwc=; b=NGuRIn7waVLhpRgej+F7sx0o9/p1qQIifo6oDyT+TY5/tPPkbGIXKNiQ8nfmiKu4cgN8rkUIfouAZDYcCqZ8st0e4ZcltTVsscKPxNDvskNyGDVS2HxnysYZHOwtG0i3oksEdHqxhvSON//YjV2NvU8F1m8aLRRGSoZC6EwYOSEI6Ywd5Dm77IdDbpbrqTp/8Jg1+O7aJC46/IyYCc1NcUQScNxbDrzLL3zwFSEakk2FXh/C16t9k7gP2ccK0ULEsXOnJ50OorwLo6YRlZchpeuqYtZD84k63lg60DxyghVujffredArPGlKUyRuQY0prckie5AFnohNP6ca62G8NQ== 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:59 +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:59 +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 , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 08/21] thermal/drivers/qcom/temp-alarm: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:12 +0800 Message-Id: <20230710095926.15614-8-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> 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: 04b33123-4244-4636-db36-08db812c6bbf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xKe63/FvUfXKdd14k2yPcUgM9Hz5VGoFRKPVmfcXruometSWUMjfXSS9kD0z2jGhQtbqXM1I4Nn0FjKi1ssKdBpzj+/XGYf7EHclxheP+gnzGthldQ0o8Zp2yNWEcyRu4J9kPYo9w93AX2A6Sl3tRWDnM5LFhv4Maa95TgKnjabxTFkdqjRb3Cz9L7pBLZfhffqSGYljjY8czURsgfhEtsb1c36uElnwj10//N91TxF+uANuZiCbUEtYc5nZ0VgMF+shFc6Ux5Jb1m8zmXnjAKM650dRGXgBjr7ql5rrrs+A3o1upE7T4qJoqnxeu8MYNhxckLTIj/aSeEypR5bk9dUDrnzyFoM+2gD2026IsJbfeCMtZhROCqsmEG2Fg9qthPds9RrkxJd/XDahbAP3LDiSFtPEJ0gSJ7dt/YW0zSCUlAWX4ynLns3W6T70ZBJ3IkP2iIFnp6+lh1EqvQj3vWoIRZScctl3KGKuVwdl9affccnyn9kutjaN/mo9KT0eq5Hlh3XgprzdjsrVBLz+J2+BvRCuPn0urezhIO0wIZwH9965k1PKnHuq1vXSzdqaxv5zjc3PFW2kmNJZnL6ZDni0/ifw+nWVINLhE/nGMzSgjFroDVdfKv3ydB0McCcz 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?nzhzb6z9Cz1HU3nJdHDxz9sqmuv6?= =?utf-8?q?p38On/b1KCNpDQSBZFuXWh82yYIDfoSR9ceffSlI9Xs/lS1a+b0SzdKJXujcYYwrD?= =?utf-8?q?AuHXjQ85aMne4BDGmZmc83a8bzRGvJ698Er02Ln7kvx5BkjDXjXF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shqQyz?= =?utf-8?q?IQETe6yDum+HHM/JOe08063ICV0WlbDgqHrIDxmO1280rZ4CR05NXdoxvfXKNn3R3?= =?utf-8?q?WxcB6lMMEqH5g6uSWo9buoqsm8uaFEemEIFvSrnKtacKpd6eG9v1X5BvTeY+gMOLz?= =?utf-8?q?q/dI6EmIFs7Cz0+vVlfgwCVAPtZO7Nh0J133ClCAmAsfNK+cIWIbqbb+9TrO26w2w?= =?utf-8?q?/xQ3LnGegbjThO5ZDoG0fxdAx/FFL2tlwbK7xlURMSfy1lXVY74GMYWDSEBbho7z3?= =?utf-8?q?WgYaZXbVliTy73PMW6nlAz95Y6Uohgv4dMSAleFq7P2rrNJKIIFMVC45xDruzHGuX?= =?utf-8?q?vO+vPXm6tg4bdrVPd/WuF+7DLMRIEfhmTX1JFHCoPpV0Xx1KYSV8YZ33jz1lF4wTa?= =?utf-8?q?eMffctZWa6N6Ij1auAcQ3TtwCAC96KNr0mR11j6Fz4bEXuk6IdGqdo/PJs5RalZL3?= =?utf-8?q?5wGH+bBRsls/bghyxzeuDQVO5d9eJisGjRCZNU4W0F1L+14YoGfNFReQgTf8L7F7/?= =?utf-8?q?BQGq4B73d62G?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04b33123-4244-4636-db36-08db812c6bbf 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:59.0680 (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: n6chmFM/9jW1OzGNIug6clFahD9HbdDgoYtbOpw5J7lAOwvQV+m0J2RL/0tk/8a7TNSDwr2nmHbQFdI/Mi/Fyg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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: Dmitry Baryshkov --- drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c index 0e8ebfcd84c5..1b4a7eca181e 100644 --- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c +++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c @@ -455,8 +455,8 @@ static int qpnp_tm_probe(struct platform_device *pdev) devm_thermal_add_hwmon_sysfs(&pdev->dev, chip->tz_dev); - ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, qpnp_tm_isr, - IRQF_ONESHOT, node->name, chip); + ret = devm_request_threaded_irq_probe(&pdev->dev, irq, NULL, qpnp_tm_isr, + IRQF_ONESHOT, node->name, chip, NULL); if (ret < 0) return ret; From patchwork Mon Jul 10 09:59:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306664 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 EBCFAEB64D9 for ; Mon, 10 Jul 2023 10:03:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229933AbjGJKDI (ORCPT ); Mon, 10 Jul 2023 06:03:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229924AbjGJKC3 (ORCPT ); Mon, 10 Jul 2023 06:02:29 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2133.outbound.protection.outlook.com [40.107.255.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80D5F2738; Mon, 10 Jul 2023 03:00:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XPqqTzodWjLsxFAoM8NdLPV1NFH5TOqobDUG60ZrZtO+x7ajS7hVkmBbrQoIgxDQTXH185pc0fhRLu3D68705l3eyMisM/9vpMYzGAtmM6ueFcfWDK+B4/Y/Kr/B0eNQpR1+MJNtOf6pVDy6G+zDKdIV7xuk1dKYgrdNhuy8jq2SYCRHhRIyF7kag+4oYtbeGP3UtdhG/Yw3PzZrUWo7EAlhREwZkATwnKpi3zbh7cd/mY7svG0/69gSc0ZoJLI5KopsTap58we0/ykLIMse+j+ngyITBzDJekUXEhl+21EcEVxTgZNkZ5kU5oxtSu4jTmiy+R8lNBl1uOeX5udaXA== 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=pFDeDTPXu5A6eL3rEJyodTUDBnvTJW9kaFDZrAyicWI=; b=RKH/7QWLa8Adb8rNU249Wj12njkgSBJOwATpSfZnVOCNUrmiNHKS/zQHkslZ+FMT2OR35kOyvU24m+2DhHTG44Kf7czrt9dqYrwKpEu4dpq02xqNE64YE61lqt5Y4f0hr4oQ2WEcRnHnL6MWgPcdIN0uQZsNxP3gAfDJnxAWgn1T6cbQa9n0++RqzS0dqGoZKaTwIJZCiP8I//FwK/e7f6xRi35nPmJVXs5BxkBR3ZpkaMTz7MrZTD+Qv7c3PSJurGLvNACouBCVIPRqewtRHi+4yK1RN3hll8r7wJrI+A4+ueIvOGxRfm2tRRDonQqTLkLo6aKL1w3dWZ5JoDK2kw== 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=pFDeDTPXu5A6eL3rEJyodTUDBnvTJW9kaFDZrAyicWI=; b=UVzz6z2RphKTvBp56mmL+r67HjBC0VFSMZsGaaAt07ne+Ce8BotS8tNSLNETd/U+V7VnW93jOouLk9A01hv/jSaWvclZYzbiWF4RNWQWCl2J3p0fDFtZOJSmfEbtFiSeHKcB5QcCx0vvcuq9NDEeBOg/o+ld27f+N4U3e1HFYfzMRPs93sHvuhOHlNufhEEhRLSXHya33WfxH17XeS+lE2cmmeShrhMiggdoijvh7lKhNd1gluUHyIdg2Lz/fEwF5OHiyOD1j8Y7/LM4b9kkZvVfSRf6xUoPHAwIHHLYFhq0zNVInhqCCfRbSMeHvJvnuLaM8DGf3pX5cai4/mW7mA== 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 10:00:01 +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 10:00:01 +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 v4 09/21] thermal: intel: int340x: processor_thermal: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:13 +0800 Message-Id: <20230710095926.15614-9-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> 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: c60271ec-6491-4a28-ca0c-08db812c6d46 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YyJueZQLrmGl01i23IkZbc5Hy1I9NhIoRAO/h3KRYrvmbrh8gjo+eXXmmjf6MuTQaed3ochEs3iGHaUSgsaHSf9TPTqHKV58zfo8L7YCAoydVbBCLIpXIfwH8tcW/21gPCdUOZGeBX3LovdAhfv7j4qdxtS1q/druQ9/pjgU8H24/jwWClgsfATfrHw4hL/L3DCGYyDCSO1pUPtX1CfzZnjLqLfW3N3zx2Kl0/cBZ3/++JtgU2Mzxtq5UlL/6A+euGotcs/IrCjqZnthbU9tLrJP4ztLlLi6FDiImCe8Fpr0Ud3zJFF0VmOSXrcI5xyrB2vr397QW3FYWLmX9auCtVSkTp1p2MyGNgqqE0oS3RhWhr5dTH1DXC1l0BYW+GazKGli0vcf/DO4WkvZ9XmxqWX4QOZScAGg9Xtmdf98YDqRxGewHTATMa7Nd8mYEXRsjo5eLnZ1SXVwScwzSeUlItl1w/19K8a/wS0gGr24TUn+kbE8Fxmr1JQtUMZt31QYFhsY5f8FWWKOAP4/cliI0MCjcMkt/4nwIltSu01K/pYWweoZp4ufqwExDo/HCmJCE73PATPUmSUXkDLSFEmUne5XQ5THP18hpduIAklaJ4j7Q5VsryCtCfiqNghmARRH 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?9NWAB1zYF6zvSJLe2t+xL88W1WMT?= =?utf-8?q?QPN2LFVOK+kRdBfPSzZCNL7Uzv1BnqgyqOmxbFbx6U1Bn9JDEv1JQPjL/o/MPTl07?= =?utf-8?q?nd6SU+8peqNgJ7wLXq80LrYzI6zPoSKrevKjNQtxFUPC7Q1KUGXdQi7gG9v6aoQfd?= =?utf-8?q?q6RTO/hL85dXeVaRr/PrNF503LOk50xNP2YhIJVqGGdprvz8/WSSzwdjk2yVjvkBV?= =?utf-8?q?o1pvKQLUrPK//6SJNxzxHUjvZeDXyO0Y1rSOrECzPBbCekPA/ny9+dSDTbHbhkYiH?= =?utf-8?q?tpvHkbXIuAYS9JyyhrfAowv5PnmP1jn1f5pR0uruewd74faacUIWiCAkluM10gXCg?= =?utf-8?q?v28xRVapHg1qoPV7/SK8pOUzL1v1od3H/vtjZFpe7kMD/i80CniES4DGvIyVSyWrS?= =?utf-8?q?BK6NGcMuA6fIl0tA2+6mosYXCZcnBeNpNRk29R6j3L4XRi8pQEo0994y1nZ6i6KOB?= =?utf-8?q?vJoBzXgDczvYyRuXa7kFqqLoJSLIpHz04IffHp1uK2DtgT23/punMZMHn5TOCmlxv?= =?utf-8?q?Eee/KuhP40wHpodTPacbvDx9DyaUZYsv3boLQWWrOt4H4yDzMJ/VDvVj1lhXBJIkB?= =?utf-8?q?Nmg8NEoHwtFx6EjNPF5ETGnicOuwOXWEkJfxosBlrNYNRu0RbNTsaMny3xEe1L5Zj?= =?utf-8?q?qOaP0z+mtytxaemVsoHt/SztgRFDCj1112ep7fVKkFyDFxPKqgBagN/Xl4aHO6BLY?= =?utf-8?q?32gaJ8g6/1qv4TIZBPbUGP5ZZb/9WfKfEK4Tp/XumBsR9xgVI5WZXetaTIyEPZGEl?= =?utf-8?q?vKqU6V9wFcusdBZjY7J+tajgmdr6Mm32Jn7iTyefgd+4kjo6nsMZStAjSuqEZNWmG?= =?utf-8?q?lFQgR/4o0j8ImXmsCOlEEylKNlo7VVz70QeAHXu24XTHIn0L7ZlD84LsMlNDGomwH?= =?utf-8?q?x85H1rqXEfXXU7jUWEusqSLhwRYyUDNxqyytCdPi4H7t56WKFtZXhuVik72gh1ktD?= =?utf-8?q?1L+DhEIZDEr7v2hp6OSuIN/TfbnCPILSXyL59X7Mq/wmGN88AOLmRxDzQhdpZaieB?= =?utf-8?q?5w+E1UYhANG91CRHmG2h+NaUhiYor4AhLV1oFytx5x7u2nqZVubqhViYJ10WmzN5X?= =?utf-8?q?w9s4u3IeYcB9hyky5J6aliFR2xid4ThtLwxpy9YV5hdm3pBOCeAyyAip+L36UI3nI?= =?utf-8?q?HQK9gJTLgtipYWI0RvxzWzF9TX+U9FI5d1Ppa5IKkUEh3qXE6WoGORw6O1eWR2V1a?= =?utf-8?q?EjZ6vGA22SFeLih1OETXThVvK7hOns/ME/hPGWvBw+hLrhxUQzM/NZE4eXVATS0Lm?= =?utf-8?q?m0avjZ4H1SCO+LgC3sTL74gABa9jhzyBV2oKpfBRv0vR1VBpLsKnygZh5PGP73na2?= =?utf-8?q?M8soPcgotqVBfhG9ki8CVT9qvUT7tBd3CS+uEx9lx4L00o035N6VlXv4lLZEXSFA+?= =?utf-8?q?zrzfc2AF9zF+U908uRKEuuiBbmxmkv0Gjii6NGUE/g/A7O6zfmUSDz2GJQDBkDZJQ?= =?utf-8?q?q7EGt9MuHVxRaY2KuT041SVMWt/jwKulwThS6U2iVne4wIZNcnWsv9ds86a3cy9jq?= =?utf-8?q?kks5RIAGwuiH?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c60271ec-6491-4a28-ca0c-08db812c6d46 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:01.6346 (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: utDqBAXitvIcwaciiRzVZi+dG0RhdkI1XjDPtyqr+SODSOKDsIKMVPirH+BgExGapr5WO0fBwP0XYjuf/GE1YQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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 Acked-by: Rafael J. Wysocki --- .../intel/int340x_thermal/processor_thermal_device_pci.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c index 0d1e98007270..ee766904b314 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c @@ -258,13 +258,10 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_ irq_flag = IRQF_SHARED; irq = pci_irq_vector(pdev, 0); - ret = devm_request_threaded_irq(&pdev->dev, irq, - proc_thermal_irq_handler, NULL, - irq_flag, KBUILD_MODNAME, pci_info); - if (ret) { - dev_err(&pdev->dev, "Request IRQ %d failed\n", pdev->irq); + ret = devm_request_threaded_irq_probe(&pdev->dev, irq, proc_thermal_irq_handler, + NULL, irq_flag, KBUILD_MODNAME, pci_info, NULL); + if (ret) goto err_free_vectors; - } ret = thermal_zone_device_enable(pci_info->tzone); if (ret) From patchwork Mon Jul 10 09:59:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306667 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 B832CEB64D9 for ; Mon, 10 Jul 2023 10:03:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231663AbjGJKDM (ORCPT ); Mon, 10 Jul 2023 06:03:12 -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 S230057AbjGJKCt (ORCPT ); Mon, 10 Jul 2023 06:02:49 -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 B48052D70; Mon, 10 Jul 2023 03:00:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mZGNGbLWAdsfJQzEsJKK1I+Vv+k99KwfgVRZX637+54ukTIlYM6b0GQIvlfsv/H2+joh67yKUCBVyPsvurBy7/xVcItESOx0m3ExqZCkvPDE1eJTlIs/UhwYFehBnxNfB5jF4DrpC0gqlZAm99JLnFB2qo7GMDmIRScNlrXka5j3dBduDy6RMf2HkHag8fG7ztDqjYZIx9LYzAZ5pYdMAsKjpAB+Vep+MqsAk0T+R4Y0Q+uJr8GcMAmLHeHxFtyPujdovnYcqGNEHGXVNEwkH/V4W7wpbmAvWQgaR/ExIett2VHwi+WuOWpJHBZzI8zqhEO6iC1e9Eru6v+CTQEJlQ== 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=xb6eS0PaxW2FdVEkfZYti3txNl0ppvMkAmkHrLIDlqA=; b=LgfdDn5cI+msfQqApRLJj5QW1t9BCckMraX0NJUJ8Rmw1WIcU3kkGYUhcbAZWmDvDXhbS5qBxrWqqKzPrzbTTg1lxXWft1HHgsTLKTYJ/5SS1iS5MTmEG6PNoZzCN/BjywGvGg/gRliQUxe036qfck8W2E1bbj1LB63a4pbeA8Ndnog3yU7wOl/etoXSKcoHpZ2zV1babTeU1mpAwPIxETI4Zp2Ks7ICoUI0+HpNEES9UctrTb13cQv1ngScRqVHjRNeB+2MRnaC0d82b0ovcikA2ufH4X4hSTix4ZiBTktKBP+kvtFz5T1TUUma1gytv73ecOro5dz03GQZRkDshw== 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=xb6eS0PaxW2FdVEkfZYti3txNl0ppvMkAmkHrLIDlqA=; b=opyC4pOFN0xYgdK1N432pz/vgL41tqm+YfRyTu1h/EiP8/ovtJMrLSrkvbMPh+AfUTDgQFmDuJAGUF25gXlGaWa6SuWUpqCMAzqpGgaUfKYYBkWKhAFcqdaq5SwfOgIiA85rBuEktMwKVGwxs2Ul50yifVPGOZ/Zf2dyLqbR+DNCyZwR+VuLsZ0Vhu1opRuSD86CL2lO82jTgYKtvid5xNNRUxVyE97TESZQ7E1cgj/sJHkCUTEsNRCCGJfBtCJVIjfb+zIX6F5t3KCmfpY805hrBIKHOIyMyRNuv4mbCFVxHmGuR5fmf4UeSXpfknjLN6b08LCdSwRRkqK0cdZ8GA== 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 10:00:04 +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 10:00:04 +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 v4 10/21] thermal/drivers/exynos: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:14 +0800 Message-Id: <20230710095926.15614-10-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> 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: 9411cbf1-5cb1-4660-c7c5-08db812c6eff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ojWhGgu/i/UdOo/v3OHWeSi0yBG7NH/nwMhWW6J8kyMTx4VqLOUH82MQRWjWg2Wxdwbh9XXYLorQY9fpjLVmvfWBV7Hh74Z5ApH7px//0XxAmilMPeRMhoSiMtFtuVGCwfcIjuYxSmZQn56mb962hRL/B4FZL24If94AT0/giu/kiYm4qgxWNswdn73XstTVKjAEr43QpWfXZpyWWxAdPMU71noF71LYUCZtHZiuPezdfGg910gAoTOonJ8CNNlZxmnDj8po2cvLOWJL5A/gh2mrH5PjlZEgfrGviBxcvU5NkNX1+HnpcrhRSoLboO3P/mSuQk9BAnH8YvExaWFQCYKNpmPclHLRtlm5Rs9Pb4JBJ87mr+rfHB2ePJxxF7fLzyxW5qsfdnj35hKE38CuZbW1UIy4YuhMEeYAn2iLNsDEBmJlajQvrec0uT8aqz1DEmaJ+e+vURjSdZ/DLS1S22fdN9caxhVszGvNRsOO0XtovFDGMxCuGufcgZi6NOLBXR//jY9nLGuZhOBQ4X1ZkTWdYKhj1dh5MJW7llBkNedIS7XfnoPhyJ2ThKH8Z4u51uHeXKCBBtSWBaNiNJagqEe7rrJcyTdybq1G6co1GEsKA6gNBlDtORtsbKUOuakJ 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?8WVukFZYsleFzLNR+xbe4U3EK9Ls?= =?utf-8?q?3YmGAllVAmIE0MFNK6/DX+wSEvXcCRQwe0U76Rl480/MRiNHoE4/KfN9VZlLftB0c?= =?utf-8?q?h/IkZ2KbaUMNnAYQriIlIKGo1DOqC02WAsRHOJSVUceQa1nefRwE862BxEvpG8eBL?= =?utf-8?q?s+HkonYuEG6A/COEK/K73OzreSeQ6J2XhsNE+A0ZwMaA9Hm/E/24JEB9kSepHv3Mc?= =?utf-8?q?X163D+3et50P17kan/QBbSEbaRYmbW9ErRnHZIL7E1CNmqJMS6P0fhd3fAvy3SDKn?= =?utf-8?q?TiaYPAfUe34xVj6fuanB4lidElF5AcjsjhT00WkDwACNu3Tw1P7A+dTXkW0TxcRaJ?= =?utf-8?q?deMyIbnjUgIVoEFH0NbZl3aO5KTSTEwNRBwhykcDU7/by6TZNe8XJxrO9UOkbr/MU?= =?utf-8?q?E0gAx9xLhr6FzFxnKp0KtcI0bRbxnVguDKJE2UA9aPsh91Ye87cA0vCHDr5rHYXJy?= =?utf-8?q?V/ZeDB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BeMpsM+0iNMGfBath2vILsehVW1mJsA0NCr8drSn6uo1izhFpl4?= =?utf-8?q?yPdT1tlUblW2gbb/Pj+sqCXpC9y4tJhhY8NZjHIkyQJ25O+QBuviK0h2W9dCbMCJ1?= =?utf-8?q?XcqioHX/bV2+zUKmNnkhAnG1XnA7rW9/9kKFwmovGzfB2g6/m3cVJ9d9YrmZVcVf0?= =?utf-8?q?qOZo8A0qDnKS?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9411cbf1-5cb1-4660-c7c5-08db812c6eff X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:04.5437 (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: HtZIFT9FjTuz1y0tN42XEqIf72iw7ZbFN77Ay9ejNF0wWbxMy383uezFuZJD5Ah4Xk5YTn0voQa79Fop0O4o3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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; From patchwork Mon Jul 10 09:59:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306670 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 06F6CEB64D9 for ; Mon, 10 Jul 2023 10:03:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232167AbjGJKDO (ORCPT ); Mon, 10 Jul 2023 06:03:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232979AbjGJKCx (ORCPT ); Mon, 10 Jul 2023 06:02:53 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2093.outbound.protection.outlook.com [40.107.255.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A5EA1FEC; Mon, 10 Jul 2023 03:00:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OLXNsb5TPOSxD3nk8+tQbzOcqi8tpvz01vKsfRl5z25+UhqVahof6jlLQo8UY7qNcIIhyBL+Lai/jYxHCA8p2LH4dOur8nDatkqi9tW+hAaUX/lEREOUUO+nLEh9OcuWrEIDu787UjuonUh1d4CD1AGl/rGSU/H/0lRk48M4lfgThENL49GMmib7TDF83E0SsillXPO0F7Lk7F3ptUDrG47RWpR5tGm2iEKnFREXn6Pv0/7g/eFmFae5ByB3NLKssdNY1IpPfnD/XibnMzyy2ltmGIIOV1yQBS1POV3xakNMGPCYeTtv/NoLkkFtQYpIkhSMLKd8tT8F0p2oqfFwCQ== 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=Q2g69HSmEHuTTYKyKe+Ic9ejjUzfByis+TpAlcnSq4U=; b=UyxYhv0Vh2KT6ygqGjl5gC7dVb5CNdSXJI91sDbqlbXxKB/X0pU9TwE++RvGeyUdxoz7TGV2Xr65vroPMU4FLKvRbgFl5K+fStUSav5Oh/F6q1tuDLtF2TtO7TZ2JJ4p/wpg1JK6RrzBd3Qd6WrQwk+erJw3h11vHf0JcwyV9vNWfyepUv09gmHxR5CzX93PoGAWGaSPMxvaWEdgczAwXjheGkU3C2aYJ+qeXwpyQMtS9udjn8Lyy6RQJ6Z0JPr8DpcL3wDDktg0r26zFiAr6zb4FeAGhAWJFxLReH/6eYIUYjAdjrOg0AH9Auz/Pdy8BI9S5fWT5jwIJ8M21AHttQ== 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=Q2g69HSmEHuTTYKyKe+Ic9ejjUzfByis+TpAlcnSq4U=; b=AT40YGdufwDaOVOEV+ha4HA4p2KbzY3AUL/1ByQoe04WbEYihn0vx3JDzcKKF3rsQxcGqfKhO/ZjR/PDcckHhNZQABeEttyihYo/8YYEIE1H8OtDT8w+yZbqB7aWnp7Wq7qYNen2nu1zagn9/OTcWtGy/SbaDWNXkjIQmGNx9E9sJxG8/seL/bKJffE4IeXZKoFtLb/9b0P5iKO7JM0KPXfbHGjXXUifFiUWkamLfOGFxt2Xtb9d4+NIS9T8JyGwrTAg94CehK1s/EDzSP/EPbcrW0mMHZvj5mAIdFZIv1UzWEeKzFJeMFzBmbskpKH5mVFT+nlyRXv+F3YwZVZwvg== 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 10:00:07 +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 10:00:07 +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 v4 11/21] thermal/drivers/hisi: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:15 +0800 Message-Id: <20230710095926.15614-11-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> 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: c012a024-865f-4e2f-da4e-08db812c70ac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VCfBdFcFVDBbB1xWMbL4qv+HwaiTAXjGYzsY8pjZcQp48nEji2U5iBkmZMKjvvWl1lzPqvu5zkZcAaWq3qAbTamRRljPKoky1Z60pnv8GPWDDwDI/jv7wpclwH5KsGqDKmhkTTHcOnPiPcceSnzJr+VyzKLQujXKzDhVt4iaSpjnPV76oWAo80wWE1NBVjdU/Nj8N3yz3EgsgkZnR/PXjtnLPwWzf0NhZ5MTkeUmCBDCN4oBN/4S/Eygrk+YAkxbGNtOzRmw9TzXYb6m75DuJR5LxA5pKuB5MuS4/1DZmx5CNk1IXHs6g4FiQmUAuA2i2X8JlnvuyRMl/TVE08P8lMMvBzAcbl00fnEoKA2z5JSwQfTpRVWXXxyfipCfS/xjbasAUvv5kSa76VJPgyNxwW8Vt4LMYEPyhmBysHtVagYMMvXOxaADy29WQ/gFO/ZtKtBbiYb4cH+SO1kD/UdhMuf03U6MaPONSPPzeAZJSlx9FOiXotMIx0Dw3SEfbHEMN72mEaIxqfMGIDuBdxzlTC8z0mlAMxad/FsYJosMtX+T+eTAeFLkC2feIkQT1nKvmel4ptsnpoJtZWFByyhXLP4oPy1hgi3doYhryKfIl2iZlO6nv/6aUjPZ/zpvWnJh 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?E4h7wD/Fv37gwIBK8D4WYFn5H8FX?= =?utf-8?q?jBlUm2q14lxWHjMe7cTCQ2SSjITmZu8LLDo+UVOp5EUnhq9K8JjrxrM2eyv0dc7dI?= =?utf-8?q?7aRg3Ni3PTMS+AOjvwuDlCqVrVdrx33aCknP/CirALq5rBP2BM00G/edlcNFN83jv?= =?utf-8?q?NrGfFVa7M5zqSE4k1ceX5IenED5S3/tjizHh1j3Fn34lwCfoZ9p4SbWVSq5RPaCJL?= =?utf-8?q?AF61hRL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0/v/LjFUP3HR/9ZxA75ozfmUWGNMhP40E7ntT0dsrhb1SpKkgK8pmKGFeLK?= =?utf-8?q?3NWlbjBQDlUCh5cLKgPRyCtHTqXBrTh0sSqFc3vQWIlxef2vnUCVwsi0093M1mY4w?= =?utf-8?q?I3Q5PhLlKibqYr/HhMLdk+1aj7r2l5kL0Eg4glrD1YDjL7wjv7Nw/A3srGwZkB/u8?= =?utf-8?q?bgLkI2Yg/xDM0ufFdY9KV/MKONvl0c+WicLpZwPLS4/94Nudo9WxNGMe5bwjYNuq5?= =?utf-8?q?JljGQ8gxCia2wiDZ9tiLEQ6ncxYRmT/mO8p1TmqTuOQAM/Q45xVc72BO2hmE84ITi?= =?utf-8?q?Y6LojnRCUWLXS8g5CDMzZkX3A1nawasTKJWI6rzE1bhzerTm37aw/8wnMTZxjWq8T?= =?utf-8?q?wnLTfdPZBfLsbleCWJBKm/twQOsHoWhpgd9+/c2wNGmG7RoMTAadLIkV2iGIqVWL3?= =?utf-8?q?XVyBM62oKyWx?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c012a024-865f-4e2f-da4e-08db812c70ac X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:07.3731 (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: Pvez/33xPWAzRALUN2EeHni9xPzxHBPjDXCB8lzrLe9mZGceLEHuvN9C+TKZ2T6WiYJ8fV9nt23/eLGnNJWD5A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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/hisi_thermal.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 3f09ef8be41a..ee5f50fb2b68 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -576,14 +576,12 @@ static int hisi_thermal_probe(struct platform_device *pdev) if (ret < 0) return ret; - ret = devm_request_threaded_irq(dev, ret, NULL, - hisi_thermal_alarm_irq_thread, - IRQF_ONESHOT, sensor->irq_name, - sensor); - if (ret < 0) { - dev_err(dev, "Failed to request alarm irq: %d\n", ret); + ret = devm_request_threaded_irq_probe(dev, ret, NULL, + hisi_thermal_alarm_irq_thread, + IRQF_ONESHOT, sensor->irq_name, + sensor, "alarm"); + if (ret < 0) return ret; - } ret = data->ops->enable_sensor(sensor); if (ret) { From patchwork Mon Jul 10 09:59:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306669 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 7A88AC001B0 for ; Mon, 10 Jul 2023 10:03:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232124AbjGJKDN (ORCPT ); Mon, 10 Jul 2023 06:03:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231521AbjGJKCx (ORCPT ); Mon, 10 Jul 2023 06:02:53 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2133.outbound.protection.outlook.com [40.107.255.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A36C1FEB; Mon, 10 Jul 2023 03:00:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XTUlB+KOaU6nAxL3Q7ST1tNsy6uQJ/eCBLlfwQdO6zFBpz/3PcOxgmQvKx8SCAN+X5WCZQXrYYqrXxA+xCRFsJTEOyZhCU5WJSRK/u9SDoxhsKVymxAPK25G87vdhunuh3Yvs8M6ReCu2f3f1DrMP83rd3Wau/mrF0LBWbHFCPUNVvYdUTxvIjrWuc6lLNvf2rCPmrinPXiFZEzi5HxoZnaKq6y9PZXRwYahtaXPweGJA3YmJFUTzwL9/t3EsrMj7ryOmdyjgGTe9CFEQy7UKFn5DqwUSLGcsbWhWb8JyD6UL+2NkQUMtqn5wNK4fJ/TsU+Biy79yR53eLX3B95CRw== 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=f/Y+IYV5b8ZmuaTorAO7hsd8tpWaVdkZ+BMEJ54HFrY=; b=YdewkdBVk9QI+bnQvStWkjUKsuwsmAYrFNqmKyQp6suaJxahVbV1G4bHRqDQr2nrXIkEMDQMYOUBGIb+65n4oncQDWD5K17ilxsdtpAWltcBy0mCPXeix+DI5yt+Rkz7apKXUVhrM24KrDH1fRZI67OyptoORjqQ28XYgp8xa7MbXuesj+LOfbD72d8066/e7EoDfO4WUebdHuYbiCLO78F9cUrqgRW5GThWrMK4KBNfDnh6y+pEcss34FJjSRHVUtG5lbXQmXUWdul86INFAR8h92faB0A0IreUYkM9/Aj3dCxM8sg+pp8Anrl9LzT+7jxEEfd+m9AtQgwJgqTrGg== 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=f/Y+IYV5b8ZmuaTorAO7hsd8tpWaVdkZ+BMEJ54HFrY=; b=KAowNc7ontg9jtKraywT4Qx8uL4vEscTt9WGtGs6eugThiV9EBESDLnqScbpi4Cy3kygGYdpc7U9TbGgWJ44cMlOdIvzLq01vzCMCao0miYkg4mc/oKt2A6C25mRyxlBacd3dc8bePxWpm/u5RpoCc9sDB43IpL4GvEtNbVWQpAlJV5LEqa4LC423ALhwbTbn36j/UzN0vtwt6Q4qoCW+uduenM0LyUCMgyRz/WyHs7yPLIWDbbrvLqR/j3mw2ibDNvLD2CkOZK7/rXVsDoSef5WZMk8cAYb5jptmemrXEw3OswFGuFYIjTl+kJRIQ+veqPPvybUJFIJJICCPJZTsQ== 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 10:00:10 +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 10:00:10 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Heiko Stuebner 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-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 12/21] thermal/drivers/rockchip: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:16 +0800 Message-Id: <20230710095926.15614-12-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> 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: 633470ad-3920-4b21-3d2d-08db812c7249 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AxE+qo6Fg3zfBmsOnSXDefqXP//DrHiHSMXN+jUtncgcpYK+QXi9nZAyPhlY/5/SnxsYF6g4GspaA2iqccN8hczagfx/J3OtZzUs4nZeRTYHTmbE75VvGd54axDHLjgyrj0/9M0JaOZ/3U/5RtDd6ZQv1MrJo7HEha/mPwXLdjNtWLjIS9+wPNBgHXKF0quN300KWdC0ugpYQnIMG2tZM3SsDAp6T7Zq6TOaMAfgtbl5YOqa00zHPvKrdzksfGLm18v333+B0hMU3vonm9uF8q8O4VClc+gvncffO3al5aUrKB/4hb5BoxCJw6aVwiGOuKe18dj8l5bOTZNogo8vRjCH44LDpbuEbORZ/ZS0rCS5u+Sm8MWgtfkTq7i/KGnzDJwUKN9k2ae1OAAAeEMjsO38z3GxgyWIVYkhy+4oj5qHNir3mCO56/hOBt0dr/BL8cqmhOG+GTV4Q/Uk6XwiYnSq8UcQG7bea+7MYWiuK/BoPpB3GJYIGTSQLtgmS9gqz/9CLF8rpeuqRO27x0t74j3dnqq7XYAQJvbt20rYHXBmHksKYjrN6plUMMlMr/v+3aSSE0x2uvtMLZMXnQ2OUzarfKASf+l5xfiMc1APNEKtJ9KBv9b7HoWk9iTz1AXe 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)(110136005)(54906003)(36756003)(38350700002)(38100700002)(86362001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSp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KJATb2wvcFMIQFoE1FaHpu+kh7umUPqSQGjroN7?= =?utf-8?q?cN3YmieRfTZ7DeklNc6BtAlYUdGy7v/G73QFFtqpAXv0Fs1UG3+QuQuOhBg8ZWxpR?= =?utf-8?q?aeTWjNB3u02CJ6k0Bt5fQwSoazErmuSuC0KPY9wEB49YtCRM/QnIKg+5IBPqy3kaK?= =?utf-8?q?+QSmG6le9vY4u/ksYmKoutx+CoIrGL1msqF6tH9okbyFsoV8/ZiVRUwsDgVRHs24u?= =?utf-8?q?YmpVnBf/1u6iqnQ7AJz/hMVCJlyFaS24HBWb/v6OhaYpHITM+iZzRRmhKQ6B9KWBD?= =?utf-8?q?YO0vMb6Lyft29gQGw9GUgWdRjNMPGojTrmfWR0xQXWof7t/Uw7pkPNBeFaEOE2UI3?= =?utf-8?q?W02Ja76QTthoovtyPWfTF9/mD/5PyZd5lvj+PGtwvf79F4r4Yw/N3QZft8dcJOgxz?= =?utf-8?q?TYpm8X0LxWdan8YX+GxcB8ioeQlEBJtKaD5ywCMcZ9Kh73orpp+FSb/7PLqHAkElJ?= =?utf-8?q?SMsS1yq+8cV0NdLPkPMqjSnonyPERQilJXobd4K8XKodyrP2zBp0knZehZ0n1hB1l?= =?utf-8?q?jzF70iLxTb9dmMAibdiSbfxhMMjL73HAmxwRPhpSwVHu7uImR4BCqmoJBLX+xxD7v?= =?utf-8?q?hsjY+SUwZEoSJPNaWf2JmyPXFys7sYcBkTzUf23L2mSom9wU1zNPMzMwG1f+9IGQd?= =?utf-8?q?Zlw9lSz/Uvjk?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 633470ad-3920-4b21-3d2d-08db812c7249 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:10.0319 (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: WAmOEJ3SLbBPjUXaxIe+KT7JjVT73TctnaZE0BVZMhnWt/zXYGNzx01cyrsLANTyPQshsirp1CPCBdxuUUvBBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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 Acked-by: Heiko Stuebner --- drivers/thermal/rockchip_thermal.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index 77231a9d28ff..11061f6ef323 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -1577,13 +1577,12 @@ static int rockchip_thermal_probe(struct platform_device *pdev) "failed to register sensor[%d].\n", i); } - error = devm_request_threaded_irq(&pdev->dev, irq, NULL, - &rockchip_thermal_alarm_irq_thread, - IRQF_ONESHOT, - "rockchip_thermal", thermal); + error = devm_request_threaded_irq_probe(&pdev->dev, irq, NULL, + &rockchip_thermal_alarm_irq_thread, + IRQF_ONESHOT, + "rockchip_thermal", thermal, "tsadc"); if (error) - return dev_err_probe(&pdev->dev, error, - "failed to request tsadc irq.\n"); + return error; thermal->chip->control(thermal->regs, true); From patchwork Mon Jul 10 09:59:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306673 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 C3325EB64DA for ; Mon, 10 Jul 2023 10:04:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233034AbjGJKEV (ORCPT ); Mon, 10 Jul 2023 06:04:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233175AbjGJKDE (ORCPT ); Mon, 10 Jul 2023 06:03:04 -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 0914A30ED; Mon, 10 Jul 2023 03:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kmg3uoddLgH2HqJ4Lq9wtmkTHazEPeYHk0yc60f7Zq8+YLQIbKTH1DGIwyie3W182vXBcd7FQ3F6rrLHXE1yirmTn7R++qhRPf5FeyzKVMkIezDZX7VRwLBY4SEi1AxCOkqiRoMkfVJNHdedJiWtBA+JTKs/X94K/6csnoPkmKPgbrOal6+6I4aV0c/uhLFmzHFc8xpjbtTMOqUkO71A84mUnj2FROlsTcvojAGGPrRoyHx76f9J+oEnWFU2gbtFCDWbb3RIkC+HXbQDUQyCfx2RoEutIAI6VsWtXHbMKKHVzt3KBqMu00h6W/vnVSGflQ55TuQPrx47bVw5V6X+kg== 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=z2bNiGiAU1XFsAzb166a8FEiVMJJWw+3IBnh7N4SJ7M=; b=j3DVgwAHwNEaKMtwybnIJCQ3vVFTXCoKlCW/ElXB08pUg0+roeiJRnG26cuHnrjDBgO09FcAvLRzNfgjBuQvrJfDsACi5WScnjdveLL31xcCVfdgwRR47D0g97xTaguy0Xr07d26aICULr+JTl+3vt9fH9Xk8cp90zoPgyhZ06eqz9xDangnXsqXfVvfZHvqx4sWnnyGLyMgrleEyNs72mwBJ60+ndg3QDsKv10yD+zwj/0UtQctE/QhuGQK42NMBP8XdjYDw55/pu/rujiNgJdrQxk0sZthYKXdKel3t+HWyTWsEKLGrgdh8PJJi5al3cudI0nFd6zikQ2QATIiug== 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=z2bNiGiAU1XFsAzb166a8FEiVMJJWw+3IBnh7N4SJ7M=; b=OTivwJYdrPsPuKlTbRSi7SdXPMYC56kvgKem8+V7MKZFNoNjz4PnKglGg1C5XXACLz1g32ufLpTf1aiBGp4DDw/u3q80N9gmnW+26UZnYzwpwOdEVR91UsQjCFGKQW/9fyTdzV69kgyp6ztYb8SImIBWTTnY022TYv6FvUOwTfv3HB1BRaXmjSbQ1zOTC0EzZqOJpvp2yiK0+aVCQbIeHeDIlLviRx/c3tuECalcQX7B/RL+YLAAyDF7jCB2rRhhhN3jfsnFhbY0p4U+Nz6kGhVu/NGUUmss3IgDSlMPz908u7/pxO8MGmW6MkSJZt+zAz5aP3CM1gM7SShsY1TkgA== 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 10:00:13 +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 10:00:13 +0000 From: Yangtao Li To: =?utf-8?q?Niklas_S=C3=B6derlund?= , "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-renesas-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 13/21] drivers/thermal/rcar_gen3_thermal: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:17 +0800 Message-Id: <20230710095926.15614-13-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> 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: 7f49ba53-00f4-41dd-a016-08db812c73e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FGFxXNSk8r927CST4YDqi6bWtLMal84kHb1QTmR3jv+iCCQ7r09Qx11XFZOmL1vXy/+l0yIQbWBil1C/ZiES0QLoIx1XcgkVeErhbeHF7RUikL89bxEH+jd15Cars6rLcbXRYt5pIAcq7KNyX5fdB/CEWKOOhQe/hJuuttdQWLdfi9nNIjC6UO+Gr+Po7OY5Jx0nSvU1o8GBkEwwEjizejuHOM/VjkH59evPuAGctmeOxWt/oieLFDOsa4zzzQKg6FQ0/2DGSsD9dNHGkuP/jSd8qWm7LST6AvLxujD1ylam9SacWH1VV7i10jLKdP+J959lvfUZM6QE4kIhlFRiZrhpkNBM8wauF2UVVmGxxKaQ2aFlrEKVEqfyppQG8un6eCDzXEXd//AV+yGlVNZ54aexK5TwowRGhTLj+ZIGelDuHRrBf2rQgOwzldvUosHCq44asUBt2BlpBAahkXpB7+/2HlwQgT/+GNZzIVPrcx/HFJK2VdRqTFczgmvLoPstbPS0+xiA6AaD+n3NtoTVvN0rmQdFmlv467nxLlDEVzI6yChrhzhqgR16RMGCSJy/1qSYG8WfnSpy8fLicj+XnlRpZOPnTh4BPWAZjliicVGOF39mVCUVyGOmmmOrxUTM 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)(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?0kJPr3YzBcZ/WwV+V6dGQ7WwNVi6?= =?utf-8?q?uDqrTYeW10RnvVtUAi6MDX9eKs6x80sw2Y73o7ukwUbmDzRjv8YKHYDUwh7EsgSmX?= =?utf-8?q?60kBU1K5qk1bEbB3/vJQ8VkK2kcnk90fEqFkqo0XbYYPLAbRuhlgz+95Rpcsxux4q?= =?utf-8?q?IursXaK0mAjQSjquhnmhYRqnIx2pbaWvUQzqRAhClcV75GojEoO96bS+126xjI/VQ?= =?utf-8?q?qNuQyxbnszhrw8v5Kbgg+3JGnGG1fNAWgHrMewn59vthoDL/MJA9t2UN0pHN0SWHy?= =?utf-8?q?BoJFW4EYJ22UBJ6T6xnd13XWvrW+QjetmxQP75TJXXPkq5inW1OSai3S5qPVH23Fi?= =?utf-8?q?4/JtqucDErU3h2E5MBQdQA8Gvr1ZERX5WHmUZUulG8eXnpy13xYD8AbhpSQppkfQR?= =?utf-8?q?hFoOA4jxbezMg0m8+SCkAJK/ehUHfftx1R2qQtSZNhf4Idk2ss7IrgHHPgBgNRUEV?= =?utf-8?q?OT8xwabyoR8VxIyZyNu7W/363l8pF9ZdUU78qM0CvfvFmGtQszPWMzOfLBtlCSzPO?= =?utf-8?q?Ux67NxmMjhWE6sPctvJlydTWdPUbX/aa4redJIVnfdmXMgH2t48RJ1cTZZMU5obxg?= =?utf-8?q?J8cVqCvg+afmjWW9BD90jnl2mRbcb/idIkaHBemXw3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M36EMPk4D4yrC5iBUYJ2LDe8V?= =?utf-8?q?RCsP6H82JZHg?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f49ba53-00f4-41dd-a016-08db812c73e5 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:13.0849 (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: jK3OZip0T5XvRxstfX7oP9M7m0NVbAiRX95lgWxXkEemUO7bVjk69ESr9BmGMecugVDNL5KhHmlQyJC5G/2+ow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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: Geert Uytterhoeven --- drivers/thermal/rcar_gen3_thermal.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c index 9029d01e029b..ff9cd43e1881 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -467,9 +467,10 @@ static int rcar_gen3_thermal_request_irqs(struct rcar_gen3_thermal_priv *priv, if (!irqname) return -ENOMEM; - ret = devm_request_threaded_irq(dev, irq, NULL, - rcar_gen3_thermal_irq, - IRQF_ONESHOT, irqname, priv); + ret = devm_request_threaded_irq_probe(dev, irq, NULL, + rcar_gen3_thermal_irq, + IRQF_ONESHOT, irqname, + priv, NULL); if (ret) return ret; } From patchwork Mon Jul 10 09:59:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306674 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 F1B08EB64D9 for ; Mon, 10 Jul 2023 10:04:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229831AbjGJKEZ (ORCPT ); Mon, 10 Jul 2023 06:04:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230313AbjGJKDI (ORCPT ); Mon, 10 Jul 2023 06:03:08 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2133.outbound.protection.outlook.com [40.107.255.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 635C735AA; Mon, 10 Jul 2023 03:01:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UHlh3F2d2mWI3n2sy5wIysjPajXFy4M0OPyUIlClGx6nM2X1bnPR9Z1L9sL0RN7sOVPdnc1ay78NUINxSBIdLrEfOj517WzhPPqXZ3XHutyPpNPjysJ0wnltFq14QjkVBgf+UcQxRhg5Q89XK8TfgUoQ+wjyn/bry5zI+pHd24rYGXxExry/N9D/patpt6Oqgs3US910yjQC7yT0xMPZa9sHD6KR8R1sc6ScpGRLaCuqL8Fnr5UlpA2bpl7zlB49bUNWVUn2PCpSmTHcIpY8Yzn6d/P2w5j7diUhu7KtJ5LL7XiMNfeNjWA2TuTEvC2Vr1pt0a6YPOQxmJVA4TaCcQ== 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=xYCHd8IQ6ji4sShp4rRPeQ8MYVrT/eJGfgORNUxt/lQ=; b=j2TLsjH6dDvDpE5fs1EupHQNAcHKfNtzSbmgFubA1M0KQFylAclhNSGTz8V4QyMmQZRoK7v5p1YK+j/M25ZEVYsQLTM2JBDS3PxMx+9UUSLFy5EZWqTaVWpTlRArTJ/wHCy100dKjg3RJVztMVpaMnVBQWI6SmsJC6boD8zKCQw/W6jfGO1lqkxBEevrpwq6BeHRJ878vPU+s5cogOhdOTBW0tmc4JTOJJWXOdDKF4D61Xtkq9j0KbdhTBnpA4YYNzkfl1+SMwqEpi2Ufz6L/kcGgYwXa8daZsbH3EcHEOx1HOMk3dQEP82di+6BX3uUJteMFfPb/7kmwxB0yCJDEA== 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=xYCHd8IQ6ji4sShp4rRPeQ8MYVrT/eJGfgORNUxt/lQ=; b=CYOjDyK4zJvCSWnxEJoCH73n3o/OMhhv3lHyTm1QrEGmdJ4CYRZgE5417ImnUA7wmaix+bNWczZxNG8X7F0nqLGdMeDUsULHJ//6Dbo2SRr1NeA+JW7qdKgxAjUMDVnWoKGLP0sprY5WR72TAWOxYFH6bpsio4gIYFUxmStV3ZMJ5ewChA9Leb3K8T5lrZAbND6WDCBdwdYhH1bXDGol6S08g+FSIZPznuUy694RY0ftmf2g1v+EQ4l8YbFq2h0VDqGglPPd6vdm0c9pIusXoqYyKGpRHjz23S0LH5OGVrufmoNMYJFhhX0Zpe2a61edWKlY35rUFD6msECE0TOhsQ== 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 10:00:16 +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 10:00:15 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Matthias Brugger , AngeloGioacchino Del Regno Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v4 14/21] thermal/drivers/mediatek/lvts_thermal: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:18 +0800 Message-Id: <20230710095926.15614-14-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> 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: dabc6000-72aa-41cb-9ad6-08db812c75bd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pt6T58Av4KKL9huoJbnq/G8G1iCARwp0uT+7zDjbdWtxbHiVaCU8l/Ub5qECyOdyFiPrf7M2EFyNGYj5M0SC+QbRrukQhzm01zXvHY/nHXw4GTkvhj6077EuxemT8mPVV9LY841++/bnsh0p50/XNsQVy/8wcgmylmYseulWifLAD9J8wyKruptR1/F0riFonn4X2Hz5gawXEDLYDQVzWzWtuZEImTX7v8BMLbxLeFjyZ2MA9GCLLxdT9Vs9a5vE3jJFFgXs6jGneuOsXgY5Ot1eBWsarsz1y+ftxiUzfFp164VmU2fbrGM7Isi6YafmbgOMwDFtjHuLDdPkXMFKpLN7QFk4C1H0yx9XzoVbEQ9aGzMcwuEHx2qcwEPptroXojJLoRIryde1psvppQAm7ogKOFDg1JdLo4W4Cwaykf9pahiieOn8nAwbpoAk9mq/cA09My4GoE4dQqcSSvOO/qcqYTYz8+h44Vw/z/4Zksi+lsFopGUbHKwY1OxNAiHGegp2fN3Dcp9BjJfTskP7yCpw4JyfRmTpO8UciCMfIRackte+MqNy5nMiw5iRseATx4oXHvkOETh0+D3t3AefsXTjGBpnbCUGSUBNONhDs+IZTY1xmY9mfzZwum+z2w8r 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)(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?KjkgcgrWsOBWfSCEErW7ScD55QV6?= =?utf-8?q?wdDEPYf3kb4AzH7l2d7vJOY8F5SOZlKLl7AKE5RQ/RZ0XWAv4CYXCBZBQSpe7Usq3?= =?utf-8?q?0RTueDiaidCabCxMuFitcyqt34yj5zk1L7xJhXWBp/drdYitqTODyVv3l2kPtBdpw?= =?utf-8?q?Yc6esd0ivtQgMoYbrXMXb37iYwAJEivLxrIVVji1Q1FFeMzewQ5uGZHOjLDxdFjUs?= =?utf-8?q?mynBy0lgdpw9bZ9BXadvIUDNpSh+tltaUdAk5nT/lRS3DjHXjttdVf3F4XoVxfa+k?= =?utf-8?q?DKZZxiNTnxj1jqE9NWHvc4Ab6i/TR0emf+A4b/KuzQf5Gg+eckEE40x7Xcb8Fxd/b?= =?utf-8?q?DgU1adST202Gnyd/a4PtNkiRdEBXYXU31BPosr70fuhl/YrglEMH8T+S71T4OXGfG?= =?utf-8?q?9n7XJrIJP3las9oMing1v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YYSAYF+v1RScwVYHNWcKzUzjk3e4Y3p343LXE0YrCTPugcY?= =?utf-8?q?tlkY0CGI9+SEtl+e/jA+FRR0RnOP8aqPF1RIGwnqdskcQZ7PzrJwpdPF4rW6d3IPi?= =?utf-8?q?5qTVp5wTvWQnugt8GwrvqlD7yZbhD4lMQHVLlGN/EcKPjSgz2pfAn5cQdz7Lzbu+p?= =?utf-8?q?xQko1oX96xbzdZG0XI6Go5G55gAprQMDVrg2sDD22f3Vvx1wfzjvivtwhBeoEVM8b?= =?utf-8?q?YHa9sRfT+GHr?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: dabc6000-72aa-41cb-9ad6-08db812c75bd X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:15.8590 (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: zVr78NVIyAsuTOyshiMsFUjYUbXCU68PPIV0eIjFRB13JBlEXwV1sCWqsg0oMK1GX6BgZqzu2+oshyy5sCHDgQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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: AngeloGioacchino Del Regno --- drivers/thermal/mediatek/lvts_thermal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c index b693fac2d677..1e12410820df 100644 --- a/drivers/thermal/mediatek/lvts_thermal.c +++ b/drivers/thermal/mediatek/lvts_thermal.c @@ -1148,10 +1148,10 @@ static int lvts_probe(struct platform_device *pdev) * At this point the LVTS is initialized and enabled. We can * safely enable the interrupt. */ - ret = devm_request_threaded_irq(dev, irq, NULL, lvts_irq_handler, - IRQF_ONESHOT, dev_name(dev), lvts_td); + ret = devm_request_threaded_irq_probe(dev, irq, NULL, lvts_irq_handler, + IRQF_ONESHOT, dev_name(dev), lvts_td, NULL); if (ret) - return dev_err_probe(dev, ret, "Failed to request interrupt\n"); + return ret; platform_set_drvdata(pdev, lvts_td); From patchwork Mon Jul 10 09:59:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306675 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 720A5EB64DC for ; Mon, 10 Jul 2023 10:04:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233135AbjGJKE1 (ORCPT ); Mon, 10 Jul 2023 06:04:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230319AbjGJKDJ (ORCPT ); Mon, 10 Jul 2023 06:03:09 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2093.outbound.protection.outlook.com [40.107.255.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2D1B35AC; Mon, 10 Jul 2023 03:01:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=amPxAuRZMv3ZtsVpx+myWp1/MLziZKjYJTfSXl5VNG+gt8/dBG/m+3SrQlTioCSswpka4a3T2oNdIe7qJK7iq3IrjtX+ghdvULNVuMxbIrr/BcI75lcbWUfl8jq5xjUMPtgtUKyMVsFh0qavwSrEZZNjuGLXoHN4JbwY6qedOpCHrWGtzIMGui+Nz0vz5Ev86hiw4nykTC98Igtc41e7DligfdNI9H0LebqmF0pWV3jf9miFhMT8vZnnsKeTaTSRvko5nL+frReiUmWX+adZTOwZubMQD/ETWSUw6qrGRGjwGysAeHGXQZQpPfBzcNKEXZw5a3u+b/qh6Y1Shanq9Q== 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=f4bfb4yk8VVql8CBIboaJds/47jikygD97Ynoj6D92M=; b=DBRoJauV/Iz36ttzdDJcffEnVR9Q6xznDu7sSg4GC0geuVPAM0ZEO5nwphZwb7jMBaLdfShohN2yQ3AqeY1Xrrk+hAW8zr6rK1qaWfeLHMp4yWhaaUB8OKqlbSNQ9L5DXzkRIY1ld7N+lrFVmcqcvgKIWtSgwK+mTMugkohlCWTwYiin0U2iyUdcgJIGV99sZsMO9zU8rGTnQS9gX0tWz1idczG9GqrHqxzTFKmZ3gQjKvbWIL8CsjiIpueuA4S6hxJRFU7fwzkQjN0p2ASSQafDmMi0nr0SPNSE+76ANzKQmV+gxijda6WSdfojYuEZi3qhaqV7ZxSrL7OsxgwyRg== 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=f4bfb4yk8VVql8CBIboaJds/47jikygD97Ynoj6D92M=; b=C3T3PJZpJN/zn5aiM8lnacNMd6abAXvlnGkLKkUO62KUrwB3bisy+Pqs1f8cgLWL3XQvHsW2Ny8wZgDZ7xOYZUDkJm9wPTtGmanWbTTbFfW2H5Aaa3eYv2apxK2bHKyII1nQAuaTItIVFMNM7IefVWC+237lDmM3xM1h1UO0PYIWqLU3srYRXyP70ocJnm/NSicAjg0FF8rqmxHf58BdFrkZuHLgEkasRLv5VwJDsGChFMAvoaqv+emR3it+MUM3hG29aet56M4s/0I64xelAo36OoJm2pcTu7jzSzg5hFrGgCXClrPfqPJWoyOeAoQUmVWo9GtM0hq/otIDnTItWQ== 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 10:00:18 +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 10:00:18 +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 v4 15/21] thermal: max77620: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:19 +0800 Message-Id: <20230710095926.15614-15-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> 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: 23dcfbf2-5a46-4162-c532-08db812c773f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a8I1eu3K6KqQGqmD41urPvcBoQ9wIEltkQJe39hNYOKrZo6Q7CTUbobRoDrZ8GE21MNs6lieQy8X5D2BFylHSIC+MRWVEl/UvubD9RJKCDgtngJvRU3tC0tPfr34AAPO+fiWg/zoHcyoHt9+2MhGLVK987CzWcCTqBX6Uujt2b2FOQrpB6z0DT6O0owe3/vv5Ja29uoD4tekgmPHUtMHAE31qQ/WFfy7FwxZ0xHcgl2+z17pjAK8Newql+Ro/T49MzvVnqAkpvx9fK2cMZdPAbT6m/89qFBP6pmtM41F9R85hBbgMZRAJWP+5s5MrmY9r045n707bskp9+YSstr9yI8WeW7LlQJjn4FS5m3Pc2v3gM8VAgo8CZDeEU2833s+3NzPxpPBuPPO9kvsfnLVriPXJ0qFrjmWdUt7QFnpkgW1LuhSM8xQyedgtWF+YO9+rWW2LROTNwape2GfnLtr4x56aP8ELekZdybdmA9nIR6gtAM0wqRIEfPd5ei2RYq+A6q5JFV04Mte0R3y+5Te7Lqjn7a3I8Ca1pU6J9TXjARqZJ5lLwmIAofH+Vbc2heyVN84Iy7uP24ATaOvA4Gy/ihF14YNS/thC0mdc+9CnHGgqYe6nY4CgyRH1bl6ffIO 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)(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?x6AayyocolREbQuhAymO2S2zBeCG?= =?utf-8?q?XPiNGxoK5jTyc5oGDk1r3PW5xoUjCvp/2UEtnFatVM0aWFdOrOgUgZZpvhZxPwEt/?= =?utf-8?q?f3neYkgX0rCi4loOg2s45HbYWD52jcUffobI4ZPQIhq79xouTzLMAcTFTbl14nty6?= =?utf-8?q?3+hs8NSMFNjUQ8H/Wq1ApqADbSJ9ZmRMpziApBMJa1LNe7PokuQzWKsD/jmwmsWJp?= =?utf-8?q?51E7KzjbsQX1T6X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Fc3VTsnDle07z8Tspa0em0nPff628p46o0Ui?= =?utf-8?q?jY1dDVkBc8Heaxjr5bXGi0mD0eto04EKegAqJrs8JlnU0bFfEfoWR0cmYlrTgwLWf?= =?utf-8?q?CPeLPpbD7m3VJmW6DFsuP2Z4n2QGHB4DogDpg8AsBoTShM9dCvNJkPBVNAr6aAWyh?= =?utf-8?q?K6YxODDjfaQ4r22Q+R4K/KfuP0/OgjL+GBjU5PPqemWwYKrJuxksOmbT5WYOKeeHP?= =?utf-8?q?HEQgITUZKpIYAq42RIx36fNfxw695z453BHFBDPr+en0adN0o9TytCsMwRqYf+SXl?= =?utf-8?q?gIeatkTk+SJIq580W3UnI9xdrAfkAktPMSr1dfHwbgp88YhcUvT9U4BRP0K2I45pj?= =?utf-8?q?AH623spXZp81yMJOmeR2ojWPQFA7bOWe4SD/AGI79CeU2dQ2yfF6En7we+HkuoQY/?= =?utf-8?q?upNDKuwobVzH?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23dcfbf2-5a46-4162-c532-08db812c773f X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:18.3848 (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: TIXbOWjlJ80Dk9egs0TsY20W0ZLJOCSnGrwM2b2dbMgpToCpwsOKQoOSBWFUTCDCOQRl2GyZ0t++LOnNKVXiAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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/max77620_thermal.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/thermal/max77620_thermal.c b/drivers/thermal/max77620_thermal.c index 61c7622d9945..92289498fa17 100644 --- a/drivers/thermal/max77620_thermal.c +++ b/drivers/thermal/max77620_thermal.c @@ -121,23 +121,19 @@ static int max77620_thermal_probe(struct platform_device *pdev) return ret; } - ret = devm_request_threaded_irq(&pdev->dev, mtherm->irq_tjalarm1, NULL, - max77620_thermal_irq, - IRQF_ONESHOT | IRQF_SHARED, - dev_name(&pdev->dev), mtherm); - if (ret < 0) { - dev_err(&pdev->dev, "Failed to request irq1: %d\n", ret); + ret = devm_request_threaded_irq_probe(&pdev->dev, mtherm->irq_tjalarm1, NULL, + max77620_thermal_irq, + IRQF_ONESHOT | IRQF_SHARED, + dev_name(&pdev->dev), mtherm, "irq1"); + if (ret < 0) return ret; - } - ret = devm_request_threaded_irq(&pdev->dev, mtherm->irq_tjalarm2, NULL, - max77620_thermal_irq, - IRQF_ONESHOT | IRQF_SHARED, - dev_name(&pdev->dev), mtherm); - if (ret < 0) { - dev_err(&pdev->dev, "Failed to request irq2: %d\n", ret); + ret = devm_request_threaded_irq_probe(&pdev->dev, mtherm->irq_tjalarm2, NULL, + max77620_thermal_irq, + IRQF_ONESHOT | IRQF_SHARED, + dev_name(&pdev->dev), mtherm, "irq2"); + if (ret < 0) return ret; - } platform_set_drvdata(pdev, mtherm); From patchwork Mon Jul 10 09:59:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306678 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 5AFA9EB64DC for ; Mon, 10 Jul 2023 10:04:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232650AbjGJKEx (ORCPT ); Mon, 10 Jul 2023 06:04:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232873AbjGJKDU (ORCPT ); Mon, 10 Jul 2023 06:03:20 -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 6BB5C271D; Mon, 10 Jul 2023 03:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CU/xUBIrmiYVFP7bgPZ2LW3bbFPsozhh2NbnL57lGNKbptyIFePeaheEwBAxN/AKR2OtXDR3iGkrbLQxxF1cWFphnfbB5Hn/hz60K4cZ+0/yxBhBOyTi3Rw35T1CePbGeWoWHhhkJYRRH81s9qI1w5OLGWklBa9RdX8vn2fxlCjDZP8Yr8pUkIGmrxX/cBHKvTS/A3Q9M5XfumYLRNLuG+HaU7oW2+s1j6M2jnueLU73ruCPvN3XFObOszsIfOnmF2/LRgS58DDkG7M4nZtTl0jdWDxszZlL8ozZmITDhY2J012Tci8vvl7JiuwJrAig9kE4QGnRFR9/ko4hDqKhpg== 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=IL6SwD0W6dXt2Iz//EACJwD3Kv44EXzw6mZV4Lkezy6lAkLkH8aNAPRGHCVRoDNcX3/DZR0Bjvg/FdyEVfGHUjZzosyD3ofo7VA2UC8kJve8f9Foux/6js27YphYPYZUPKT+WQn+8YgwdgoRSl6OVUGgXlaOoRvmMgrsui6e2IwBr8JibjRxjNjUdcAgGOxbfGmZ/QzcSNZpZ9GdjGj2AgS68LY0vqgiPsHd7veQQaGXH7bzUqko2wUYq3AGAy0VzEsDQ5yWQ3HxHXxIB2GBcSxAyz60/5clGvxQeWnmvF97p57FWTxNQ4PX0jGR5V8wCqwppfH6M4UEPL3IcRhhbQ== 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=m2VWPRu5jhlFSB0j9z2ZhN9ulwoolNRRd5mRgVRgzPk1n9/D/UXj5/Nqo3JPc00XXzZ0uvbxFmxpOJ+tda71E9mocktm/XzqMulaAY04BRdLY1iEix1I7bfannNR4Cfqxoo1GK4pJe/1me63tuqNGr8v967Sre1tbV4SMjr6IUdK8OCBVv1QGpBubmKGeWeRJjyA1v1uH2/fWDd+YfWdnggM5fBk/PyZhwW1ksE4BIvlPGsWml0e1LUDOSXDqzJGwO+qbTpXFwBORDRUjoS30Qn5mdanV7us5r5ojgc49OHNS2WnOVaIp5Jr4sRXhk9TfuEBXB1lrd74yYchbpIvkw== 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 10:00:20 +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 10:00:20 +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 v4 16/21] thermal/drivers/intel/bxt_pmic: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:20 +0800 Message-Id: <20230710095926.15614-16-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> 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: 12835003-c01c-4d4b-1919-08db812c78aa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qKLOWuVt7NVUGJ+zyAMoyvLNtP/Oq4SGxS9ACJqWjKF3WNuWSkQI/KMbRGcONQ8/A+DqudaGrkPNq5cF5OxUDCiNJtjN7QJvxGfh5dqfjNWIbxFDabfjWOMThZQUfZKhtGhC06+i5jHgcPhTCcQ7+9b48swCPaar8x+2D4Yt0CQQ2ZQzNp3pACx+3TyP6y7W4QN7M5YHNjzeKWqwB9LglGTG1Wckz5IB+RKLs8ZSTj1PmP1mKE7k3A1vrcgI8Px3c8CNlAOWr5Pimo44vFpsy3ex7YrV7ClDxQISAWYbYSRMKTR+YMSxijULhdJfU9tdgiL/Wu/Uu3qsC4EixBvJ+ZVKzPPGHwgxXUxku+hyFlM5UMokaJ3+1dQ4BymTUbn30AKMk14xUzxjcd3+wFWZhH364ncqo7ezT9ZPfeSsyz5dCqvvTtqEy4COxcfvqYsj1F/mU30Cp8IwmFZUyCeM811O+/PhfPBQJs//EIObmcHvIRqcjNc4zUVF/xjh+ZO2IXV9YL1lwC6nMxChz1c/PM0BuRoJdLfxMK2eEUlIjOc7SRy4htERlAp2SqaBD+Pf+7+KycA87l5eiDRQSvo+UsxdVtN08JMUN6KSXWtvJEtynrXJA9MA7f0oHHFpMlRD 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)(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?sNZ5wFOrwapcOxBs5F1YVi+EBd8I?= =?utf-8?q?uJZt4n4ZPzKMXCoAtAI4uvjv6NVphzDWi5ZKoIbzDJWe2D+nygYeqInRSdqcfwc8J?= =?utf-8?q?v1oplluiWKPydAQX12mZYsll8qpcuc96k7dV1TDpeluku1RQMe1oml5Vc8BvZF7LG?= =?utf-8?q?zWo2Xju2osmZC/zwUxsWxtgipaDy9nU4cqnw5jN8b0gwrxzN8cTQQghx+dkSIkD3f?= =?utf-8?q?bZF5aO8tEgqNmpGbLNa/tRkiFbbA70RO96nOxupCXq4toJtaUq35yDp5Yvay+GdC3?= =?utf-8?q?JYCcjE6k6l5nNdUkib9X8Tz5OXP9CdqLLUIC/7Jajn7IB5lqpn0fSl39WLq/20p0o?= =?utf-8?q?HBXvxGZkookxRFfVpi7vCThu8owYv9O1UXvTzdF6ghXfQrzN/oCMSVI+lqlKEY1mM?= =?utf-8?q?N/jBYzFWJnI2T8B/EjWmSJVj8QBdj+zzsUsjZwC5ul9+pQxnJPbdMDUJ7EhdhwBU4?= =?utf-8?q?9wBkJ8DbDECb7w0pCcuT7J2lfow8ccozh2q4lhxSxUAZlbvBL81oyuwziOEDgLk+p?= =?utf-8?q?clBpIyjF+gbtPwlHgHuHRDMwFB5v/1Z4MR3gozBzUcguqJnJoaFTb9iujWC5Vpl4p?= =?utf-8?q?bnpDok8ZRiTVQaKxAPu7HiM/sNx0QR7pnqtXQMJPV8BKEfOApcChDzAb/0jaDbMzO?= =?utf-8?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N3Tid4H?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12835003-c01c-4d4b-1919-08db812c78aa X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:20.7622 (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: bDz1uEb2s9sSD0k0Xq+WcNcfzmef94oxdkH170q5DQYGv9avtCw+a8NsQB2oumwXl+nBc0Cy2HX8pcC4/VXy/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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++; } From patchwork Mon Jul 10 09:59:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306679 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 0F058EB64DC for ; Mon, 10 Jul 2023 10:05:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230237AbjGJKFN (ORCPT ); Mon, 10 Jul 2023 06:05:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230129AbjGJKEZ (ORCPT ); Mon, 10 Jul 2023 06:04:25 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2133.outbound.protection.outlook.com [40.107.255.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEE12FA; Mon, 10 Jul 2023 03:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YDi8f4fhqBQmLo/w1erRj4h0KDlAtdnSYVvIxrxqzZptmLOvVw0oCGfXqxRJT2yMWLHiCk6wFbGmZPHwv+jGf+i4uRzAIBpkOnshebHP7jC1j2C/L2Upo9EjR8nXmfABFuPbSMc9mY2p34D0/6/n5qKPibxngIHOta95yf7Jb1Fh/lBPXuPUaqSl+kKwmjwc3fYidJfbLEcsnAhxrJ2RtJ1OFhhk6l0a4dqjBq9iA1RYZ8cOnsKeGoXfZt5YxfzJhoeXv7MCEJxb+x0iSu1b6Ebcth3IWCmrJYymTzX7X22P/axAke0hBUY3lxFAJI5Ywi4hbbRENZvTzJZse4/9Vw== 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=q+TzYuEeTgIKdnKfQ77B8vedEfB0P2/z7sQrh3Z4zJE=; b=jbdgUc597raW8lebj/wdUJpRl7kmq9zg7nrHuiE6i8l/UcLXbrdnlcLBxenKen/FrBPMG0E4yGM8PNVS5D6ISW9oZmr06JoZiz3hVgM3nk4gZwjWSP6jsVeKZZtOg8ChQ3oOlbcP7IgLL6YtxI5kfjz6dA/KogeSC5eylREB7cMYyYPOhJaG/LPqlgDlowfJmK9Ztu8g8rN9swqepz5FDRD2r6GnqLa+9VReUc5plE2jJpm6i4Ucc27hwV1ng+1G+EX2myWesICHHo4ayN2nuchAF3L2cHG6jcSNJPhjzkzczHa5pJCIuMkuKjvQ+UDb24D3ACI50jgQB4us0vkD+A== 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=q+TzYuEeTgIKdnKfQ77B8vedEfB0P2/z7sQrh3Z4zJE=; b=kiD7/uXVMCofQRZRkRX6QdEPamF9JqMfA1ZKeGZh2ReH/s0XEXen5Alpbwi069HZrEmwGNKJ9pGCt81SoCGON/onmU/S5TA1kfGCmYbK2KGEOPeiFbdvooV/Sx3bDYqPNUsGX2yvxDCtFJwB24CYdOS2g1SS6GJpjEKYDenspndmt3yI6g2wlPzz1v4OORXOFrtxc6zjgd5dV+JliHaw37Xpp3aRduUbp3LHgu7aJD9F2It79VEBvZyEpNmzLoGOhTDeiTdWGhov8z7g3Y+nngSEflq3m1K98v/ryph0xSu8DaWpP1upSvOH0FPEWSD3FIWr2sf7ovdMOyFaZJm3yQ== 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 10:00:24 +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 10:00:24 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Maxime Coquelin , Alexandre Torgue 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, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 17/21] thermal/drivers/stm: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:21 +0800 Message-Id: <20230710095926.15614-17-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> 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: 50708932-a9ee-43cd-aeba-08db812c7a9e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6lRSknbGh8PmoS3Xny7ElGcMj4BkXGR6wUlGvJFyeGElbaP0+MxuEZVysx+sIgC0Tl9LrAnn2bMHfKSvqYIxDoURVajnmY2KoOUu8mNxcaTe6hgvKy8LG/2RvIx+Ei+wpuYcbTmdhy52anUfS1gVT62LKb397GM9JtBxQzNBIl8O/5rMgvCwUJGkFyn4GUM2+3+qirkqZBdciwPO/9qp4wA4iblD9VoC/DtGU7h/naSkfSnAPCbydxH6EZQLfSlpzIv95QdxsDe73yYndvCXRnWYJYf73D8bdPFtemKacq6w72ysCwpQrnrB5DrOtubIY7pBYN+cNogfEPYvMjilqyjTpcLf0ZG3MMDETrsPKvhGUByvkhDTSVEmK3SvOjJVdFqHOKUAvC+PteSwv0Jq2lkICtH3e6fF+WSCQbbbM4N3PF7/8G3vrtC9kMCen6nHg8F6S/xvlGU+BsAS1yoaqiae+E9CkZ/DPWYsjMtfpYDhIMi3R3T4szfHevmV3nln9xsaDhPJnbqROzyNpRfwnLnrZKPZxsqAqiNxMMAy4sBMScKEqmV1tDcs3DEusA9L2+bd3lCd1ubWgI8H8oNj2HcroyGBUaicMB2it75vLPcGOlzFmKDSI8WhyHH5okEb 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?uY16imdcqOG8IwNJ2rMKw+AKLjtP?= =?utf-8?q?phfg0EAbDhbtkggYEEA1WR1q8kjiUbfDcYwQFp/m4w+RtVdhXJd9UEnxxY0umQSwe?= =?utf-8?q?fBu/z0d0jE7uNSdDfsclhQERuaDwZPL5HPvSpLKLAWsUjnIHAoUAECd9keG1+fh8K?= =?utf-8?q?7BHfrFnST4urU6gaAooFocZgbSUXKkZOc0LTsIp1TJ1Fr9K0G3EDNUxqdZ2W5dnfJ?= =?utf-8?q?mUEDhExcc98F7y600vXPngPYCZgurRLLi9khOwecHSB34RTg0x5d0syjvtmIQEPfD?= =?utf-8?q?ATCZVunBrLGeCKqxnaVSrmyJMIJQUUIW/LM4u5mjTd/lsvF/cEcfo6scKEpDaq8hx?= =?utf-8?q?24FUoDedsnI7a4wfQwRAcDrGuoGJrH0bBAFmfUAfemImYwv7ePTQq9lfi9aysFuCi?= =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ZvuKshWmTUcgX3eE4qqFf3uJhOsIM64gfnVhKGRTUxpRMAQ9xU5eaYdYn92tiP0s?= =?utf-8?q?dsWUsiT+9vIMQ395z+ahF+ogCXwpdSeFKd0dDRCcI8joAN1cwy/eJFVAeX49f3L6T?= =?utf-8?q?cF09qrGhnzVXo1m3ir6oThlF1LqP+3rwh/n7ZDXyxm8nRodT7TX1GE8Y9c0G0iYNB?= =?utf-8?q?WUAm9EB9CgASRqZjSi/Q9KboMqp8SZ/9nucerFg1OO5LQYauhs/Hz9BvNHDcUObq5?= =?utf-8?q?J4Gix5p9THYE?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50708932-a9ee-43cd-aeba-08db812c7a9e X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:24.0271 (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: 1M+lcwzHaiTgRP3rY7KrlwAvwU2zQZYM1X5/3OtFwJJIsQ17TrI83qhdF9LdmNb0dN3MiDqEkIIGrxQYHuR+pw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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/st/st_thermal_memmap.c | 12 +++++------- drivers/thermal/st/stm_thermal.c | 13 ++++--------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/thermal/st/st_thermal_memmap.c b/drivers/thermal/st/st_thermal_memmap.c index e8cfa83b724a..40bb318b5489 100644 --- a/drivers/thermal/st/st_thermal_memmap.c +++ b/drivers/thermal/st/st_thermal_memmap.c @@ -97,14 +97,12 @@ static int st_mmap_register_enable_irq(struct st_thermal_sensor *sensor) if (sensor->irq < 0) return sensor->irq; - ret = devm_request_threaded_irq(dev, sensor->irq, - NULL, st_mmap_thermal_trip_handler, - IRQF_TRIGGER_RISING | IRQF_ONESHOT, - dev->driver->name, sensor); - if (ret) { - dev_err(dev, "failed to register IRQ %d\n", sensor->irq); + ret = devm_request_threaded_irq_probe(dev, sensor->irq, + NULL, st_mmap_thermal_trip_handler, + IRQF_TRIGGER_RISING | IRQF_ONESHOT, + dev->driver->name, sensor, NULL); + if (ret) return ret; - } return st_mmap_enable_irq(sensor); } diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c index 903fcf1763f1..6a36a7eab9bd 100644 --- a/drivers/thermal/st/stm_thermal.c +++ b/drivers/thermal/st/stm_thermal.c @@ -387,16 +387,11 @@ static int stm_register_irq(struct stm_thermal_sensor *sensor) if (sensor->irq < 0) return sensor->irq; - ret = devm_request_threaded_irq(dev, sensor->irq, - NULL, - stm_thermal_irq_handler, - IRQF_ONESHOT, - dev->driver->name, sensor); - if (ret) { - dev_err(dev, "%s: Failed to register IRQ %d\n", __func__, - sensor->irq); + ret = devm_request_threaded_irq_probe(dev, sensor->irq, NULL, + stm_thermal_irq_handler, IRQF_ONESHOT, + dev->driver->name, sensor, NULL); + if (ret) return ret; - } dev_dbg(dev, "%s: thermal IRQ registered", __func__); From patchwork Mon Jul 10 09:59:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306671 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 C3814EB64DA for ; Mon, 10 Jul 2023 10:03:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231712AbjGJKDP (ORCPT ); Mon, 10 Jul 2023 06:03:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230215AbjGJKCy (ORCPT ); Mon, 10 Jul 2023 06:02:54 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2132.outbound.protection.outlook.com [40.107.255.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA8BF30C3; Mon, 10 Jul 2023 03:00:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ef7+ROMWTh0e4sr2VXfIANsLrTmgoxScVa5pBQfiVB+vWFS5IpjA2xDfJkImt2TnCspqG61HYHGW1DDn4W5ICisid/VcQ6QqFbDcAywqEthtYyUbvnsQmH3uALZzh4djeZ2/pMoA3vR7u7RaQT1VmAHvWO6+PzLmj99ONTCZZ5LCu43l86dpV5Y8yqk0rBK3mJaQwTsEVee4BpNMqbTTFnoi5e1ktCCVq8SOGIMzjia1S8D5YfkkEPbQN8g0vPsAjQjbF700O8SgSypmX1jezyqqBJctHiLvPLPZJuCZpgYLCsTg5Y/lewqLNhkG26TFcpYtLxKFwEccSdlOOV20Mg== 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=VsmcWgX7BL4IwTWY9lLTCwHJynqqmrmN/xhM/6pg+KY=; b=EC4uu/z6rWt8MuwCs/STner4iglHL9/tRIRoDJmin/CBOqBDK5/iZ0QlcdtEEaXJ2YuMVoL4lmip2/S95AIO8FCCdczTdSmYZwmLEAVUJ9vE4zQblLBPxpp/APR/6hhc3cl9DJ3FAhmR2X3theAZiYJ0iEHv3tbiVQY44B3QAVaJJz6t97UsX7RkaGpcRysvcaQxLMnbMW5d6u0tU14+PizqmuPZOlIagFDy+8TVLnLJqPtlgm6tWRsoz4qYvmoiQ5ODlH15RQieKBBoAyLhN9GpdakFARV/xNSxWHcmykZuChnUlsLiy/ivQEnwaQ7g4ROqwRFQX+gW0i2zGKKpSQ== 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=VsmcWgX7BL4IwTWY9lLTCwHJynqqmrmN/xhM/6pg+KY=; b=Npugu+Vxwt5SlIZiAtnGDJyCr6YDjxPvPnY8gUwJfbYh5y4CEeolzlQzseqYcvoIHk3RT4QvNeBZm7w/Lmrz+bRL3SmInu3NkGoQ3dKsqOtYJr9MyV5C/qVhqzYPSb4AagB/VdpKAag0JPtdq4EXNuh6hIo5/JcyeszBvRMkAQ8RQXmMeNmQ6tqtZn2WEjCg8/W1Tom8yaYQVC4jm/qfQIoFSf+oJ0iAFj5uf7J9Z3eYF97Z2q3uPd/EKqzg0hsKrydXjlc/NFnPo64LpnIXH8c8P4dmaO6L6uHClPxEwzczy7y5lu77lEFd+SR4zIBPvkmLEqlUYJx5qGTADJbQRw== 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 SI2PR06MB3963.apcprd06.prod.outlook.com (2603:1096:4:f2::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 10:00:27 +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 10:00:27 +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 , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 18/21] thermal/drivers/qcom/tsens-v0_1: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:22 +0800 Message-Id: <20230710095926.15614-18-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> 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_|SI2PR06MB3963:EE_ X-MS-Office365-Filtering-Correlation-Id: a200bffb-c02f-4319-be84-08db812c7c6a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Iby14uBnVuIKpNoO96hqE77e78s+OOILCK471xzopGgkhPAC/Vzi1NQgUEIr4itx9cBt4IwnnFgLfDEiSW/ezFR66XEYANTVqVF3IN8C0CPiEi7Yu/SCP06SQKzkTd7kO+qLGEdBo6FyErdCB2jXeKvTPZUSh9mv9pADL7xUBMPpZ5WAwS3M0XGgF+SGuegfjb3U0LHolExY6Uii1+au+t1rCyMJBPfLkRi7GjAr9SW6m6mgq0J8GuREakdgWY5MJTdAVVED94eoHmmXc/7dYwd82vMRH8B5xRJ20M6ljuMEq+x714k8uGwISzfCQDkGJefUA/yfsdFJyTLiI95TlVEuV8yFgaR0TkEMl93SPDdhR9lxC8ttfEkq483gEAit9RBbWAFTJ3tfRVcbqKltwzrIp+WZGF+P+xu/xaLeEtkHVXLGW10gII+9E5rfO9zyElkbciG1LmXD/oV/o7i5eA9EQCAs2dJib+EOsSs4AJesDpw2J4blAhszHVF7HcyYz7lOkRUuff0WvnDRMUQsHYvd3Rlv9AxbvX+2/dAQR2DSoBqbEzzmA0uxHdT/LGSGH+ODGfMDpPhDoi1npNi12QrejvLQ3aPvumGucS7ms+F8dT73i3jFhN+kXpHBHTTi 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)(346002)(396003)(39860400002)(366004)(376002)(136003)(451199021)(86362001)(38100700002)(38350700002)(36756003)(6666004)(6486002)(52116002)(110136005)(54906003)(6506007)(26005)(186003)(1076003)(6512007)(2616005)(7416002)(5660300002)(2906002)(66556008)(316002)(478600001)(66946007)(8936002)(66476007)(8676002)(66574015)(83380400001)(4326008)(41300700001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ZZWa4HVs4Xv57LBYf4bu34iGRoFh?= =?utf-8?q?CWnHXvCcHOaSdwiBRm54RddiRLrx/vmoOUuePt0eP820Z3Vv7Xeat61kX5GA8VIH5?= =?utf-8?q?M3PJmvibtbO/pmoKHHKjyQvfhdPM7yKnktYxq9iUmsFWs/IRDRlU+vdevXedkREaq?= =?utf-8?q?DZmi1TSEfsxJNYL0KcWBOwnMkRoYaPyx/z7+lZ5bME4DnSau+y6seo7EQLedgNbap?= =?utf-8?q?FhmDxi4PQcYyVPa0+IynsEiykkgnbnyMFiuLgWZRPd5E9EUYufF6gsvXs8ImKAmKY?= =?utf-8?q?AGFJbwtPJlyJERDvaj4J9qgP8kMz0NGXpWB6ptKRoVc/mXgVeal0MTBFLD1giFZtF?= =?utf-8?q?/aXZHmIRIxBPCogCIbebiiS0DkdX0R4JSV0LbbTnRUJh4TZ8RSZPXypcZ7rc+uBfu?= =?utf-8?q?5vR6Zz4iK0ii9jIW3Y1kMFwlmEEHlmy6KaN7IyyLsEfXghI91gx2zPihDKhfqSXLT?= =?utf-8?q?JEMAbxmw0i+78AZU48yOlHpl59fwPS9dWWNqcUZbC2wo9y4/L6uP+72ZgbqA2xQzW?= =?utf-8?q?44443ucbBiENxOzKlXSo2+2KMzOh/mWyLJN3lqvvKkxg6TyFS8N1UoOdD3yStE2Mk?= =?utf-8?q?mK47YEbIXs/ZCxyNDN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ioDT7IRozX+JtS28GDkPrGwq+J5/mCa7WypLSVggr?= =?utf-8?q?jFfMrW2Be+lC?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a200bffb-c02f-4319-be84-08db812c7c6a X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:27.0495 (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: WB6MutGmOVom+xucUq4Olbw6uTg9admGaKyHtx0tPgBtAfZ1jbm4BWJ1HZ/iSj7qWpV6Nm7uk/1BaUAckMT7CA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB3963 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: Dmitry Baryshkov --- drivers/thermal/qcom/tsens.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 98c356acfe98..d4528d36c085 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -1171,21 +1171,18 @@ static int tsens_register_irq(struct tsens_priv *priv, char *irqname, } else { /* VER_0 interrupt is TRIGGER_RISING, VER_0_1 and up is ONESHOT */ if (tsens_version(priv) == VER_0) - ret = devm_request_threaded_irq(&pdev->dev, irq, - thread_fn, NULL, - IRQF_TRIGGER_RISING, - dev_name(&pdev->dev), - priv); + ret = devm_request_threaded_irq_probe(&pdev->dev, irq, + thread_fn, NULL, + IRQF_TRIGGER_RISING, + dev_name(&pdev->dev), + priv, NULL); else - ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, - thread_fn, IRQF_ONESHOT, - dev_name(&pdev->dev), - priv); + ret = devm_request_threaded_irq_probe(&pdev->dev, irq, NULL, + thread_fn, IRQF_ONESHOT, + dev_name(&pdev->dev), + priv, NULL); - if (ret) - dev_err(&pdev->dev, "%s: failed to get irq\n", - __func__); - else + if (!ret) enable_irq_wake(irq); } From patchwork Mon Jul 10 09:59:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306672 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 230E6EB64D9 for ; Mon, 10 Jul 2023 10:03:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232327AbjGJKDR (ORCPT ); Mon, 10 Jul 2023 06:03:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233060AbjGJKC6 (ORCPT ); Mon, 10 Jul 2023 06:02:58 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2110.outbound.protection.outlook.com [40.107.255.110]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98BB730CA; Mon, 10 Jul 2023 03:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aZyw6G2pNefYS17jxRwKTPn0Jd98FFnNpo5p7eHBal41/vmvsUcJ/V9JkpDawzCKKZJVvQEEMLG4Jz66U/lB//12wc53F5Sao7Z8KJ20SO9DZriU8UUebugV0hw5xwdp0QAhaKbGpXwcWde0UFZop1IZj71Cv2NojqpNfpgLDUp9H/gtntVg81nxUvsl6gU1UmOLprdcFRzqYUEgoi/zfyN+vCEiYyqcOKp04HFb7cgIQxg2DGFaYS7ImVKH72oh+2vx4oFM2CZOv8XEK6gMOMMmS5GXSDFxhK2C7oFGaYxassyHEz6OjXN26u5OLV9ZBfPnZEG0JlCSCJAwOFXykQ== 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=W/w//BqtE6H8wecTg1zc6Yupf+C+wlKTV4AmMFCwu/Q=; b=V/q0Fa/2a4jGnoEG/XGEOiheHyhMI314shHB6xUQbSlROTasRjewUqRXAcPzzJGKNp5B6ZwcChe4FYq6tJ+TOy9sUbZnYZzle8E9HJhEHwzeR5xPvkbbAw9xvL/3ISrcjM6/XWJJZBoC5RcAe18y2bncinDEL28bP6O/MGithSZGXCI/DPRHp37AcTbjbUz8m7zAjQhKzI6bakrAR19leHvaaH6s0BFgEWXKKNPz6oLVEdP/klYBHTBuJ/sZFe5PgtFIGx/ugtz4PX+m5Ao4I/2UTnWF/vsVJ0SfaYMAQp/A7K8alL2Nvy1Q/Hu+ZYQHZ2PEo47/6v7fu0SANaBAyA== 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=W/w//BqtE6H8wecTg1zc6Yupf+C+wlKTV4AmMFCwu/Q=; b=BxBRDJ5fVlRSh4qy3BnkFuDzI2NGLrQdk9Ce/fdo4qdDX/Pl9QABLOy4z85XWgLbxvoSA/gAyGIm7e/n8h6ODjLx4Pf6g254VFXhKtQXDh2mi5YND0sRRnlqyi4U+73ZuVCqmKRZZxA15IfZJIRXmpxNTp9vP1QEboQ7D+e/VW7/nrwmNcH6RAl3KEfZ71kJbj6Kvo72gX4+9WBluZuS0G11PnLU0wQnlh0RNPt8Od0ARVXxxHicGevnXyKaCN7C1UNowRMMwGaSKPKgKajYV5xeCo3X/HQ6kRBnvfD6EGrRTDyxw6DM0M3fFz8u0Ha18kpXse5DAI6FJBccgKxoCg== 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 SI2PR06MB3963.apcprd06.prod.outlook.com (2603:1096:4:f2::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 10:00:30 +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 10:00:30 +0000 From: Yangtao Li To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Amit Kucheria , Thara Gopinath , "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 , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 19/21] thermal: qcom-spmi-adc-tm5: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:23 +0800 Message-Id: <20230710095926.15614-19-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> 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_|SI2PR06MB3963:EE_ X-MS-Office365-Filtering-Correlation-Id: 081ffad6-8613-4e7d-77e5-08db812c7e85 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iOhfQAv3U+V78sVR3FD3jZXUpwShDL4Zi/P5AbI22p7bpTNuVd3J1XyFZFUtXqHa+OqaKPkx5emMkCGAluv2TVKKH7+cw4L44Gg6lI7sBrCIrqtWYhvqZj8yCoNKFhtugCNYTZSQ6cTlipkNzuZSjDc+VERzxB0ZyRFPBaCxLOHW8RT4sEi4n3WlCGcDYR2hY3qGVUgQVeOSqiP8wbkOAZMnk45dHWhXZyiz3ZP82ZhkdNWi88JypKp+Kjmo9bP+3IQit0Qq4fKM0Zf2joze2LncyzytxwGDNjnW+4lBfsR+KSz5FbXamHS5A9iFgmYiscmgr1Hb73SrNY50ps26oKVuEXzWaFG3Moae0iTwuOqvnOPV7Q+PeP1xzQkQPlIb+rzk9R7/pPublvMX9SKy8WjH5oMIMeUk5rG0l8mOY7BsWH8sgHMyZRlfBVRF7l+QLIOS1Oip3oao3GF0P47sKkiNb2EoCnO7ERlgWJehXHQ372RMEoFAeA8UotyPsMOOVETtFugYqi5lC4Jl1jc9ANKCv+25XkaYgeJ2IMHlH/E7KdI8Olk7SGWT3IAA/rbqY1YWprbyaZKIUOUNe3ySiJDUKpwWMgcNID5BFsZCTWmHP9OfolqqFUEeqocwtoCT 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)(346002)(396003)(39860400002)(366004)(376002)(136003)(451199021)(86362001)(38100700002)(38350700002)(36756003)(6666004)(6486002)(52116002)(110136005)(54906003)(6506007)(26005)(186003)(1076003)(6512007)(2616005)(7416002)(5660300002)(2906002)(66556008)(316002)(478600001)(66946007)(8936002)(66476007)(8676002)(66574015)(83380400001)(4326008)(41300700001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?8UEtkPZXgPkQ7j8TLKG9elDjzXZT?= =?utf-8?q?LizWz4IPyiBz39uJynDnWyCuiVN5X6TmlvtzpEFYmgO1SEY21+0G+9HiAO9qqt0mA?= =?utf-8?q?pj4Yk8c63yvoLm0X3Qc8/rpkhgvOhJzFBQBUM35mwrbf9rkFc+/4RebGL2BvT1fhX?= =?utf-8?q?HL/Ekuyh8FwhC3pu7uRSLkw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erZ4XZjMA6HJD8p4Bb61zpErKHz42v?= =?utf-8?q?rwnDHPyCjdhGIxBiadPRahZeoNw7nrLSkmWjXFLV54WHR7sakospnOpCegu23hYsa?= =?utf-8?q?S3nH4YqzVoOzvxeG77ftYe0gZbrK3bGOaTny6Sz43zqi+J+PlBLAGG/erLwFk+Ujt?= =?utf-8?q?h5VX7K0Umj9pJ4BjoktkuuGUy4IKOUOsUQlbTxXz3lyhLeYZlBGEvgb8xkPw9uXDm?= =?utf-8?q?iROlpyYkGVTjgDZ8xt14PuHmjHRqxT0czSnDcxOK/s2KH3shipy+GIM1bCVOwMAMf?= =?utf-8?q?QFRcXGQIfV7iOmPBCn3//JpaeKhTSJ51vAxYBlwBuDJ2CTVqh3+oWbzXkFKhW+LDU?= =?utf-8?q?Mbwsuun5ogRb+SzDkzazRREXkPNe5/ReL5i5TZqX+VSjgevukMXyVfdZoxQbIJ48P?= =?utf-8?q?y6YF2YM+o5ZTvhztLOIEarKz6W2DpYPbZGxBqocv+++tB4S4i7xkn5xiWXMtbWwY1?= =?utf-8?q?xsmAjI+OpmXZ?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 081ffad6-8613-4e7d-77e5-08db812c7e85 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:30.5281 (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: ip65RVVM/spuJ8GTIiT+V7pdCgYdnRMxl/WSlp5p8LbXj5qZNLgFzz77GTMjcyJGBSsF2u4lqz/vXgEjnMZGoQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB3963 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: 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[] = { From patchwork Mon Jul 10 09:59:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306676 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 2C541EB64DA for ; Mon, 10 Jul 2023 10:04:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231478AbjGJKEb (ORCPT ); Mon, 10 Jul 2023 06:04:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231260AbjGJKDK (ORCPT ); Mon, 10 Jul 2023 06:03:10 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2132.outbound.protection.outlook.com [40.107.255.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAA8D35B1; Mon, 10 Jul 2023 03:01:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oI/s1nT7F4GNc8h3G+3IZXilBEYwOOUmWEHNROGlChKYY3LeknUiI7Pux8PR2aC2pANH5+6Qjt9UTcikBGZTV9OdyN/w6Kes/3kHFTHI47+Ry5g8bR8v8Q07zZ5fPYP2dMk4KvDhI/3RXd6oAgvD7PKmVEYWHNOUWXN554GviaiAFb+aqaHPnIONQz4vfEgJxK27bXdr2N94H5uphxIX+V3MM9L2/ZGA7SBSTnC9uvSX28v+dn4QE3DdrAog/VhckG8HNLDpAy36aYgrre/3wqoYS/xeCX5dS9MOukJUXs2B5gpq+3e0w2Kq6YsSPDiVsFf8bM8SQl+jceqHdV74SA== 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=eHS28mIWTpLDBdxBKQHMC8i2TLY/+VTjWtqoEmhSPRU=; b=Iz7csKauyQ3v7FI3hVHVddE55P1CAg0rFd3mM8UQ4Y4iV1BITRI0T7jZ7QWTtnWwyGDtgQVvpcheD+hdUCQLIdT2o/bf4SguznBt4Z9+/wJY2I0vUvg6wwhaxABHCr9m1qNn06BK9vG8JZlL2ZHU56atkiA4dsZWXj+5kZJZRZvPRWs9TxU8JANxdsNsjLa5KJvgcOLGmaghwKMz8PDBk9xMMCO7xgv9XNzmAdCALKUG21yHcyHgkxAZTzVN9MyU3tNuyA+ltBHWPFamvsL4ktdd72vfFPL29OAXlXEwUuojvSdVTGICC7p7u8lIWTZ1KMig76mjFvcLYGp01V5x5w== 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=eHS28mIWTpLDBdxBKQHMC8i2TLY/+VTjWtqoEmhSPRU=; b=GoUD/cVqI5lPxSS09PDJO3cGMIEA3NC1x+cTeabIgL3jC29Bg84EFrRFX5PYZa5rOUr5nmUJsL3cB2CVT7UsFAKX93Ro9z7Wq9oXLjunzhoVmrnMvCX0asIF6Bv9qGUxfH1hOat0jtrFXWDS3zzMrFUK/dZ5SJEWtw2c2qtV1QlY94cqW0Jq1xwcEeYZF+iLiSB4fL2DmU9az7ns2lzApta4e7q9pi9w2uignhozU8/OGoXu60B6/YRRyVHFusH3P4g8tAKzpw71vvoOS60FWr2ms3xd0m8N+nC82azgyUPEdrrY5kATIoeyi4XZNCHYQL1/9kQzfzo3ElFbAy3n3A== 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 SI2PR06MB3963.apcprd06.prod.outlook.com (2603:1096:4:f2::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 10:00:33 +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 10:00:33 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Kunihiko Hayashi , Masami Hiramatsu 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-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 20/21] thermal/drivers/uniphier: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:24 +0800 Message-Id: <20230710095926.15614-20-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> 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_|SI2PR06MB3963:EE_ X-MS-Office365-Filtering-Correlation-Id: 5ec64332-74e2-46a1-c5e2-08db812c802d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9nRFuOtEBI3RTkTY1kG3BdkhA/mxTaPq25KPoW6TN+sS/02Vay/ARsXu5zPdStC4nHUXk3r7FUV0fbFv74NY79BQvSkxxzkO1JdOGjbPv1sc2oxLAIOfguF8aaimnPyA+YEfpGuLKylbNtTYQlvXsWNXxeBqBHC4sYAdsBzHBuFkl1nyjnYE6ZKpFjQxPCsGKFKNgIY8TLJrvv5WBgLS6kF5Dy+OqA1nR9CDaovnyeBzIKGiTRtDngx00sYD3UqKcGXxAIUcXn7VF719T93bZ3CP2kWwonvgat7QYXHWcR7u1f2jdGJOyFkPFyZRGQTELkThk9rbH0kDlK9qR21/z/woUFeK6THMFPoM/7wkIC1nG5aHmNSX5dieouyVjEE8JEzsI7hKHgq5yOvLk6pxC7ThmXAKHdBT1kbfcqG50ir6aDiHF/AkXU01hwcIEyW/SGeLaWMFJ1aWbS8pkicCVEVuBqrbtFYk16QWQPLjqyJbnnis3MnhMW/A521Jr0E7KJ6hmEuLTTN7pjeJbUnn5Wz9Aw1Fj/y0UsgtVAFFQBMkggFDWtmWFh1foyaEkXCOBN405zWpJvjEN5noeo4RI+WAOtFSYbbEZ4QUA1xzwkCg2JvzsS+c522oEOH95qds 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)(346002)(396003)(39860400002)(366004)(376002)(136003)(451199021)(86362001)(38100700002)(38350700002)(36756003)(6666004)(6486002)(52116002)(110136005)(54906003)(6506007)(26005)(186003)(1076003)(6512007)(2616005)(7416002)(5660300002)(2906002)(66556008)(316002)(478600001)(66946007)(8936002)(66476007)(8676002)(66574015)(83380400001)(4326008)(41300700001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?CKzU4mrHKPshw9D84JUwC7vd+noG?= =?utf-8?q?1v1BS6l/6yGkXtlpgNjSlQa7Bs2CROl7Rj+L0svSSIXxpYQsG+yzkHg7nrgkS1M4r?= =?utf-8?q?McX2czOjlU7juyjnElIMHqSET6a8/hxOrwV7q9/Gbw6vq7XbkDcknXTCeHh6O+tBe?= =?utf-8?q?uF6JVn605ofxCsVrtiBYp/+ECPo+FdMSkyrRYe4PgSJeOvy2hxmzeupynC6846YUI?= =?utf-8?q?ZIs87fGUgiaz2nJF7lGNIZr6ORlk56aEC1hZvC+kvVGBef2k5l5QXLp4iuPYq8ZT8?= =?utf-8?q?C9bKWq0kUP30Pr7ZVBqqgRG/iGLBBqL3itXfTVvI5qPeiURWLbc0xFBDD/ZesKwWz?= =?utf-8?q?lm7N7FHUoZk23dEIM9pYpzKqtZdz293uq/HLMFb0iAWdVMhhddxlal1DKqS1OrNIk?= =?utf-8?q?u7tj4W4m2g0wFff6pQmir9b6Sy6+PwssVSkitBRMUfLk1N8P/ckdKdH8WS2thGF7b?= =?utf-8?q?p1+nERaXc5g7AfP2p0gjfBB/ZkYRYAdkh6AoOya2vTH5e5wya0x5LnCQE0aICAxa5?= =?utf-8?q?hnmYkeDgtmXtrbLPq7fuM+amEcwmr+zslA69zc971r3jgWjUFH6CM2wQ+zYLcSOOo?= =?utf-8?q?Mri2KAMOxnTq40zGBJv1f8rsqq33pErt2du7cCFfQqyDNfuy1jTHwKwirUqGZeCDr?= =?utf-8?q?EpauYiRyXioaMRtUp6J6cngb9Ll9rpBuH77oRqJF46b6MZON/ZBcOUUt7DfJBHcuS?= =?utf-8?q?5R293LQevE6nP+PBaiNkNmVZodmgMPKyTCRUhzy9nVqfA55f7djRn+DwvIbACOwTs?= =?utf-8?q?WfjCCSRoS93oo1MU/AWbijNyCbFtGmZ0JuoxrtCDi4STAfj45W1HlAaXI0VIBHq16?= =?utf-8?q?tm/lXYTuLrgvvEWHI+fwnd5wgxMc/Urrx3pQbx4+3j8OvUnZLYPzk89kKB+JU4vBB?= =?utf-8?q?cwxpJvYfLnRR7zxdV9Pexz7oTXWXUOrJJ5seXcrNcQBKDWqaCu1ZvYVN3bzxZb8+i?= =?utf-8?q?ME+xW8AR362GDLhep+L8NOfodetzfWq+tk9sJneUYKQdPLgROkxMhGnYZoSRxNYcp?= =?utf-8?q?3+4ddJaDclXCMShHYIWWeVppmakAcBx0fEccHvVFiFujeJLFzmoiV2vB67JQffeO4?= =?utf-8?q?5V1gYrhJQpOedN2nSxGuY1noNGWvucJeHNLq/t6NQizY1rl7NZE8VKW8kQkpo8ZRE?= =?utf-8?q?8qD2dgI2Au/XxMi8Q5/FuephSGwGaDVGAMyQn+fYgzG+5WPY+HmULEDu8Afa8ricA?= =?utf-8?q?gjp3KqLrVMiHVeupOYYVC5y1qjazs0rtwbtqHXBRT77Hpe4/PinEXX1MRrVtghpOd?= =?utf-8?q?kBh69VfdP1FCppStO/90Xf/MN55wq8nUnwrzk07CD1j2STxck2gWCOU+EyWThRRbY?= =?utf-8?q?NC1ZGHCViacYlIl4pMfbjEULalT4rgERxnTCitgREaGCy70AyReFhazul3PTCjvMc?= =?utf-8?q?vTOWJQqS0kyvnYm/S5eSXAcmHYeHq830ac3G56t7Ym3NA6wdTZza4aUm91yjsD8eo?= =?utf-8?q?1mCoFjXvSUPjTKKH9KWim37f/1Har1OxZva6ykwGbSv7bYmfKU+rmu02+E4Aumvt4?= =?utf-8?q?Fh+losfGpQuN?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ec64332-74e2-46a1-c5e2-08db812c802d X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:33.3917 (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: qH7Rf9GFzypxmdlxNU5OBBiNXki223smMMQeIVnlo33vIYY/4bXzRA0WOYgWva+H20kpDjplvbNiJF4HFQfGcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB3963 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/uniphier_thermal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_thermal.c index aef6119cc004..34d8eb2138d3 100644 --- a/drivers/thermal/uniphier_thermal.c +++ b/drivers/thermal/uniphier_thermal.c @@ -278,9 +278,9 @@ static int uniphier_tm_probe(struct platform_device *pdev) return ret; } - ret = devm_request_threaded_irq(dev, irq, uniphier_tm_alarm_irq, - uniphier_tm_alarm_irq_thread, - 0, "thermal", tdev); + ret = devm_request_threaded_irq_probe(dev, irq, uniphier_tm_alarm_irq, + uniphier_tm_alarm_irq_thread, + 0, "thermal", tdev, NULL); if (ret) return ret; From patchwork Mon Jul 10 09:59:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 13306677 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 09D37EB64DA for ; Mon, 10 Jul 2023 10:04:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232574AbjGJKEu (ORCPT ); Mon, 10 Jul 2023 06:04:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232650AbjGJKDU (ORCPT ); Mon, 10 Jul 2023 06:03:20 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2110.outbound.protection.outlook.com [40.107.255.110]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C6CA3A89; Mon, 10 Jul 2023 03:01:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KAE2w8x3Gy4WHLvpmjKYRA/8atOxvGzsEshR5sQb8ltMJFG/TbcDmw/Oi7RCaa2XPSLcMdy0lDzcYnPVr6JdJn3HpISLLC/WNppb0xz0UzRkII+dRi/POHrRaLpKxSihWtwSRuw9nonZVicK7vRoalRkpMDAmhN+hb6R2I7wAaxN9F+1L7pqIqYWj9n5yHr3aD0TuXH+LGaZ0rgA8tAzHIb0AX7Jge+yQWWHh6iOSipOt9fi+wy0wxUkWMqTqZvzuX5cz0D5qnKYzZp2rFn0BS3wopeH+Pnt4BSE24HsL1RxzkCqj7iqr1e6X8fVA3Ppx+wcTW8OL1yCwp9ItZ4FUA== 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=fIbTe94tJb+c7Hut//D6DIRJqgxdHnLzwdkufWRqizI=; b=YgzuHLhDny5qo3WJ46Z60KENYJOUM5a/kE9LLplpCN+it1aQuEC0mAWNI9bCowFfo0YI2tpLIpfW7UUN5bmAJbt+1VvtD54zHfNBNk/yTbmJ3zNaUxSYRmfoIntGQ8yPTPiBgF7PHX//GfyT0e1d715SdjxV914iJ4fLltexRcoFqa2n45qLDYZC0v/WnCFZUlRlPcejA/AqDzIczp4SgROUgMnq5eApL6Qmt0WBRGoH324IBnyMUJJiIaTuRo0yi6pu2oWHD6p0cdEwgo6NBMfeMdqX3qXl8X9Z0RcOBBsHVb6DHzjTYgnpsTLGlV73gn2rdTBEeanUcvvbXH8mPA== 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=fIbTe94tJb+c7Hut//D6DIRJqgxdHnLzwdkufWRqizI=; b=XYzPUgGWsLIsbgQ8JU3nI5zGGZqlK2HwSdaopqrOyHPwy5L1ZiMadso3bfvNNcab9pr5ap46KSIo4FhkQoqJs842DwW4jTeQUxdG51jfJNpvov5wjqamfpftzyCOmvD44bNHFn0c7LSJYSss/BAWcaWfEYIwgQ4/suEJmDra2LimhtW1G1qvG6n9gPGaJ2jNWSx3A5raFHgsXUwyhccZ4OHwjmHN+ZsWVQICuptp7OlUI4PKhIIOodwviROa4hsgA5FdYPj/j1j1IL1ZMjAIEGj5oSbuRp8BdanAlAuZg2weaY1sKlZ4iwEb339zJBRE7Wy9k1QrZpcvqaM3D1/ssw== 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 SI2PR06MB3963.apcprd06.prod.outlook.com (2603:1096:4:f2::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 10:00:36 +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 10:00:36 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team 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-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 21/21] thermal/drivers/imx: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:25 +0800 Message-Id: <20230710095926.15614-21-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> 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_|SI2PR06MB3963:EE_ X-MS-Office365-Filtering-Correlation-Id: 111c1420-0d5f-4fd1-d28d-08db812c8218 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aaFCJ0GRr6hEhIaAfDsPP/NeN8f0IPCndZLvjGyrzyX1+6U29QLUR1YJre3A2mS7jZn4h5xu0Yv3iCUoNIZAKEk0zWZYu1opBf1pRxUydcAWIpFRC1Zq7RgYdOkNo5zNx3VNc5bxe6zRrR+eeWVElUUPiyioMq0pRnEzMBn9+NAIIUq+1s2Na29msxR8B2MJ6/hnty8Yh+tcnpT8iqKgjhxKsWULhET9Vd85wPxDTdRa58pHM/jLGycgk92lw714SvxehZIitnBovYbhn2XoDH/hfVJw+lxsCj+Z2IMzNjNU1W34sEycP3LEyZnzzfDh2n7a1DP249mIqZ71ULS6/pHBLM2uiT8izUfcj9bzlYMia7V7HfY7sDLN81bwuiqul7neNT+KQuHMEr16UfDVP02ae6NdwpKmFNhNUGg1BkCDDiA9xRZxWoDtjxgbbWPxa13Ycz4gpSnpmzxldaBtgIlNwah/iVUbFobUTBsOqERUNIGZh2nDkbx4UtlT8W0AYYWhzWtdkL6YL+QiPeLGhrrOx4XGE6l0GB1fEuqQ+2Ltmu4oQnqowVFQ9/14/AaEbLz+YwWEs6d1+emT3gxY2t66v7M0HVsXclIVVfLQyDSSDExqr/AglnEYALKCNjVJ 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)(346002)(396003)(39860400002)(366004)(376002)(136003)(451199021)(86362001)(38100700002)(38350700002)(36756003)(6666004)(6486002)(52116002)(110136005)(54906003)(6506007)(26005)(186003)(1076003)(6512007)(2616005)(7416002)(5660300002)(2906002)(66556008)(316002)(478600001)(66946007)(8936002)(66476007)(8676002)(66574015)(83380400001)(4326008)(41300700001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?WJo4Lywmvhp/Gn0HlmJzU8pQtdTd?= =?utf-8?q?kPzt8SEEy00Y9p6uMAlGljFwyLUq/lr75zdqbbI/wI67vWjtDllPMia2idK8/CYG1?= =?utf-8?q?bn1jjXuWfL6HsJyz6amufcU00qTdpeY8/heg1SyMhCNS+QdBMAc0vhb1wDDrrB6Wn?= =?utf-8?q?d/juhe9jN6MV3Su2HPTHMUeOFS0VIrmSDWVgK7FNh9NPf7kSEhjVLIyiHjhCuRE8/?= =?utf-8?q?/DIobfanWw00Mukji2b4hXz9vzwWD1rnOhafMWXmGO+14DOBDVV5DsMUVW30k1aw0?= =?utf-8?q?/KQtWN3yjZYlZKJZUI8puN7ycZrZEpRkDPC1Ql2nFByErP2Kh76MTEjBXFS1XC1nJ?= =?utf-8?q?xehjUByDAP7Dt9qfG2prto6Tr0hwTRbQap8wlXKVJo+wie2yJCT1IhOOjvn6kGMHI?= =?utf-8?q?rDkU3nWakRgQCWOsnI+pt8zbkGOewCVTuQhwumjgjAJBKb2GE3x/nyJd9oGJtxBW3?= =?utf-8?q?w7iecFXKOmGnSLxeQQKnTL9f8zhk+gMkoiChnX6iRqWpza1gGSN2zgtClLMIEkBOs?= =?utf-8?q?EanIObTSFc9MSETFtpaYCCJhZmHkE7Vyp2CkfSUPtCctsjjHsQxUc4g0ny68A4QNn?= =?utf-8?q?jAmWdYnkNj277u7+j5p+zrgGZjZJw+itAgbp8xlDJhYnAHh7dNW03T7Q+vEkcJlMt?= =?utf-8?q?L1sOxAoCF2xSC9p7H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V8h3?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 111c1420-0d5f-4fd1-d28d-08db812c8218 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:36.6174 (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: +cGO7Kwv0BXLdlMBL/xtRPe55oefXmKqxUPwmDA94Aw9tttQH0I4Mw31/DauTr1HOWvRYh/awEi6YHVgzva/pA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB3963 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/imx_thermal.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index a94ec0a0c9dd..3131a09f9906 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -746,13 +746,12 @@ static int imx_thermal_probe(struct platform_device *pdev) if (ret) goto thermal_zone_unregister; - ret = devm_request_threaded_irq(&pdev->dev, data->irq, - imx_thermal_alarm_irq, imx_thermal_alarm_irq_thread, - 0, "imx_thermal", data); - if (ret < 0) { - dev_err(&pdev->dev, "failed to request alarm irq: %d\n", ret); + ret = devm_request_threaded_irq_probe(&pdev->dev, data->irq, + imx_thermal_alarm_irq, + imx_thermal_alarm_irq_thread, + 0, "imx_thermal", data, "alarm"); + if (ret < 0) goto thermal_zone_unregister; - } pm_runtime_put(data->dev);