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: 117795 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4915286vqx; Mon, 10 Jul 2023 03:11:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlEkK5VzwPJ1ZOZb893El+AiZZDPm7xe3RCY10w5oMWr1vNs+z6O++RYDFPrx46LzorgIeya X-Received: by 2002:a17:906:de:b0:974:1d8b:ca5e with SMTP id 30-20020a17090600de00b009741d8bca5emr11923127eji.14.1688983910760; Mon, 10 Jul 2023 03:11:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688983910; cv=pass; d=google.com; s=arc-20160816; b=JD3drO+yxozIC3HhyMVmVYBICZo26o0aU4DuEiG8GC7Z60WvwykhHfEh60oc4nNnDv RVV9heFeLo2xEN4R1s5mskdQJ129rltre1Hi8A+QQ4faa7DdpJN5OIqzAkJfCXYgl55x 48XNzpb7XiXS7VECMJAW+JTj1uWCp+zHmkenAbj7kxmBdRGeV78Budz1pKd57WB0lCqp GrotBNh5Dsi4EKJbsnA19glQgCsuNMin96jQ8O3QjQA+kQydfI8wyEw5mcuLo7E6jTxh CN/XdtA5vLwEafByXf3WqTsb3it962jrVJvrcSXPJ0QfL73l8I9xtR9MvFprCIad3pr3 RH0w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xYCHd8IQ6ji4sShp4rRPeQ8MYVrT/eJGfgORNUxt/lQ=; fh=Oibj40jLHRVC1CNBeqF4vFAnoRGW+CfBwUQE6oRh3ds=; b=1HSayrWOaKts5K1yR5RLU+ORu7kG3YvaH+8hOMahUbdoIsMdxDeOeOFx9ROTDQgIeb lBAmAv1qGphssWLOTI4tOTOpuv9MGZLGOsi+4y/8w4nBJ1RTwa4nnhqcnHMPz9QWlJjM M5xW3uYtnNG9jYqWbP93tf9x0mmUWgmGoWInoqvH8KvRI5UwCXFGeL5PeQv+dQMxyrAO azxQajYyK/rJwuzEq7mJpgUPYyEw3grSh8z/1qyrSPnMTM9pGDFJ9gzmzOKC6ED75gxQ 5xlzNw0TWEpNUE68hRGZ3dl7uUmrsAqO/DuyRDWEv8+mHy6hBb+if2m/FA+T2acWnuOe RdeA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=CYOjDyK4; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e17-20020a1709062d5100b0099290e2c162si3173725eji.444.2023.07.10.03.11.25; Mon, 10 Jul 2023 03:11:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=CYOjDyK4; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233137AbjGJKE1 (ORCPT + 99 others); Mon, 10 Jul 2023 06:04:27 -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/lRS3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T51EaBHzXl2mJnm?= =?utf-8?q?CeKnuQ6OtftwrIAb24d+3ziO12Lhf1Ko9vd5/BgSJq5meGnxMLxlx2TBDOYspiRnN?= =?utf-8?q?PDE/+Ik7eLpmckrwLDbO5b8GMIolVMAjzw+mWeTnYiPeLlG/Srnw5IVnvDHC2e2QE?= =?utf-8?q?b0UjKuJ8cZ+4xaABhTYYSAYF+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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771027993231994025 X-GMAIL-MSGID: 1771027993231994025 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);