Message ID | 20230721094641.77189-16-frank.li@vivo.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp96605vqg; Fri, 21 Jul 2023 03:07:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlHtp4AmfT5+oc/xSdc9QxpuDS4V2Iw85O8swhBMEO/nitKt558Blb7zBnlc6oOzI1hZmsIf X-Received: by 2002:a17:902:f68f:b0:1b6:6b90:7c2f with SMTP id l15-20020a170902f68f00b001b66b907c2fmr1558184plg.55.1689934049867; Fri, 21 Jul 2023 03:07:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689934049; cv=pass; d=google.com; s=arc-20160816; b=m0RN9xw+vrnFNzO2ZEYG8aH2WgV5X1A6qwtxq7NYB/jukgEZpzH4ZMn61qkA37H7QM Ajk33nfn3vmbeRDOFf9bFNSHcdOQ9SsVhkvb5AOMibO6metWKVYkaU1cL75yxTvtndaj cqjJ77ozsfxSjOaME2k5TyPINfVoy+xJGhypSg+hCulLh2eWgSrG586liVVYpK347ZTp aDWpB4Ev0u8wKk9tVSoGIjYLf2x7cXOlnnV2rCE/jodaX2sj2NWMhpkx8sHBzzHASHeD VzcuF9FL/YSwE4ur6sulet9AwFNmhUMfSwjZKcW6TcANaJxmZdjptVZIK466nO9f2uSA 2yaQ== 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=f4bfb4yk8VVql8CBIboaJds/47jikygD97Ynoj6D92M=; fh=KTv2T1r/QNJZkf7UmS3j/ysaXQ+6ICZoxyH0IbK8Eew=; b=ZoZSdwA+MGFgi22zA9x1xYItHQYLODOfyey7IJXLNfgxu7Vh4AZh3zycYtXxIuyCla znPylttzhbiCHyinw+TA+Hu+hSqf0R7y5Rf4eUZoFn0z3P4Jb9ymNIE5y4jmuka7lH6N /4MP37KKuddWUSSj+Dc5eWFGFHNtzXwcOL79qQTewPtbvs8C20BfmCVo1KekXpMQ3LcQ vDm/sluwl+c7/DhQr10toewrKmVB+YheRK5PFExJlUDnfLANXtEYG0qMHofcUar2F0h/ +4n32+XzGhtPdwxr/w+msDbDGHOXj6kB9kB9xaf4QH2Io4lvc0gvNwb0F1g17TCJrUAG AnhQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=dnnKKBLO; 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 m3-20020a170902768300b001b035ce0649si2648010pll.372.2023.07.21.03.07.00; Fri, 21 Jul 2023 03:07:29 -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=dnnKKBLO; 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 S232023AbjGUJuu (ORCPT <rfc822;assdfgzxcv4@gmail.com> + 99 others); Fri, 21 Jul 2023 05:50:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231822AbjGUJuS (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 21 Jul 2023 05:50:18 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2119.outbound.protection.outlook.com [40.107.215.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EC844220; Fri, 21 Jul 2023 02:49:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J43RpKt4DRzZ7yOxVN9y3MgwYBWFbX2tH8eAl/7XdwNMzjTpgCC4EICZVVDnNU2qk4mZKf8Jw60FR+dubR6MUPlkklnSpsyDlCxBdbaq9hkSmlsWCxGjC4CcWbW1ClEjDMw6i8y13xuyzRb5VTWG8FmTBb3bOPIodkdvYPOpQn3FRdufbj8qefUauAbkGFyNVys6lOqWow9Lv5IOgHlSSKYA5OEDSfMZOKkW7CSygMXkdrVwUsxhjzZuvnXMtJ/7yrft0rPvKY0Ws481XQTIZlpGIXriIjlzOhjsG403wCcvv7pQhPZn+5ZWAtsFtkbRT3ZA1spIJoncfnuWGKkplw== 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=bZo1qAAcMO6KhjoLfNW/o9Oj1skYQ/Akx/kw5pFjTxFWnsI5YKh8vEMMWCiRMfp/US7727c+U+WViK2TKwDzf5iweYZcwNqbao2Krls+M1hRCd5fdingjLjgrNNWdrkEOJeb8Q/cNnROJDpLbyuocxbLRefrHbHEXtsjKQUQDye19cqTHv8UntPH/xP1BgAm4lykfGOfxzdLcO2WcIEeRLOPUnoX4rAhJbazwio0ukrchiG87DBzFKWBg1bfVbxKJyQ3e57OF0EI0dBWnmLlY6MdYtRpQFgKeT0R+BjSYb7M93FWCPERxVMpB6QuRWt4TmudRT7bhna7VJCMpU/r/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=f4bfb4yk8VVql8CBIboaJds/47jikygD97Ynoj6D92M=; b=dnnKKBLOvkjihUG90bDE71v/OBJS0X566qXj11vWSsMEnnUfPo36m7VEixLFmq12OsblsyGelu9dnjVp99ujhSM+W3SVY+P2wlZ+gZNk6VX6Rc5+FgOQKp2KuRvkcGQ2pNba6AaxR3N3x6YcmHNOGeIjR8J8iKWcznoiABqco5y7Dlu2yMAr1kWhe/Vj1T43p2iSy3I9IFTQGdN+X0hw98kpCxw4H50xJxxmik0tkn2Xmr+c4NrllWji3sRHaVLFLK0xmiU0W38oexps7uXwXZxH5eg57Xc1TksW+OQ1wNu4aUTiPZduxjCe92BrF3TqvuQPXNHGvse6s11iRbzxGA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:35 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:34 +0000 From: Yangtao Li <frank.li@vivo.com> To: "Rafael J. Wysocki" <rafael@kernel.org>, Daniel Lezcano <daniel.lezcano@linaro.org>, Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com> Cc: Yangtao Li <frank.li@vivo.com>, Thomas Gleixner <tglx@linutronix.de>, Krzysztof Kozlowski <krzk@kernel.org>, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>, Jonathan Cameron <Jonathan.Cameron@Huawei.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 16/22] thermal: max77620: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:35 +0800 Message-Id: <20230721094641.77189-16-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 54eaae52-7f4b-4efc-0536-08db89cf82c2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mrjw952keaR9LHfNm1FjYtJ2bgUpy/RDKZ5P75vKFScAmbDLZN7IpooC+JoSdBORrvV2jci8jsZHj/uCno7dZ0F4NeYb2DiP03hOtkvPgkdbBCTjT5l8gTxxTbOiwiV41Ve6XCErYqjDFabQo/MwUEl1ISPWpLkv0dyE1/uU1enmg9k/MglS0q+wpRyGpnRBBwfP6enDlAz/kYCiPlHyDwfRkF+c0Yqw3VnklvYUJqKOyZynwU6sh3oZ8xr6lqClaiHkUM1XxgBY9oAA8SO8Y54CmbX7t8p7sBmteWAh6UGDHqs2hVNCLl3zZfA/enNpEJ+2EGJeHFtCQR5lOUln4CjTQ9he4bC5V+n4matfRVxswm7UKXuyJzX2YE3qDoBeiqWWv8GFuEfu7hWZXzcM6A0vC7/TzBSvZSA0VAee+DB9g5H+nYZJDOemHX3VOPAZy+bHS+FJswgae1VxCqdKwQ6BJhez1Tkoj9DqSOSicqEX39jG2MBFGuZ6Sc2rQLPQjM28JcBhmdWjZVOy3q530OYWldsUB2BsWBYPUWs4vCZc35UAHVB/HDCdy4pqpeHU/eOYACsKMwQHUo4G6W2lXiCmTruk5BxwzD/iAd+NpaXfOjjzP00v9bN7yRu3D2L+ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(7416002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?6SHKl2amuMQC0zaHdHkMS0WGCZ/E?= =?utf-8?q?dqaqC5wAvPCo9ZglKMXN0yl+TCnC0+wxme2VE7Mep+hG+E3JB+F/klMfjRvBMaCt1?= =?utf-8?q?jME96BGgebzH6g8ZDxV35yUbGndvhKgEop+8FFbFnpKzp0s3G1PNMh739rXiRVi9T?= =?utf-8?q?91pPzEBx9Z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VVns3ot3dKcKocqjkVocb93031b/bf1GM9uEmYrhxk?= =?utf-8?q?0LLJZuNUQ1jGeBBJTGBjjutrUGxGpiun0lhbh3AqNz8A3qPHU0rtJWoSM9JgIdKYi?= =?utf-8?q?Qt2YQqYy6RGxB+vn73fGgVooLT7V+0yEsFc4otqdxU5kr9gdlPr0sKGtnoGPtBVfp?= =?utf-8?q?JqpbMnHXm2m06zd9ZJEomiZf5NgNlhnGmkjazTTYUe1bIenVT3ZLwuHGB54zaaIQb?= =?utf-8?q?NeRy1KjzuDTBbMiMwb1dEzje8aSsCsJOzW+8MMMpxrOoa/7S5VL/hOlf/d127OV6H?= =?utf-8?q?qW1s0kQcb2A2rQt3FZvkpLhX6iDekbo4XMowjjWhwya/vdSndQlunw21skmFkt461?= =?utf-8?q?o9gDWwo8MnqUclg1uJlKknbA9OewNKklvJL7HpGN3ViMWEjmvDmqIX3+LEp3cMtmv?= =?utf-8?q?b2swWKVg9Ik6nhrAPZMj30c6t+p2D4lb2Wt3OCWvE9id2+eaS9hMRUqoPwrRr/vZZ?= =?utf-8?q?y2qyBeyK5jrL?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54eaae52-7f4b-4efc-0536-08db89cf82c2 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:34.9390 (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: hPReEiJND1ptIyymzFa/lkGX4NU7ll0E1KKVpG+b//GAxdCgThRqrlCglyx7/om2NvTTJuhBUhrOnPCKVTzwzw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 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, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772024286474527770 X-GMAIL-MSGID: 1772024286474527770 |
Series |
[v5,01/22] genirq/devres: Add devm_request_threaded_irq_probe() and devm_request_irq_probe()
|
|
Commit Message
李扬韬
July 21, 2023, 9:46 a.m. UTC
There are more than 700 calls to devm_request_threaded_irq method and
more than 1000 calls to devm_request_irq method. Most drivers only
request one interrupt resource, and these error messages are basically
the same. If error messages are printed everywhere, more than 2000 lines
of code can be saved by removing the msg in the driver.
And tglx point out that:
If we actually look at the call sites of
devm_request_threaded_irq() then the vast majority of them print more or
less lousy error messages. A quick grep/sed/awk/sort/uniq revealed
519 messages total (there are probably more)
352 unique messages
323 unique messages after lower casing
Those 323 are mostly just variants of the same patterns with
slight modifications in formatting and information provided.
186 of these messages do not deliver any useful information,
e.g. "no irq", "
The most useful one of all is: "could request wakeup irq: %d"
So there is certainly an argument to be made that this particular
function should print a well formatted and informative error message.
It's not a general allocator like kmalloc(). It's specialized and in the
vast majority of cases failing to request the interrupt causes the
device probe to fail. So having proper and consistent information why
the device cannot be used _is_ useful.
So convert to use devm_request*_irq_probe() API, which ensure that all
error handling branches print error information.
In this way, when this function fails, the upper-layer functions can
directly return an error code without missing debugging information.
Otherwise, the error message will be printed redundantly or missing.
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/thermal/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);